diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 8cd5aff5..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.sh text eol=lf diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f78c3926..b4978944 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -29,18 +29,12 @@ If applicable, add screenshots to help explain your problem. - Network: [e.g. LAN/WAN, reverse proxy, cloudflare, ssl offload, etc...] - Version: [e.g. 1.0.43] - Node: [e.g. 18.4.0] - -**Client Device (please complete the following information):** - - Device: [e.g. Laptop] - - OS: [e.g. Ubuntu] - - Network: [e.g. Local to Meshcentral, Remote over WAN] - Browser: [e.g. Google Chrome] - - MeshCentralRouter Version: [if applicable] **Remote Device (please complete the following information):** - Device: [e.g. Laptop] - - OS: [e.g. Windows 10 21H2] - - Network: [e.g. Local to Meshcentral, Remote over WAN] + - OS: [e.g. Windows 10] + - Version: [e.g. 21H2] - Current Core Version (if known): [**HINT**: Go to a device then `console` Tab then type `info`] **Additional context** @@ -49,7 +43,7 @@ Add any other context about the problem here. **Your config.json file** ``` { - "$schema": "https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json", + "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json", "__comment1__": "This is a simple configuration file, all values and sections that start with underscore (_) are ignored. Edit a section and remove the _ in front of the name. Refer to the user's guide for details.", "__comment2__": "See node_modules/meshcentral/sample-config-advanced.json for a more advanced example.", "settings": { diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index f2e315ce..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,11 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Question - url: https://github.com/Ylianst/MeshCentral/discussions - about: Ask a question in discussions. - - name: Unofficial Discord Server - url: https://discord.gg/8wHC6ASWAc - about: Please ask here for support questions. - - name: Unoffical Telegram Channel - url: https://t.me/meshcentral - about: Please ask here for support questions. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d5a2c9f6..c8b3dd93 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. @@ -26,7 +26,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v1 # Override language selection by uncommenting this and choosing your languages # with: # languages: go, javascript, csharp, python, cpp, java @@ -48,4 +48,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index f2127064..f4bae68d 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -14,8 +14,8 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 with: python-version: 3.x - run: pip install --upgrade pip diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index e4bafe94..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Docker -on: - push: - branches: - - master - release: - types: [published] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - check-token: - runs-on: ubuntu-latest - outputs: - token_defined: ${{ steps.token_check.outputs.token_defined }} - steps: - - name: Check token - id: token_check - env: - MY_TOKEN: ${{ secrets.MY_TOKEN }} - if: "${{ env.MY_TOKEN != '' }}" - run: echo "token_defined=true" >> "$GITHUB_OUTPUT" - - build: - name: Release - runs-on: ubuntu-latest - needs: [check-token] - if: needs.check-token.outputs.token_defined == 'true' - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.MY_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: docker/Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - INCLUDE_MONGODBTOOLS=true - PREINSTALL_LIBS=true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index acf16409..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Release -on: - push: - branches: - - master - paths: - - 'package.json' - -jobs: - build: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Release - uses: justincy/github-action-npm-release@2.0.2 - id: release - with: - token: ${{ secrets.MY_TOKEN }} - - name: Print release output - if: ${{ steps.release.outputs.released == 'true' }} - run: echo Release ID ${{ steps.release.outputs.release_id }} diff --git a/.gitignore b/.gitignore index e2031237..83a4f0bf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ [Tt]yping/ [Ii]mages-spare/ [Dd]aemon/ +[Bb]in/ [Aa]gent/ [Aa]gents/modules_meshcmd_min/ [Aa]gents/modules_meshcore_min/ @@ -10,12 +11,12 @@ [Aa]gents/meshcore.min.js [Pp]ublic/translations/ [Vv]iews/translations/ -[Ee]mails/translations/ [Pp]ublic/*-min.htm [Vv]iews/*-min.handlebars meshcentral.db meshcentral.db.json mesherrors.txt +package-lock.json bob.json .greenlockrc @@ -41,6 +42,7 @@ bob.json x64/ x86/ bld/ +[Bb]in/ [Oo]bj/ [Ll]og/ diff --git a/.npmrc b/.npmrc index d1cdf2f0..4fd02195 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -engine-strict = true \ No newline at end of file +engine-strict=true \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 596995f8..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,922 +0,0 @@ -{ - "cSpell.words": [ - "abcdf", - "accountchange", - "accountcreate", - "accountid", - "accountremove", - "acebase", - "acmd", - "acmepath", - "actiontype", - "adddevicegroup", - "adddeviceuser", - "adddomain", - "addmeshuser", - "addtousergroup", - "adduser", - "addusergroup", - "addusertodevice", - "addusertodevicegroup", - "addusertousergroup", - "adminaccount", - "adminname", - "agentaliasdns", - "agentaliasport", - "agentallowedip", - "agentapp", - "agentblockedip", - "agentconfig", - "agentconsole", - "agentcoredump", - "agentcoredumpusers", - "agentcustomization", - "agentdownload", - "agenterrorlogs", - "agentid", - "agentidletimeout", - "agentinfo", - "agentinvite", - "agentinvitecodes", - "agentkey", - "Agentless", - "agentnoproxy", - "agentport", - "agentportbind", - "agentporttls", - "agenttransfer", - "agenttype", - "agentupdateblocksize", - "agentupdatetest", - "agentwscompression", - "aliasport", - "allevents", - "allowaccountreset", - "allowframing", - "allowfullscreen", - "allowhighqualitydesktop", - "allowsavingdevicecredentials", - "allusers", - "alreadyinstalled", - "amtacmactivation", - "amtevents", - "amthost", - "amtmanager", - "amtoff", - "amton", - "amtonly", - "amtpass", - "amtreset", - "amtscanner", - "amtscanoptions", - "anewaccountcaptcha", - "apassword", - "apasswordhint", - "apikey", - "apos", - "appmetrics", - "apprelays", - "ashx", - "assistantconfig", - "assistantcustomization", - "assistantnoproxy", - "atag", - "authcookie", - "authenticode", - "authfail", - "authlog", - "authlogfile", - "Authn", - "authorizationurl", - "authstr", - "authstrategies", - "autofido", - "awsrds", - "backgroundcolor", - "backgroundonly", - "backupcode", - "backuppath", - "badargs", - "badtlscert", - "bancommonpasswords", - "batchupload", - "bitmask", - "Bounser", - "callbackurl", - "captchaargs", - "ccmp", - "Centralv", - "certbot", - "certfiles", - "certhash", - "certkeyhash", - "certpfx", - "certpfxpass", - "certurl", - "cfile", - "changedevice", - "changenode", - "changepassword", - "chatnotify", - "checkemail", - "checkmail", - "chnl", - "CIRA", - "ciraconn", - "ciralocalfqdn", - "ckey", - "clearpower", - "clientid", - "clientsecret", - "clipboardget", - "clipboardset", - "cmdoptions", - "cmds", - "cnonce", - "companyname", - "configfile", - "configfiles", - "configkey", - "connectionstring", - "Consts", - "cookieipcheck", - "cookiesamesite", - "coolofftime", - "coredump", - "coredumps", - "createaccount", - "createmesh", - "createusergroup", - "crowdsec", - "crypted", - "cscli", - "curloptionshttp", - "curloptionshttps", - "cuser", - "cuserid", - "customui", - "datafile", - "datapath", - "datas", - "datastr", - "dbconfig", - "dbdeleteconfigfiles", - "dbencryptkey", - "dbexport", - "dbexportmin", - "dbimport", - "dblistconfigfiles", - "dbmerge", - "dbpullconfigfiles", - "dbpulldatafiles", - "dbpushconfigfiles", - "dbshowconfigfile", - "debuglevel", - "defaultuserwebstate", - "deldump", - "deleteaccount", - "deletedefaultdomain", - "deletedomain", - "deletemesh", - "deleteuser", - "deleteusergroup", - "deluser", - "deluserpath", - "DESKLIMITEDINPUT", - "desktopmultiplex", - "desktopnotify", - "desktopprivacybar", - "desktopprompt", - "desktoprelays", - "desktopviewonly", - "devbox", - "devicefile", - "deviceid", - "deviceinfo", - "deviceinfocount", - "devicemessage", - "deviceopenurl", - "devicepower", - "devicepowerevents", - "devicesearchbarserverandclientname", - "deviceshare", - "devicesharing", - "devicetoast", - "devid", - "Digesthash", - "disablerequestedauthncontext", - "displayname", - "dlccore", - "dlcore", - "dldump", - "dnscount", - "dnssuffix", - "domaindefaults", - "domainid", - "domainname", - "domainurl", - "domainx", - "dont", - "dontlognull", - "downloadfile", - "dumpcores", - "dumpfile", - "editdevice", - "editdevicegroup", - "editgroup", - "editmesh", - "edituser", - "emailaddress", - "emailcheck", - "emaildomain", - "emailexists", - "emailok", - "emailvalidation", - "emailvalidationrequired", - "emailverified", - "entityid", - "entrypoints", - "errdesc", - "errlogpath", - "esversion", - "etype", - "eventlogger", - "exactport", - "exactports", - "exphbs", - "extractall", - "extrakey", - "extralinks", - "extrascriptsrc", - "factorauth", - "factorwarning", - "fadev", - "fahold", - "fasent", - "fastcert", - "fchallenge", - "fileaccess", - "filedata", - "filefullpath", - "filenotify", - "fileprompt", - "filesize", - "filespath", - "filestats", - "fileurl", - "filteredusers", - "filterid", - "firebaserelay", - "firstname", - "forceduserwebstate", - "foregroundcolor", - "forwardclient", - "forwardfor", - "forwardwrite", - "forwardwsocket", - "fpath", - "Freemonitoring", - "frontends", - "ftarget", - "fullpath", - "fullrights", - "fullscreen", - "gatewaymac", - "generateinvitelink", - "geourl", - "getnetworkinfo", - "getsysinfo", - "getwspass", - "googleusercontent", - "gotodevicename", - "gotonode", - "groupid", - "guestdevicesharing", - "guestname", - "GUESTSHARING", - "hashhex", - "Hashi", - "hashpass", - "hashpasssplit", - "hashpassword", - "Hashs", - "healthcheck", - "Hilaire", - "hkey", - "httpheaders", - "httplog", - "httpport", - "hwchallenge", - "hwotp", - "hwstate", - "hwtoken", - "Ider", - "idexists", - "idhex", - "idpurl", - "idsplit", - "iframe", - "ignoreagenthashcheck", - "iishash", - "imagebase", - "imagefile", - "indexagenterrorlog", - "indexmcrec", - "installflags", - "installsize", - "installtext", - "intelamt", - "interactiveonly", - "interuser", - "invitecodes", - "ipaddr", - "ipblockeduserredirect", - "ipcheck", - "ipex", - "ipkvm", - "iplayer", - "ipranges", - "isaml", - "Jitsi", - "jumpcloud", - "keyfile", - "keygrip", - "keyid", - "lanonly", - "LAPI", - "lastaddr", - "lastconnect", - "lastname", - "ldapauth", - "ldapobj", - "ldapoptions", - "ldapsaveusertofile", - "ldapsyncwithusergroups", - "ldapuserbinarykey", - "ldapuseremail", - "ldapusergroups", - "ldapuserimage", - "ldapuserkey", - "ldapusername", - "ldapuserphonenumber", - "ldapuserrealname", - "ldapuserrequiredgroupmembership", - "ldapusers", - "leok", - "letsencrypt", - "lightgray", - "limiteddesktop", - "limitedevents", - "LIMITEVENTS", - "Linaro", - "linuxpath", - "listdevicegroups", - "listdevices", - "listdomains", - "listevents", - "listusergroups", - "listuserids", - "listusers", - "listusersessions", - "listusersofdevicegroup", - "loadconfigfromdb", - "localdiscovery", - "localfile", - "localpath", - "localrelay", - "localsessionrecording", - "localurl", - "lockagentdownload", - "locksettings", - "logfile", - "logincodeb", - "logindomain", - "loginfooter", - "loginkey", - "loginkeyfile", - "loginlogo", - "loginmode", - "loginpass", - "loginpicture", - "loginscreen", - "logintoken", - "logintokengen", - "logintokenkey", - "logintokens", - "loginuser", - "logoback", - "logoutcontrols", - "logouturl", - "macrouter", - "magenturl", - "mailserver", - "mailtokengen", - "maintenancemode", - "mainwelcome", - "MANAGECOMPUTERS", - "managedevices", - "manageusers", - "markcoredump", - "maxfidokeys", - "maxlen", - "maxuseraccounts", - "mcpath", - "mcrdesktop", - "mcrec", - "mcrfiles", - "mcrouter", - "Mebx", - "meshaction", - "meshadmin", - "meshagent", - "meshagents", - "meshauth", - "meshcentral", - "meshcentralhost", - "meshchange", - "meshcmd", - "meshcommander", - "meshcookie", - "meshcore", - "meshctrl", - "meshdesktopmultiplex", - "meshdevicefile", - "mesherrorlogpath", - "mesherrors", - "meshfilename", - "meshid", - "meshidhex", - "meshidname", - "meshinstall", - "meshmail", - "meshmessenger", - "meshmessengerid", - "meshmessengerpicture", - "meshmessengertitle", - "meshname", - "meshosxagent", - "meshquota", - "meshrelay", - "MESHRIGHT", - "meshrights", - "meshscanner", - "meshserver", - "meshsettings", - "meshsettingslines", - "meshtype", - "meshuser", - "Messagebox", - "messageid", - "Messenging", - "minfo", - "minifyall", - "minifycore", - "mongodbcol", - "mongodump", - "mongorestore", - "moutput", - "movetodevicegroup", - "mpkg", - "mpsaliasport", - "mpscert", - "mpsdebug", - "mpspass", - "mpsport", - "mpsserver", - "mpsservers", - "MPSSSL", - "mpstlsoffload", - "mqttbroker", - "MSCHA", - "msgid", - "mstsc", - "mstscrelay", - "mtype", - "multiplexor", - "multiresponse", - "multivalued", - "myaccountname", - "mycompany", - "mydomain", - "mypassword", - "myserver", - "myservername", - "nameexists", - "nedbtodb", - "netif", - "newaccountemaildomains", - "newaccountname", - "newaccountrealms", - "newaccounts", - "newaccountscaptcha", - "newaccountspass", - "newaccountsrights", - "newaccountsusergroups", - "newgroupname", - "newobj", - "newpass", - "newpassword", - "NGNIX", - "nightmode", - "noact", - "noagentupdate", - "noamt", - "noauth", - "noav", - "nodeconnect", - "nodecount", - "nodeid", - "nodeids", - "nodeidsplit", - "nodeinfo", - "nodekey", - "nodepath", - "NODESKTOP", - "nodewindows", - "nofiles", - "nofirewall", - "nolog", - "nologout", - "NOMESHCMD", - "nominify", - "nonalpha", - "NONEWDEVICES", - "nonewgroups", - "noproxy", - "noredirect", - "nosniff", - "noterminal", - "notools", - "nouser", - "nousers", - "novnc", - "npmjs", - "npmpath", - "npmproxy", - "npmtag", - "objid", - "ODELAY", - "offloader", - "offloaders", - "oidc", - "oldpassword", - "oldpasswordban", - "oldpasswords", - "oneclickrecovery", - "onlyselecteddevicegroups", - "onlyselectedusers", - "openidconnect", - "openstreetmap", - "openurl", - "orphanagentuser", - "osdesc", - "osinfo", - "otpdev", - "otpekey", - "otpemail", - "otphkeys", - "otpkeys", - "otplib", - "otppush", - "otpsecret", - "otpsms", - "parentpath", - "passchange", - "passhint", - "passlogin", - "passrequirementstr", - "passtype", - "passwordrequirements", - "passwordrequirementsstr", - "pastlogin", - "pathx", - "peinfo", - "phonenumber", - "PKCK", - "plivo", - "pluginadmin", - "plusplus", - "portbind", - "postflight", - "poweraction", - "powerevents", - "Preconfigured", - "Proto", - "publicid", - "pushlogin", - "pushrelay", - "pushrelayserver", - "qport", - "randompass", - "Raritan", - "rauth", - "rawdata", - "rcookie", - "rdpport", - "realname", - "recordencryptionrecode", - "recordpath", - "redir", - "rediraliasport", - "redirections", - "redirport", - "redirserver", - "refreshtoken", - "relayaliasport", - "relaydns", - "relayid", - "relayport", - "relayserver", - "relaysession", - "remembertoken", - "remoteaddr", - "remoteaddrport", - "REMOTECOMMAND", - "remotecontrol", - "remotefile", - "remotepath", - "REMOTEVIEWONLY", - "removeallusersfromusergroup", - "removedevicegroup", - "removedomain", - "removefromdomain", - "removefromusergroup", - "removemeshuser", - "removesubdomain", - "removetestagents", - "removeuser", - "removeuserfromdevice", - "removeuserfromdevicegroup", - "removeuserfromusergroup", - "removeusergroup", - "resetaccount", - "RESETOFF", - "resetpass", - "responseid", - "restoreserver", - "rightsstr", - "rname", - "rnamel", - "rootcert", - "rootredirect", - "rpassword", - "rpasswordhint", - "rport", - "rtpass", - "rtuser", - "runas", - "runasuser", - "runasuseronly", - "runcommand", - "runcommands", - "runmode", - "runonservererror", - "runonserverupdated", - "ruserid", - "sameorigin", - "selfupdate", - "selfurl", - "senderid", - "sendgrid", - "sendinviteemail", - "serialtunnel", - "SERVERBACKUP", - "serverfeatures", - "serverfiles", - "serverhttps", - "serverid", - "serveridhex", - "serverinfo", - "serverkey", - "servername", - "servernoproxy", - "serverpath", - "serverpic", - "serverport", - "SERVERRESTORE", - "servertlshash", - "serverupdate", - "servicename", - "servicepath", - "sessioncode", - "sessionkey", - "sessionrecording", - "sessionsamesite", - "sessiontime", - "setbad", - "SETNOTES", - "settodomain", - "sftpconnect", - "shareid", - "showagents", - "showall", - "showallmeshes", - "showevents", - "showiplocations", - "showitem", - "showmeshes", - "shownodes", - "showpasswordlogin", - "showpower", - "showsmbios", - "showusergroups", - "showusers", - "showversion", - "siteadmin", - "SITERIGHT", - "sitestyle", - "smsserver", - "specificupdate", - "splitip", - "splitpath", - "spliturl", - "srights", - "sshconnect", - "sshfilesrelay", - "sshport", - "sshrelay", - "sshterminalrelay", - "ssid", - "sspi", - "startack", - "statsevents", - "stricttransportsecurity", - "Strs", - "subdir", - "swarmallowedip", - "swarmport", - "swarmserver", - "sysinfo", - "syslogauth", - "syslogjson", - "syslogtcp", - "tcpport", - "telnyx", - "temail", - "tenantid", - "terminalnotify", - "terminalprompt", - "termsize", - "timedoc", - "titleid", - "titlepicture", - "tkip", - "tlscertcheck", - "tlshash", - "tlsock", - "tlsoffload", - "tlsoptions", - "tlsrootcert", - "tlsstrict", - "tmpdl", - "tokenemail", - "tokenlogin", - "tokenpassword", - "tokenpush", - "tokenrequired", - "tokensms", - "tokenurl", - "tokenuserid", - "tokenusername", - "totalsize", - "TOTP", - "tpass", - "tpassword", - "tpush", - "traefik", - "translateall", - "translationpath", - "trustedcert", - "trustedproxy", - "tsms", - "TTLS", - "tunnelws", - "tunnelwsstate", - "tuser", - "tuserid", - "tusername", - "twofactor", - "twofactorcookiedurationdays", - "twofactortimeout", - "tzoffset", - "uaparser", - "ucookie", - "ugroup", - "ugroups", - "ugrp", - "ugrpid", - "uicustomevent", - "unadmin", - "unknownuserrootredirect", - "unsealkey", - "updatefiles", - "uploadack", - "uploaderror", - "uploadfile", - "uploadfilebatch", - "uploadmeshcorefile", - "uploadstart", - "urlpath", - "urlswitching", - "useid", - "userallowedip", - "userblockedip", - "userbroadcast", - "userconsentflags", - "usercount", - "userex", - "userfiles", - "userfirst", - "usergroupchange", - "usergroups", - "userid", - "userids", - "userimage", - "userinfourl", - "usernameisemail", - "userquota", - "userrequiredhttpheader", - "Usersessionidletimeout", - "usersid", - "usersplit", - "vaultdeleteconfigfiles", - "vaultpullconfigfiles", - "vaultpushconfigfiles", - "verifyemail", - "Viewmode", - "viewonly", - "WAKEDEVICE", - "wakedevices", - "Walkthru", - "wanonly", - "Webauthn", - "webcerthash", - "webdefault", - "webemailspath", - "webider", - "webpublicpath", - "webpush", - "webrelay", - "webrelaydata", - "webrelayserver", - "webrequest", - "webrtc", - "webrtconfig", - "webserver", - "websockets", - "WEBSSL", - "webstate", - "webviewspath", - "WELCOMEMSG", - "welcomepicture", - "welcomepicturefullscreen", - "welcometext", - "wgetoptionshttp", - "wgetoptionshttps", - "wildleek", - "winassistant", - "winpath", - "winrouter", - "winservice", - "wsagents", - "wscompression", - "wsrelays", - "wssessioncount", - "wssessions", - "xarg", - "xbytes", - "xcmd", - "xdomain", - "xdomains", - "xenv", - "xevents", - "xfile", - "xfilelen", - "xfilepath", - "xflags", - "xforwardedhost", - "xinstall", - "xjslint", - "xmeshes", - "xpad", - "xpassword", - "xrelay", - "xrestart", - "xstate", - "xtls", - "xtransport", - "xuninstall", - "xuserid", - "xusername", - "xxdata", - "xxprocess", - "xxurl", - "xxuser", - "xxxprocess", - "Ylian", - "yubikey", - "yubikeyotp", - "zdata", - "zipfile" - ] -} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 85c3dcae..cf8faf5a 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2017-2025 Intel Corporation + Copyright 2017-2021 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/MeshCentralServer.njsproj b/MeshCentralServer.njsproj index f5b9d0de..0403d4b8 100644 --- a/MeshCentralServer.njsproj +++ b/MeshCentralServer.njsproj @@ -35,7 +35,6 @@ - @@ -101,7 +100,6 @@ - @@ -113,7 +111,6 @@ - @@ -239,8 +236,8 @@ - + @@ -440,6 +437,7 @@ + @@ -594,14 +592,12 @@ - - @@ -681,8 +677,6 @@ - - @@ -696,7 +690,6 @@ - @@ -713,12 +706,9 @@ - - - @@ -728,8 +718,6 @@ - - @@ -743,7 +731,6 @@ - @@ -760,12 +747,9 @@ - - - diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 57790a24..00000000 --- a/SECURITY.md +++ /dev/null @@ -1,49 +0,0 @@ -# Security Policy - -## Supported Versions - -Any version of MeshCentral 1.x.x is supported. - -| Version | Supported | -| ------- | ------------------ | -| 1.x.x | :white_check_mark: | -| < 1.0 | :x: | - -## Reporting a Vulnerability - -Please report any concerns or security issue to Ylian Saint-Hilaire (ylianst@gmail.com). If needed, use my PGP key below. - -``` ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.56 - -mQMuBF2gC4sRCAClFNvMCCVW3ego3UHBQ6LhSenJfaZYhvn8gaGuemSQxqTI6bla -BTAv3aMtQnvqlSuadMMegb+FO6hnaQMlGvpVA1qpkSzgrPS5HrBD3H33J2Nj3i93 -ZpDPpxdI0ehCj6IJPnl0GxGbpKIN8YpJUFl44wv1lMRFI1lgyb+dCoO60irYdNQB -PV85BI+DwPfOBFHunwR78nqMvpvsk9HaeHjEP7oXr952/7EazUowZsMlEfkYnw5S -+tLfpCoY3QWkektpJP40nMJSKQdV2NEuED99doA0X+7P1vsvFFFyMH69dnU2uSay -XCHpkAbntBy0BGmtF1RnTcOMv2V/LPXnlMdvAQCbmLQzNra3r163tcdRY0jSs+pZ -1L3w5tHNj2dzhfpa7wf/SIuds6QTr2LCN6miLoSVCRMMpT7d771b16GwQqWEXzN2 -+h7dYqrssHPOa8FSUrPerz0+0eFcbMSm5/L/4KXWXoQthURv8aMP9E0iVoUYaaKB -7U+5vFEZbpoOZyZmTAjXQMSNZCft0azA82Q+G85euyicWtMv48yNVzUhkdh+M2ud -ohkXX2Aor1TqpBJoIeWke7j9D+Bo+lu61zPRx5ed9teUeLJCwqNEjlE+6gre5kxF -PoreAtn59QYcBIpzQEWVMbNFlDAR4jMyqIoKCGfBPiRw2V+kunbzqiGQEglIFfOt -6sTN/+CJh0ei976VDmE0Z1kMN+CNLgIjIw8fl02V9QgAnHcpqtVUxR4dbGOhVDq5 -lWv+K75QQlWyXC2k+KboXcaCvH0WZEBACYzO0CfrZ5hP9BSkbj5usSUVGGHwEFAJ -t+/04KVY71fW281Ej5kGNaIKxeKsx6+hMo+UXb5ZM+6fANNNxs1cK95sTH6PjkyB -tsKxLoa3CV2v9mSE5JiKKt74R9nXVo7PXf6DizwAU2l30Lb6y6y0OdXdCCPAG8Ij -FrMgPu5MtjgsO5DnkZfUqDPWHhOgEPyOh3Ho+pvDhNYh5cm2eLQ8g5orzs2FHwbZ -DpAHwCdqrlcpBlKJ4W/MZdf1fg2PjqaTWm7ZFiGr91P0F6kltTLWbVKTjLdS0T+D -L7QnWWxpYW4gU2FpbnQtSGlsYWlyZSA8eWxpYW5zdEBnbWFpbC5jb20+iF4EExEI -AAYFAl2gC4sACgkQg7j/r4DH+kD/3gD+MRedlM53VzOtNOpS6mqDAxj1aWP90HN0 -AqO6zuCTyGgBAJlunLFKH8IUetmQOhiohB8HVhdm/q4lKRDV7sHdplDyuMwEXaAL -ixACAJSU/sCV87he4oZUKzg2/IGl3QoDSbTCOd04dE1IjPjjHbi8t9M7Qau55aM8 -ypFEsc7zMslL8Fc78EejrKmM3zsB/RU9XWFyrbQwRbaK6OHeEHC2E3AFaG0p09c6 -d0kZloHuWyEsm5a/3PpbIM1eP9IESJXWCc+bQQt6DxLKHLmkKMwB/icWMg8uMJlx -aady8TEq7LH5oFVKsglnwuN1nIkecrf77TVkEqTjIxS6TiOup6zOnioFNKLYBAH0 -WUnJEYFvx4OIXgQYEQgABgUCXaALiwAKCRCDuP+vgMf6QGFTAQCUj2gGwsFlN0eR -Wowv4eLcc3FwQ+lBElUctKg8vNFb0gD/ZWVWsWwKerNgNnf7RGD9mt8G2CKvdgGG -oZ2hPP2gU9w= -=roW4 ------END PGP PUBLIC KEY BLOCK----- -``` diff --git a/agents/MeshAgentOSXPackager.zip b/agents/MeshAgentOSXPackager.zip index 4248a4eb..c4936a66 100644 Binary files a/agents/MeshAgentOSXPackager.zip and b/agents/MeshAgentOSXPackager.zip differ diff --git a/agents/MeshCentralRouter.exe b/agents/MeshCentralRouter.exe index 828675dc..ef3cda87 100644 Binary files a/agents/MeshCentralRouter.exe and b/agents/MeshCentralRouter.exe differ diff --git a/agents/MeshCmd.exe b/agents/MeshCmd-signed.exe similarity index 54% rename from agents/MeshCmd.exe rename to agents/MeshCmd-signed.exe index 00b704aa..ad23a7c2 100644 Binary files a/agents/MeshCmd.exe and b/agents/MeshCmd-signed.exe differ diff --git a/agents/MeshCmd64.exe b/agents/MeshCmd64-signed.exe similarity index 54% rename from agents/MeshCmd64.exe rename to agents/MeshCmd64-signed.exe index e4af314f..f1c1d3eb 100644 Binary files a/agents/MeshCmd64.exe and b/agents/MeshCmd64-signed.exe differ diff --git a/agents/MeshCmdARM64.exe b/agents/MeshCmdARM64.exe deleted file mode 100644 index 83f1079a..00000000 Binary files a/agents/MeshCmdARM64.exe and /dev/null differ diff --git a/agents/MeshService.exe b/agents/MeshService.exe index e3aec7ab..653088e3 100644 Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ diff --git a/agents/MeshService64.exe b/agents/MeshService64.exe index 540fed64..8abfde38 100644 Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ diff --git a/agents/MeshServiceARM64.exe b/agents/MeshServiceARM64.exe deleted file mode 100644 index ee191f79..00000000 Binary files a/agents/MeshServiceARM64.exe and /dev/null differ diff --git a/agents/agent-translations.json b/agents/agent-translations.json index 554c68e5..0394e050 100644 --- a/agents/agent-translations.json +++ b/agents/agent-translations.json @@ -34,10 +34,10 @@ "agent": "Agent", "group": "Skupina zařízení", "url": "URL serveru", - "meshName": "Skupinové jméno", + "meshName": "Název oka", "meshId": "Identifikátor skupiny", "serverId": "Identifikátor serveru", - "setup": "Nastavit", + "setup": "Založit", "update": "Aktualizace", "install": "Instalace", "uninstall": "Odinstalace", @@ -52,7 +52,7 @@ "zenity": "Zkuste nainstalovat / aktualizovat Zenity a spustit znovu", "status": [ "NENÍ INSTALOVÁN", - "SPUŠTĚNO", + "BĚH", "NEFUNGUJE" ], "statusDescription": "Aktuální stav agenta", @@ -65,11 +65,11 @@ "agent": "Agent", "group": "Gerätegruppe", "url": "Server-URL", - "meshName": "Gruppenname", + "meshName": "MESH Name", "meshId": "Gruppen-ID", "serverId": "Server-ID", "setup": "Konfiguration", - "update": "Aktualisierung", + "update": "Updates", "install": "Installieren", "uninstall": "Deinstallation", "connect": "Verbinden", @@ -86,7 +86,7 @@ "GESTARTET", "NICHT GESTARTET" ], - "statusDescription": "Aktueller Agentstatus", + "statusDescription": "Aktueller Agentenstatus", "agentVersion": "Neue Version", "elevation": "Zum Installieren/Deinstallieren dieser Software sind erhöhte Berechtigungen erforderlich.", "graphicalerror": "Die grafische Version dieses Installationsprogramms kann auf diesem System nicht ausgeführt werden", @@ -98,7 +98,7 @@ "agent": "Agente", "group": "Grupo de Dispositivos", "url": "URL del servidor", - "meshName": "Nombre del grupo", + "meshName": "Nombre de malla", "meshId": "Identificador del Grupo", "serverId": "Identificador de Servidor", "setup": "Preparar", @@ -129,7 +129,7 @@ "agent": "Agentti", "group": "Laiteryhmä", "url": "Palvelimen URL-osoite", - "meshName": "Ryhmän nimi", + "meshName": "Verkon nimi", "meshId": "Ryhmän tunniste", "serverId": "Palvelimen tunniste", "setup": "Perustaa", @@ -191,7 +191,7 @@ "agent": "एजेंट", "group": "डिवाइस समूह", "url": "सर्वर URL", - "meshName": "समूह नाम", + "meshName": "मेष नाम", "meshId": "समूह पहचानकर्ता", "serverId": "सर्वर पहचानकर्ता", "setup": "सेट अप", @@ -222,7 +222,7 @@ "agent": "Agente", "group": "Gruppo di dispositivi", "url": "URL del server", - "meshName": "Nome del gruppo", + "meshName": "Nome mesh", "meshId": "Identificatore di gruppo", "serverId": "Identificatore del server", "setup": "Impostare", @@ -253,7 +253,7 @@ "agent": "エージェント", "group": "デバイスグループ", "url": "サーバーのURL", - "meshName": "그룹 이름", + "meshName": "メッシュ名", "meshId": "グループ識別子", "serverId": "サーバー識別子", "setup": "セットアップ", @@ -284,7 +284,7 @@ "agent": "에이전트", "group": "장치 그룹", "url": "서버의 위치", - "meshName": "그룹 이름", + "meshName": "메시의 이름", "meshId": "그룹 식별자", "serverId": "서버의 식별자", "setup": "설정하다", @@ -305,11 +305,7 @@ "운영", "중지됨" ], - "statusDescription": "에이전트 상태", - "agentVersion": "새로운 버전", - "elevation": "이 소프트웨어를 설치/제거하려면 높은 권한이 필요합니다.", - "graphicalerror": "이 설치 프로그램의 그래픽 버전은 이 시스템에서 실행할 수 없습니다.", - "description": "이 원격 관리 소프트웨어를 설치하거나 제거하려면 아래 버튼을 클릭하십시오. 이 소프트웨어를 설치하면 백그라운드에서 실행되어 원격 관리자가 이 컴퓨터를 관리하고 제어할 수 있습니다." + "statusDescription": "에이전트 상태" }, "nl": { "agent": "Agent", @@ -346,7 +342,7 @@ "agent": "Agente", "group": "Grupo de dispositivos", "url": "URL do servidor", - "meshName": "Nome do grupo", + "meshName": "Nome da malha", "meshId": "Identificador de Grupo", "serverId": "Identificador de Servidor", "setup": "Configuração", @@ -367,11 +363,7 @@ "CORRIDA", "NÃO CORRENDO" ], - "statusDescription": "Status atual do agente", - "agentVersion": "Nova versão", - "elevation": "Permissões elevadas são necessárias para instalar/desinstalar este software.", - "graphicalerror": "A versão gráfica deste instalador não pode ser executada neste sistema", - "description": "Clique nos botões abaixo para instalar ou desinstalar este software de gerenciamento remoto. Quando instalado, este software é executado em segundo plano, permitindo que este computador seja gerenciado e controlado por um administrador remoto." + "statusDescription": "Status atual do agente" }, "ru": { "agent": "Агент", @@ -408,7 +400,7 @@ "agent": "Agent", "group": "Enhetsgrupp", "url": "Serverns URL", - "meshName": "Grupp namn", + "meshName": "Masknamn", "meshId": "Gruppidentifierare", "serverId": "Serveridentifierare", "setup": "Uppstart", @@ -429,17 +421,13 @@ "LÖPNING", "SPRINGER INTE" ], - "statusDescription": "Aktuell agentstatus", - "agentVersion": "Ny version", - "elevation": "Förhöjda behörigheter krävs för att installera/avinstallera denna programvara.", - "graphicalerror": "Den grafiska versionen av detta installationsprogram kan inte köras på det här systemet", - "description": "Klicka på knapparna nedan för att installera eller avinstallera denna fjärrhanteringsprogramvara. När den är installerad körs den här programvaran i bakgrunden så att den här datorn kan hanteras och kontrolleras av en fjärradministratör." + "statusDescription": "Aktuell agentstatus" }, "tr": { "agent": "Agent", "group": "Cihaz Grubu", "url": "Sunucu URL'si", - "meshName": "Grup ismi", + "meshName": "Mesh Adı", "meshId": "Grup Tanımlayıcı", "serverId": "Sunucu Tanımlayıcı", "setup": "Kurmak", @@ -470,11 +458,11 @@ "agent": "代理", "group": "设备组", "url": "服务器网址", - "meshName": "团队名字", + "meshName": "网格名称", "meshId": "组标识符", "serverId": "服务器标识符", "setup": "设定", - "update": "更新", + "update": "更新资料", "install": "安装", "uninstall": "卸载", "connect": "连接", @@ -491,17 +479,13 @@ "正在运行", "不在运行" ], - "statusDescription": "当前代理状态", - "agentVersion": "新版本", - "elevation": "安装/卸载此软件需要提升权限。", - "graphicalerror": "此安装程序的图形版本无法在此系统上运行", - "description": "单击下面的按钮以安装或卸载此远程管理软件。安装后,该软件在后台运行,允许远程管理员管理和控制该计算机。" + "statusDescription": "当前代理状态" }, "zh-cht": { "agent": "代理", "group": "裝置群", "url": "服務器網址", - "meshName": "團隊名字", + "meshName": "網格名稱", "meshId": "群標識符", "serverId": "服務器標識符", "setup": "設定", @@ -522,17 +506,13 @@ "正在運行", "不在運行" ], - "statusDescription": "當前代理狀態", - "agentVersion": "新版本", - "elevation": "安裝/卸載此軟件需要提升權限。", - "graphicalerror": "此安裝程序的圖形版本無法在此系統上運行", - "description": "單擊下面的按鈕以安裝或卸載此遠程管理軟件。安裝後,該軟件在後台運行,允許遠程管理員管理和控制該計算機。" + "statusDescription": "當前代理狀態" }, "da": { "agent": "Agent", "group": "Enhedsgruppe", "url": "Server URL", - "meshName": "Gruppe navn", + "meshName": "Mesh Navn", "meshId": "Gruppe-id", "serverId": "Serveridentifikator", "setup": "Opsætning", @@ -620,129 +600,5 @@ "elevation": "Permissões Elevadas são necessárias para instalar/desinstalar este software", "graphicalerror": "A versão gráfica do instalador não pode ser executada neste sistema", "description": "Clique nos botões abaixo para instalar ou desinstalar este software de gerenciamento remoto. Quando instalado, este software é executado em segundo plano permitindo que este computador seja gerenciado e controlado por um administrador remoto" - }, - "bs": { - "agent": "Agent", - "agentVersion": "Nova verzija", - "group": "Grupa uređaja", - "url": "URL servera", - "meshName": "Ime grupe", - "meshId": "Grupni identifikator", - "serverId": "Identifikator servera", - "setup": "Postaviti", - "update": "Ažuriraj", - "install": "Instaliraj", - "uninstall": "Deinstalirati", - "connect": "Povežite se", - "disconnect": "Prekini vezu", - "cancel": "Otkaži", - "close": "Zatvori", - "pressok": "Pritisnite OK da prekinete vezu", - "elevation": "Za instaliranje/deinstaliranje ovog softvera potrebne su povišene dozvole.", - "sudo": "Molimo pokušajte ponovo sa sudo.", - "ctrlc": "Pritisnite Ctrl-C za izlaz.", - "commands": "Možete pokrenuti tekstualnu verziju iz komandne linije sa sljedećim naredbama", - "graphicalerror": "Grafička verzija ovog instalatera ne može da radi na ovom sistemu", - "zenity": "Pokušajte instalirati/ažurirati Zenity i pokrenite ponovo", - "status": [ - "NIJE INSTALIRANO", - "RUNNING", - "NOT RUNNING" - ], - "statusDescription": "Trenutni status agenta", - "description": "Kliknite na dugmad ispod da instalirate ili deinstalirate ovaj softver za daljinsko upravljanje. Kada je instaliran, ovaj softver radi u pozadini, što omogućava da ovim računarom upravlja i kontroliše udaljeni administrator." - }, - "hu": { - "agent": "Agent", - "agentVersion": "Új verzió", - "group": "Eszköz csoport", - "url": "Kiszolgáló URL", - "meshName": "Csoport név", - "meshId": "Csoport azonosító", - "serverId": "Kiszolgáló azonosító", - "setup": "Beállítás", - "update": "Frissítés", - "install": "Telepítés", - "uninstall": "Eltávolítás", - "connect": "Kapcsolódás", - "disconnect": "Lekapcsolódás", - "cancel": "Mégse", - "close": "Bezár", - "pressok": "Press OK to disconnect", - "elevation": "A szoftver telepítéséhez/eltávolításához megnövelt jogosultságok szükségesek.", - "sudo": "Kérjük, próbálja meg újra a sudo használatával.", - "ctrlc": "A kilépéshez nyomja meg a Ctrl-C billentyűt.", - "commands": "A szöveges változatot a parancssorból futtathatja a következő parancs(okk)al", - "graphicalerror": "A telepítő grafikus verziója nem futtatható ezen a rendszeren.", - "zenity": "Próbálja meg telepíteni/frissíteni a Zenity-t, és indítsa újra", - "status": [ - "NINCS TELEPÍTVE", - "FUT", - "NEM FUT" - ], - "statusDescription": "Jelenlegi agent állapota", - "description": "Kattintson a Telepítés vagy Eltávolítás gombokra a Távfelügyeleti alkalmazás telepítéséhez vagy eltávolításához. Telepítés után ez az alkalmazás a háttérben fut, lehetővé téve, hogy a számítógépet egy távoli rendszergazda kezelje." - }, - "ca": { - "agent": "Agent", - "agentVersion": "Nova versió", - "group": "Grup de dispositius", - "url": "URL del servidor", - "meshName": "Nom del grup", - "meshId": "Identificador de grup", - "serverId": "Identificador del servidor", - "setup": "Configuració", - "update": "Actualització", - "install": "Instal·lar", - "uninstall": "Desinstal·la", - "connect": "Connecta't", - "disconnect": "Desconnecta", - "cancel": "Cancel · lar", - "close": "Tanca", - "pressok": "Premeu D'acord per desconnectar", - "elevation": "Es necessiten permisos elevats per instal·lar/desinstal·lar aquest programari.", - "sudo": "Si us plau, torna-ho a provar amb sudo.", - "ctrlc": "Premeu Ctrl-C per sortir.", - "commands": "Podeu executar la versió de text des de la línia d'ordres amb les següents ordres", - "graphicalerror": "La versió gràfica d'aquest instal·lador no pot executar-se en aquest sistema", - "zenity": "Proveu d'instal·lar/actualitzar Zenity i torneu a executar-lo", - "status": [ - "NO ESTÀ INSTAL · LAT", - "CÓRRER", - "NO CORRE" - ], - "statusDescription": "Estat actual de l'agent", - "description": "Feu clic als botons següents per instal·lar o desinstal·lar aquest programari de gestió remota. Quan s'instal·la, aquest programari s'executa en segon pla i permet que aquest ordinador sigui gestionat i controlat per un administrador remot." - }, - "uk": { - "agent": "Агент", - "agentVersion": "Нова Версія", - "group": "Група Пристроїв", - "url": "URL Сервера", - "meshName": "Ім'я Групи", - "meshId": "Ідентифікатор групи", - "serverId": "Ідентифікатор серверу", - "setup": "Налаштувати", - "update": "Оновлення", - "install": "Інсталювати", - "uninstall": "Видалити", - "connect": "Підключитися", - "disconnect": "Відключити", - "cancel": "Скасувати", - "close": "Закрити", - "pressok": "Натисніть OK, щоб від'єднатися", - "elevation": "Для інсталяції/деінсталяції цього програмного забезпечення потрібні підвищені дозволи.", - "sudo": "Будь ласка, спробуйте ще раз за допомогою sudo.", - "ctrlc": "Натисніть Ctrl-C, щоб вийти", - "commands": "Ви можете запустити текстову версію з командного рядка за допомогою таких команд", - "graphicalerror": "Графічна версія цього інсталятора не може працювати в цій системі", - "zenity": "Спробуйте встановити/оновити Zenity та запустіть наново", - "status": [ - "НЕ ВСТАНОВЛЕНО", - "ВИКОНУЄТЬСЯ", - "НЕ ПРАЦЮЄ" - ], - "statusDescription": "Поточний Статус Агента", - "description": "Клікнути кнопки нижче, щоб інсталювати або видалити це програмне забезпечення для віддаленого керування. Після інсталювання ця програма працює у фоновому режимі, що дозволяє віддаленому адміністратору керувати цим комп'ютером." } } \ No newline at end of file diff --git a/agents/compressModules.bat b/agents/compressModules.bat index 610439b3..dd9d8444 100644 --- a/agents/compressModules.bat +++ b/agents/compressModules.bat @@ -1,9 +1,20 @@ @ECHO OFF MD modules_meshcmd_min MD modules_meshcore_min - +"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" compressalljs "modules_meshcore" "modules_meshcore_min" +"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" compressalljs "modules_meshcmd" "modules_meshcmd_min" "..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcore.js "..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcmd.js -%LOCALAPPDATA%\..\Roaming\nvm\v14.16.0\node ..\translate\translate.js minifydir C:\Users\Default.DESKTOP-9CGK2DI\Desktop\AmtWebApp\meshcentral\agents\modules_meshcore C:\Users\Default.DESKTOP-9CGK2DI\Desktop\AmtWebApp\meshcentral\agents\modules_meshcore_min -%LOCALAPPDATA%\..\Roaming\nvm\v14.16.0\node ..\translate\translate.js minifydir C:\Users\Default.DESKTOP-9CGK2DI\Desktop\AmtWebApp\meshcentral\agents\modules_meshcmd C:\Users\Default.DESKTOP-9CGK2DI\Desktop\AmtWebApp\meshcentral\agents\modules_meshcmd_min +REM del meshcore.min.js +REM %LOCALAPPDATA%\..\Roaming\nvm\v14.16.0\node ..\translate\translate.js minify meshcore.js +REM rename meshcore.js.min meshcore.min.js + +REM del meshcmd.min.js +REM %LOCALAPPDATA%\..\Roaming\nvm\v14.16.0\node ..\translate\translate.js minify meshcmd.js +REM rename meshcmd.js.min meshcmd.min.js + +REM Minify the translations +%LOCALAPPDATA%\..\Roaming\nvm\v14.16.0\node ..\translate\translate.js minify modules_meshcore\coretranslations.json +COPY modules_meshcore\coretranslations.json.min modules_meshcore_min\coretranslations.json +DEL modules_meshcore\coretranslations.json.min \ No newline at end of file diff --git a/agents/hashagents.bat b/agents/hashagents.bat index f8ca9582..fd893be0 100644 --- a/agents/hashagents.bat +++ b/agents/hashagents.bat @@ -1 +1 @@ -MeshService.exe hashagents.js > hashagents.json \ No newline at end of file +MeshService-signed.exe hashagents.js > hashagents.json \ No newline at end of file diff --git a/agents/hashagents.js b/agents/hashagents.js index 52c0ee30..b5a5391b 100644 --- a/agents/hashagents.js +++ b/agents/hashagents.js @@ -1,8 +1,8 @@ var fs = require('fs'); var agents = { - 'MeshService.exe': 3, - 'MeshService64.exe': 4, + 'MeshService-signed.exe': 3, + 'MeshService64-signed.exe': 4, 'meshagent_x86': 5, 'meshagent_x86-64': 6, 'meshagent_arm': 9, diff --git a/agents/hashagents.json b/agents/hashagents.json index 05315e66..e69de29b 100644 --- a/agents/hashagents.json +++ b/agents/hashagents.json @@ -1,134 +0,0 @@ -{ - "3": { - "filename": "MeshService.exe", - "hash": "33AE44E73CA79EDD443661F8D6205DF59DE7D03B0AC730A37D283C9CE4079E6136FFC30BC1B79DA8FB05F03CBDE75D06", - "size": 3793408, - "mtime": "2022-08-25T17:55:54Z" - }, - "4": { - "filename": "MeshService64.exe", - "hash": "C809BAB1F0B988F1436E1033D9F07A782412A6CC7ECCF4AC52CCCBD91D7B56D401F2AB5FABC71A66F91B20E6FCA393D4", - "size": 3422720, - "mtime": "2022-08-25T17:55:24Z" - }, - "5": { - "filename": "meshagent_x86", - "hash": "024A8FCE66C277CFAA375B6F5A12E18D08BF2F8EE494C4408544D93F219F7208BACF056F79A2340428C3C34F765E325E", - "size": 3666464, - "mtime": "2022-08-29T17:48:58Z" - }, - "6": { - "filename": "meshagent_x86-64", - "hash": "DC5924847AD22C058D1009BE7EDFAFEAF248DEC706C263736B254BA5917D274A21BAE0D025852EC788007EF3688CDC64", - "size": 3741136, - "mtime": "2022-08-29T17:49:06Z" - }, - "7": { - "filename": "meshagent_mips", - "hash": "C49212CA4BF2D1F031F376C0157A4B9C5EA5ACD08180662F27F2EA54F990C2A7840B5A3BF7F66D85EE194EF675008D09", - "size": 4547696, - "mtime": "2022-08-29T17:49:13Z" - }, - "9": { - "filename": "meshagent_arm", - "hash": "5217EBF6638EDC64FFFBE3B53BF9DC640D630CC69B9CE484C1CA274530C248D248AC4F4E84071A34CD504039D8D0B022", - "size": 3148064, - "mtime": "2022-08-29T17:49:22Z" - }, - "13": { - "filename": "meshagent_pogo", - "hash": "1523191069F30678C607E32F557CD5F9125A963C671CE7A7F6FB8ADD9B9BFB890AC1A6248872EAE899737F378F54FFF2", - "size": 3156744, - "mtime": "2022-08-29T17:49:32Z" - }, - "15": { - "filename": "meshagent_poky", - "hash": "36090B49C98D7A3E7515EC2D22E5C47A4FD9BA35B517949BAF04B39A7CE91378656A7F3FC132C5E43FD1D087B3C9226E", - "size": 3796600, - "mtime": "2022-08-29T17:49:42Z" - }, - "16": { - "filename": "meshagent_osx-x86-64", - "hash": "F7A3EBEC3D855EBFB2C72271C17196C7692EB2685DCBA70B56B63C80D6CF0DAA7DF00657BB4A12F4C0D92281B1BB47FE", - "size": 4670736, - "mtime": "2022-08-23T03:31:00Z" - }, - "18": { - "filename": "meshagent_poky64", - "hash": "FD61B913D2239621FDCC2E949BF16FCAE3F9D46D25EEF74DA0A7971F30A44E315A4231AF824241940391A3F112794A27", - "size": 3495416, - "mtime": "2022-08-29T17:49:52Z" - }, - "19": { - "filename": "meshagent_x86_nokvm", - "hash": "BF125A52656DFE6665E78AB22ED652F4C65C17624A12BCAC2F0691A255AF208C3E883101266F3E80052F4CFE8602B29B", - "size": 3385732, - "mtime": "2022-08-29T17:50:00Z" - }, - "20": { - "filename": "meshagent_x86-64_nokvm", - "hash": "9AB50A5419A2BAFC8DC485C3F24387622689FE3A0C146317CE3EA951F3EE2E4902CCE3878F2098C6EB23A848E510E478", - "size": 3446192, - "mtime": "2022-08-29T17:50:08Z" - }, - "24": { - "filename": "meshagent_arm-linaro", - "hash": "DCC5B487A200F9670B33BE603F52088856FB249CC03F5B62D1617CA9A95B55329B120FE4D3FFD72B2E5FE1ADE302CF81", - "size": 2211156, - "mtime": "2022-08-29T17:50:21Z" - }, - "25": { - "filename": "meshagent_armhf", - "hash": "1EDCE4E132927B432F60A3D262368B3DF54B012EDD786EAD31139646B5D9168297C32D13C7D822CE5FEF7FE44B65B4A0", - "size": 3181452, - "mtime": "2022-08-23T03:14:16Z" - }, - "27": { - "filename": "meshagent_armhf2", - "hash": "0AE840520D3B677B9767EA097F3AA5A1E24212529E688200F43935DB1541AB9FB441EC2C7BA8002D45299B04695FD037", - "size": 2837724, - "mtime": "1985-10-26T08:15:00Z" - }, - "28": { - "filename": "meshagent_mips24kc", - "hash": "88A79B78497D1D004E44D02989A3BE3710D3BEE0A129F98579FFAA826FAC6C90CD69B9B218B90377438942BA85DAC81C", - "size": 4181416, - "mtime": "2022-08-23T03:15:24Z" - }, - "29": { - "filename": "meshagent_osx-arm-64", - "hash": "CFE022146F2ED61E68F907E57E3704CC7F409D7F2B4D87E64ED6D83C53F41777BCDDCCF42DF8B8BB25CCEC9A93D799C7", - "size": 3945576, - "mtime": "2022-08-23T03:31:00Z" - }, - "30": { - "filename": "meshagent_freebsd_x86-64", - "hash": "5C2CDDA2E7AB5068D990FBC725D8D5E3EA2724A0E001C226C0C7BB9F3A46492880BF260B5DD9E733F87EB68BA7494BD6", - "size": 4673560, - "mtime": "2022-08-23T03:31:12Z" - }, - "32": { - "filename": "meshagent_aarch64", - "hash": "21C97445FA93C2A42337AD0E336F840A05EC553F8C040F6021C16339567F8A063EB06876D62C2C2924BD9F656434E9DB", - "size": 3248496, - "mtime": "2022-08-23T03:13:02Z" - }, - "40": { - "filename": "meshagent_mipsel24kc", - "hash": "A58CF777ACA3E9B3F7C0FC664E5EAC1F95C3FD03ABDE93E2B06547D0BA1C671A9E67F252CACD9BCBD2019561E18ED7DF", - "size": 4177288, - "mtime": "2022-08-23T03:16:32Z" - }, - "41": { - "filename": "meshagent_aarch64-cortex-a53", - "hash": "CC84858AD16C644096B87E3686B318F82CD1A39015FF17D93456456F0A51D4A2D4DEC7F6EAA2ABB065D7EAD28CD024A2", - "size": 3076424, - "mtime": "2022-08-23T03:17:42Z" - }, - "10005": { - "filename": "meshagent_osx-universal-64", - "hash": "D320CA61D59FD8D76CF681CFE78A94CE37C47DBCAA8B29DF483F42C000EA9B655B5E5909A2AD6699D45D2D7691FF4964", - "size": 8647784, - "mtime": "2022-08-23T03:31:00Z" - } -} diff --git a/agents/meshagent_aarch64 b/agents/meshagent_aarch64 index f1e94db6..e6c617ba 100644 Binary files a/agents/meshagent_aarch64 and b/agents/meshagent_aarch64 differ diff --git a/agents/meshagent_aarch64-cortex-a53 b/agents/meshagent_aarch64-cortex-a53 index 11cbfdbc..5d1ef9b0 100644 Binary files a/agents/meshagent_aarch64-cortex-a53 and b/agents/meshagent_aarch64-cortex-a53 differ diff --git a/agents/meshagent_android.apk b/agents/meshagent_android.apk deleted file mode 100644 index 0b525a3b..00000000 Binary files a/agents/meshagent_android.apk and /dev/null differ diff --git a/agents/meshagent_arm b/agents/meshagent_arm index 7c857e5f..c1a31f02 100644 Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ diff --git a/agents/meshagent_arm-linaro b/agents/meshagent_arm-linaro index 61f20631..e6bb3b0b 100644 Binary files a/agents/meshagent_arm-linaro and b/agents/meshagent_arm-linaro differ diff --git a/agents/meshagent_armhf b/agents/meshagent_armhf index 3a4f42dc..3ebced1c 100644 Binary files a/agents/meshagent_armhf and b/agents/meshagent_armhf differ diff --git a/agents/meshagent_freebsd_x86-64 b/agents/meshagent_freebsd_x86-64 index 4a42ee3c..88fda982 100644 Binary files a/agents/meshagent_freebsd_x86-64 and b/agents/meshagent_freebsd_x86-64 differ diff --git a/agents/meshagent_linux-armada370-hf b/agents/meshagent_linux-armada370-hf index aaac5625..746f7c6c 100644 Binary files a/agents/meshagent_linux-armada370-hf and b/agents/meshagent_linux-armada370-hf differ diff --git a/agents/meshagent_mips b/agents/meshagent_mips index 4230b2e2..4192f01b 100644 Binary files a/agents/meshagent_mips and b/agents/meshagent_mips differ diff --git a/agents/meshagent_mips24kc b/agents/meshagent_mips24kc index 91198cbe..953a085c 100644 Binary files a/agents/meshagent_mips24kc and b/agents/meshagent_mips24kc differ diff --git a/agents/meshagent_mipsel24kc b/agents/meshagent_mipsel24kc index d759f438..43e953d6 100644 Binary files a/agents/meshagent_mipsel24kc and b/agents/meshagent_mipsel24kc differ diff --git a/agents/meshagent_openbsd_x86-64 b/agents/meshagent_openbsd_x86-64 index 257dcb18..95ff0b40 100644 Binary files a/agents/meshagent_openbsd_x86-64 and b/agents/meshagent_openbsd_x86-64 differ diff --git a/agents/meshagent_openwrt_x86_64 b/agents/meshagent_openwrt_x86_64 index c81a13ed..23b44c45 100644 Binary files a/agents/meshagent_openwrt_x86_64 and b/agents/meshagent_openwrt_x86_64 differ diff --git a/agents/meshagent_osx-arm-64 b/agents/meshagent_osx-arm-64 index ff59636f..ff5797c5 100644 Binary files a/agents/meshagent_osx-arm-64 and b/agents/meshagent_osx-arm-64 differ diff --git a/agents/meshagent_osx-universal-64 b/agents/meshagent_osx-universal-64 index e345004f..7c323e3c 100644 Binary files a/agents/meshagent_osx-universal-64 and b/agents/meshagent_osx-universal-64 differ diff --git a/agents/meshagent_osx-x86-64 b/agents/meshagent_osx-x86-64 index 60006809..8c6b03da 100644 Binary files a/agents/meshagent_osx-x86-64 and b/agents/meshagent_osx-x86-64 differ diff --git a/agents/meshagent_pogo b/agents/meshagent_pogo index 9ffbbff2..3f2b53b9 100644 Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ diff --git a/agents/meshagent_poky b/agents/meshagent_poky index ecbb530e..caf98185 100644 Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ diff --git a/agents/meshagent_poky64 b/agents/meshagent_poky64 index 0b260438..b51f6834 100644 Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ diff --git a/agents/meshagent_x86 b/agents/meshagent_x86 index 33b5d9db..3a1e3925 100644 Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ diff --git a/agents/meshagent_x86-64 b/agents/meshagent_x86-64 index 0c3e00de..35ea2972 100644 Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ diff --git a/agents/meshagent_x86-64_nokvm b/agents/meshagent_x86-64_nokvm index 3f865a61..4b3ac69e 100644 Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ diff --git a/agents/meshagent_x86_nokvm b/agents/meshagent_x86_nokvm index 6d924a05..9916d2d3 100644 Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ diff --git a/agents/meshcmd.js b/agents/meshcmd.js index 1142c31a..5628303b 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -25,6 +25,7 @@ limitations under the License. //console.displayStreamPipeMessages = 1; // Display stream pipe and un-pipes //var __gc = setInterval(function () { console.log('GC'); _debugGC() }, 2000); // + var fs = require('fs'); var os = require('os'); var net = require('net'); @@ -128,7 +129,6 @@ function run(argv) { if ((typeof args.id) == 'string') { settings.id = args.id; } if ((typeof args.username) == 'string') { settings.username = args.username; } if ((typeof args.password) == 'string') { settings.password = args.password; } - if ((typeof args.passwordhex) == 'string') { settings.password = Buffer.from(args.passwordhex, 'hex').toString(); } if ((typeof args.url) == 'string') { settings.url = args.url; } if ((typeof args.type) == 'string') { settings.type = args.type; } if ((typeof args.user) == 'string') { settings.username = args.user; } @@ -172,12 +172,6 @@ function run(argv) { if ((argv.length > 1) && (actions.indexOf(argv[1].toUpperCase()) >= 0)) { settings.action = argv[1]; } if (globalDebugFlags != 0) { console.setInfoLevel(1); } - if (settings.debuglevel > 1) { - if (settings.hostname) { console.log('Hostname HEX: ' + Buffer.from(settings.hostname, 'binary').toString('hex')); } - if (settings.username) { console.log('Username HEX: ' + Buffer.from(settings.username, 'binary').toString('hex')); } - if (settings.password) { console.log('Password HEX: ' + Buffer.from(settings.password, 'binary').toString('hex')); } - } - // Validate meshaction.txt if (settings.action == null) { console.log('MeshCentral Command (MeshCmd) ' + meshCmdVersion); @@ -212,7 +206,6 @@ function run(argv) { console.log(' AmtWake - Intel AMT Wake Alarms.'); console.log(' AmtRPE - Intel AMT Remote Platform Erase.'); console.log(' AmtDDNS - Intel AMT DDNS settings.'); - if (console.canonical != null) { console.log(' AmtTerm - Intel AMT Serial-over-LAN terminal.'); } console.log('\r\nHelp on a specific action using:\r\n'); console.log(' meshcmd help [action]'); exit(0); return; @@ -386,13 +379,15 @@ function run(argv) { console.log('\r\Required arguments:\r\n'); console.log(' --scan [ip range] The IP address range to perform the scan on.'); } else if (action == 'amtwifi') { - console.log('AmtWifi is used to list, add or delete Intel AMT Wifi configuration. Example usage:\r\n\r\n meshcmd amtwifi --host 1.2.3.4 --user admin --pass mypassword --list'); + console.log('AmtWifi is used to get/set Intel AMT Wifi configuration. Example usage:\r\n\r\n meshcmd amtwifi --host 1.2.3.4 --user admin --pass mypassword --list'); console.log('\r\nRequired arguments:\r\n'); console.log(' --host [hostname] The IP address or DNS name of Intel AMT, 127.0.0.1 is default.'); console.log(' --pass [password] The Intel AMT login password.'); + console.log(' --[action] Action options are list, add, del.'); console.log('\r\nOptional arguments:\r\n'); console.log(' --user [username] The Intel AMT login username, admin is default.'); console.log(' --tls Specifies that TLS must be used.'); + console.log(' --list List Wifi profiles'); console.log(' --add Add new Wifi profile'); console.log(' --name New Wifi profile name'); console.log(' --priority Priority of this profile - default 0'); @@ -441,13 +436,6 @@ function run(argv) { console.log(' --set [disabled/dhcp/enabled] Set the dynamic DNS mode.'); console.log(' --interval [minutes] Set update interval in minutes, default is 1440, minimum is 20.'); console.log(' --ttl [seconds] Set time to live, default is 900.'); - } else if ((action == 'amtterm') && (console.canonical != null)) { - console.log('AmtTerm is used to connect to the Serial-over-LAN port. Example usage:\r\n\r\n meshcmd amtterm --host 1.2.3.4 --user admin --pass mypassword'); - console.log('\r\nRequired arguments:\r\n'); - console.log(' --host [hostname] The IP address or DNS name of Intel AMT, 127.0.0.1 is default.'); - console.log(' --pass [password] The Intel AMT login password.'); - console.log('\r\nOptional arguments:\r\n'); - console.log(' --tls Specifies that TLS must be used.'); } else { actions.shift(); console.log('Invalid action, usage:\r\n\r\n meshcmd help [action]\r\n\r\nValid actions are: ' + actions.join(', ') + '.'); @@ -588,7 +576,7 @@ function run(argv) { } amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } }); amtMei.getProvisioningMode(function (result) { if (result) { mestate.ProvisioningMode = result; } }); - amtMei.getEHBCState(function (result) { if (result) { mestate.ehbc = ((result === true) || (typeof result == 'object') && (result.EHBC === true)); } }); + amtMei.getEHBCState(function (result) { mestate.ehbc = ((result === true) || (typeof result == 'object') && (result.EHBC === true)); }); amtMei.getControlMode(function (result) { if (result) { mestate.controlmode = result; } }); amtMei.getMACAddresses(function (result) { if (result) { mestate.mac = result; } }); amtMei.getLanInterfaceSettings(0, function (result) { if (result) { mestate.net0 = result; } }); @@ -719,7 +707,7 @@ function run(argv) { // Start Intel AMT configuration if ((settings.url == null) || (typeof settings.url != 'string') || (settings.url == '')) { console.log('No MeshCentral server URL specified, use --url [url].'); exit(1); return; } if ((settings.id == null) || (typeof settings.id != 'string') || (settings.id == '')) { console.log('No device group identifier specified, use --id [identifier].'); exit(1); return; } - settings.id = settings.id.split('\'').join(''); // Remove single quotes. + settings.id = settings.id.replace('\'', ''); // Remove single quote. debug(1, "Settings: " + JSON.stringify(settings)); configureAmt(); } else if (settings.action == 'amtccm') { @@ -836,11 +824,6 @@ function run(argv) { if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; } if ((settings.username == null) || (typeof settings.username != 'string') || (settings.username == '')) { settings.username = 'admin'; } performAmtFeatureConfig(args); - } else if ((settings.action == 'amtterm') && (console.canonical != null)) { - if (settings.hostname == null) { settings.hostname = '127.0.0.1'; } - if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; } - if ((settings.username == null) || (typeof settings.username != 'string') || (settings.username == '')) { settings.username = 'admin'; } - performAmtTerm(args); } else if (settings.action == 'amtpower') { // Perform remote Intel AMT power operation if ((settings.hostname == null) || (typeof settings.hostname != 'string') || (settings.hostname == '')) { console.log('No or invalid \"hostname\" specified, use --hostname [host].'); exit(1); return; } if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; } @@ -1500,12 +1483,7 @@ function deactivateACMEx() { amtstack = new amt(wsstack); amtstack.Get("AMT_SetupAndConfigurationService", function (stack, name, responses, status) { if (status !== 200) { - if ((responses != null) && (responses.Header != null) && (typeof responses.Header.error == 'string')) { - console.log(responses.Header.error + ', Status: ' + status); - if (status == 600) { console.log('Check that Intel AMT is in ACM mode and that the password is correct.'); } - } else { - console.log('Command not allowed, Status: ' + status); - } + console.log('Command not allowed. Status: ' + status); exit(1); } else { var sacs = responses.Body; @@ -2418,8 +2396,8 @@ function OnMulticastMessage(msg, rinfo) { // IDER // -var ider = null; -var iderIdleTimer = null; +ider = null; +iderIdleTimer = null; // Perform IDER function performIder() { @@ -2592,7 +2570,6 @@ function performAmtWifiConfig0(state, args) { } function performAmtWifiConfig1(stack, name, response, status, args) { - if (status == 600) { console.log('Unable to login, check that Intel AMT password is correct.'); exit(1); return; } if (status == 200) { var wifiAuthMethod = { 1: "Other", 2: "Open", 3: "Shared Key", 4: "WPA PSK", 5: "WPA 802.1x", 6: "WPA2 PSK", 7: "WPA2 802.1x", 32768: "WPA3 802.1x" }; var wifiEncMethod = { 1: "Other", 2: "WEP", 3: "TKIP", 4: "CCMP", 5: "None" } @@ -2604,7 +2581,17 @@ function performAmtWifiConfig1(stack, name, response, status, args) { } if (args) { - if (args.add) { + if (args.list) { + console.log('List of Intel AMT Wifi profiles:'); + if (wifiProfiles.length == 0) { + console.log('No Wifi profiles is stored.'); + } + for (var t in wifiProfiles) { + var w = wifiProfiles[t]; + console.log('Profile Name: ' + t + '; Priority: ' + w['Priority'] + '; SSID: ' + w['SSID'] + '; Security: ' + wifiAuthMethod[w['AuthenticationMethod']] + '/' + wifiEncMethod[w['EncryptionMethod']]); + } + exit(0); + } else if (args.add) { if (args.auth == null) { args.auth = 6; } // if not set, default to WPA2 PSK if (args.enc == null) { args.enc = 3; } // if not set, default to TKIP if (args.priority == null) { args.priority = 0; } // if not set, default to 0 @@ -2650,16 +2637,6 @@ function performAmtWifiConfig1(stack, name, response, status, args) { exit(0); }, 0, 1); - } else { - console.log('List of Intel AMT Wifi profiles:'); - var wikiProfileCount = 0; - for (var t in wifiProfiles) { - var w = wifiProfiles[t]; - console.log('Profile Name: ' + t + '; Priority: ' + w['Priority'] + '; SSID: ' + w['SSID'] + '; Security: ' + wifiAuthMethod[w['AuthenticationMethod']] + '/' + wifiEncMethod[w['EncryptionMethod']]); - wikiProfileCount++; - } - if (wikiProfileCount == 0) { console.log(' (No Wifi profiles stored)'); } - exit(0); } } else { exit(0); @@ -2993,51 +2970,6 @@ function makeUefiBootParam(type, data, len) { function IntToStrX(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF); } function ShortToStrX(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF); } - -// -// Intel AMT Serial-over-LAN -// - -var sol = null; - -// Called to start serial-over-lan terminal -function performAmtTerm(args) { - try { - sol = require('amt-redir-duk')(require('amt-sol')()); - sol.onStateChanged = onSolStateChange; - sol.m.onData = onSolData; - sol.m.debug = (settings.debuglevel > 0); - sol.Start(settings.hostname, (settings.tls == true) ? 16995 : 16994, settings.username ? 'admin' : settings.username, settings.password, settings.tls); - } catch (ex) { console.log(ex); } -} - -// Called when the serial-over-lan connection state changes -function onSolStateChange(stack, state) { - console.log(["Disconnected", "Connecting...", "Connected...", "Started Serial-over-LAN..."][state]); - if (state == 0) - { - console.echo = true; // This enables local echo to the console when keys are pressed - console.canonical = true; // This puts the console into canonical mode, which means stdin will not process each key press individually, instead it will process line by line. - exit(0); - } - if (state == 3) - { - console.echo = false; // This disables local echo to the console when keys are pressed - console.canonical = false; // This takes the console out of canonical mode, which means stdin will process each key press individually, instead of by line. - process.stdin.on('data', function (c) { sol.m.Send(c); }); - } - else - { - // Serial-over-LAN is not active, stop any stdin key capture - console.echo = true; // This enables local echo to the console when keys are pressed - console.canonical = true; // This puts the console into canonical mode, which means stdin will not process each key press individually, instead it will process line by line. - } -} - -// This is called when serial-over-lan data come in from Intel AMT -function onSolData(stack, data) { process.stdout.write(data); } - - // // Intel AMT feature configuration action // diff --git a/agents/meshcore.js b/agents/meshcore.js index 5a7faaf1..54e12a23 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -23,7 +23,8 @@ if (process.platform == 'win32' && require('user-sessions').getDomain == null) { }; } -var promise = require('promise'); +// NOTE: This seems to cause big problems, don't enable the debugger in the server's meshcore. +//attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); }); // Mesh Rights var MNG_ERROR = 65; @@ -45,63 +46,44 @@ var MESHRIGHT_CHATNOTIFY = 16384; var MESHRIGHT_UNINSTALL = 32768; var MESHRIGHT_NODESKTOP = 65536; -var pendingSetClip = false; // This is a temporary hack to prevent multiple setclips at the same time to stop the agent from crashing. -// -// This is a helper function used by the 32 bit Windows Agent, when running on 64 bit windows. It will check if the agent is already patched for this -// and will use this helper if it is not. This helper will inject 'sysnative' into the results when calling readdirSync() on %windir%. -// -function __readdirSync_fix(path) +function bcdOK() { - var sysnative = false; - pathstr = require('fs')._fixwinpath(path); - if (pathstr.split('\\*').join('').toLowerCase() == process.env['windir'].toLowerCase()) { sysnative = true; } - - var ret = require('fs').__readdirSync_old(path); - if (sysnative) { ret.push('sysnative'); } - return (ret); -} - -if (process.platform == 'win32' && require('_GenericMarshal').PointerSize == 4 && require('os').arch() == 'x64') -{ - if (require('fs').readdirSync.version == null) - { - // - // 32 Bit Windows Agent on 64 bit Windows has not been patched for sysnative issue, so lets use our own solution - // - require('fs').__readdirSync_old = require('fs').readdirSync; - require('fs').readdirSync = __readdirSync_fix; - } -} - -function bcdOK() { if (process.platform != 'win32') { return (false); } - if (require('os').arch() == 'x64') { + if(require('os').arch() == 'x64') + { return (require('_GenericMarshal').PointerSize == 8); } return (true); } -function getDomainInfo() { +function getDomainInfo() +{ var hostname = require('os').hostname(); var ret = { Name: hostname, Domain: "" }; - switch (process.platform) { + switch (process.platform) + { case 'win32': - try { - ret = require('win-wmi').query('ROOT\\CIMV2', 'SELECT * FROM Win32_ComputerSystem', ['Name', 'Domain'])[0]; + try + { + ret = require('win-wmi').query('ROOT\\CIMV2', 'SELECT * FROM Win32_ComputerSystem', ['Name', 'Domain'])[0]; } - catch (x) { + catch (x) + { } break; case 'linux': var hasrealm = false; - try { + try + { hasrealm = require('lib-finder').hasBinary('realm'); } - catch (x) { + catch(x) + { } - if (hasrealm) { + if (hasrealm) + { var child = require('child_process').execFile('/bin/sh', ['sh']); child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); child.stdin.write("realm list | grep domain-name: | tr '\\n' '`' | "); @@ -119,13 +101,17 @@ function getDomainInfo() { child.stdin.write('\nexit\n'); child.waitExit(); var names = []; - try { + try + { names = JSON.parse(child.stdout.str); } - catch (e) { + catch(e) + { } - while (names.length > 0) { - if (hostname.endsWith('.' + names.peek())) { + while(names.length>0) + { + if(hostname.endsWith('.' + names.peek())) + { ret = { Name: hostname.substring(0, hostname.length - names.peek().length - 1), Domain: names.peek() }; break; } @@ -202,17 +188,22 @@ function getCoreTranslation() { } var currentTranslation = getCoreTranslation(); -try { +try +{ require('kvm-helper'); } -catch (e) { +catch (e) +{ var j = { - users: function () { + users: function () + { var r = {}; require('user-sessions').Current(function (c) { r = c; }); - if (process.platform != 'win32') { - for (var i in r) { + if (process.platform != 'win32') + { + for (var i in r) + { r[i].SessionId = r[i].uid; } } @@ -295,9 +286,8 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) { // Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value try { var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024); - var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent')); - try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize'); } catch (ex) { } - if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize', actualSize); } catch (ex) { } } + try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { } + if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { } } } catch (ex) { } // Check to see if we are the Installed Mesh Agent Service, if we are, make sure we can run in Safe Mode @@ -311,16 +301,6 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) { try { meshCheck = require('service-manager').manager.getService(svcname).isMe(); } catch (ex) { } if (meshCheck && require('win-bcd').isSafeModeService && !require('win-bcd').isSafeModeService(svcname)) { require('win-bcd').enableSafeModeService(svcname); } } catch (ex) { } - - // Check the Agent Uninstall MetaData for DisplayVersion and update if not the same and only on windows - if (process.platform == 'win32') { - try { - var writtenDisplayVersion = 0, actualDisplayVersion = process.versions.commitDate.toString(); - var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent')); - try { writtenDisplayVersion = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'DisplayVersion'); } catch (ex) { } - if (writtenDisplayVersion != actualDisplayVersion) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'DisplayVersion', actualDisplayVersion); } catch (ex) { } } - } catch (ex) { } - } } if (process.platform != 'win32') { @@ -633,7 +613,7 @@ if ((require('fs').existsSync(process.cwd() + 'batterystate.txt')) && (require(' else { try { // Setup normal battery monitoring - if (require('computer-identifiers').isBatteryPowered && require('computer-identifiers').isBatteryPowered()) { + if (require('identifiers').isBatteryPowered && require('identifiers').isBatteryPowered()) { require('MeshAgent')._battLevelChanged = function _battLevelChanged(val) { _battLevelChanged.self._currentBatteryLevel = val; _battLevelChanged.self.SendCommand({ action: 'battery', state: _battLevelChanged.self._currentPowerState, level: val }); @@ -665,40 +645,35 @@ var meshCoreObj = { action: 'coreinfo', value: (require('MeshAgent').coreHash ? // Get the operating system description string try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; meshCoreObjChanged(); }); } catch (ex) { } + // Setup logged in user monitoring (THIS IS BROKEN IN WIN7) -function onUserSessionChanged(user, locked) { - userSession.enumerateUsers().then(function (users) { - if (process.platform == 'linux') { - if (userSession._startTime == null) { - userSession._startTime = Date.now(); - userSession._count = users.length; - } - else if (Date.now() - userSession._startTime < 10000 && users.length == userSession._count) { - userSession.removeAllListeners('changed'); - return; - } - } - - var u = [], a = users.Active; - if(meshCoreObj.lusers == null) { meshCoreObj.lusers = []; } - for (var i = 0; i < a.length; i++) { - var un = a[i].Domain ? (a[i].Domain + '\\' + a[i].Username) : (a[i].Username); - if (user && locked && (JSON.stringify(a[i]) === JSON.stringify(user))) { if (meshCoreObj.lusers.indexOf(un) == -1) { meshCoreObj.lusers.push(un); } } - else if (user && !locked && (JSON.stringify(a[i]) === JSON.stringify(user))) { meshCoreObj.lusers.splice(meshCoreObj.lusers.indexOf(un), 1); } - if (u.indexOf(un) == -1) { u.push(un); } // Only push users in the list once. - } - meshCoreObj.lusers = meshCoreObj.lusers; - meshCoreObj.users = u; - meshCoreObjChanged(); - }); -} - try { var userSession = require('user-sessions'); - userSession.on('changed', function () { onUserSessionChanged(null, false); }); + userSession.on('changed', function onUserSessionChanged() { + userSession.enumerateUsers().then(function (users) { + if (process.platform == 'linux') { + if (userSession._startTime == null) { + userSession._startTime = Date.now(); + userSession._count = users.length; + } + else if (Date.now() - userSession._startTime < 10000 && users.length == userSession._count) { + userSession.removeAllListeners('changed'); + return; + } + } + + var u = [], a = users.Active; + for (var i = 0; i < a.length; i++) { + var un = a[i].Domain ? (a[i].Domain + '\\' + a[i].Username) : (a[i].Username); + if (u.indexOf(un) == -1) { u.push(un); } // Only push users in the list once. + } + meshCoreObj.users = u; + meshCoreObjChanged(); + }); + }); userSession.emit('changed'); - userSession.on('locked', function (user) { if(user != undefined && user != null) { onUserSessionChanged(user, true); } }); - userSession.on('unlocked', function (user) { if(user != undefined && user != null) { onUserSessionChanged(user, false); } }); + //userSession.on('locked', function (user) { sendConsoleText('[' + (user.Domain ? user.Domain + '\\' : '') + user.Username + '] has LOCKED the desktop'); }); + //userSession.on('unlocked', function (user) { sendConsoleText('[' + (user.Domain ? user.Domain + '\\' : '') + user.Username + '] has UNLOCKED the desktop'); }); } catch (ex) { } var meshServerConnectionState = 0; @@ -841,6 +816,10 @@ function getIpLocationDataEx(func) { catch (ex) { return false; } } +// Setup script task. Allows running scripts at scheduled intervals +var scriptTask = null; +try { scriptTask = require('scripttask'); } catch (ex) { } + // Remove all Gateway MAC addresses for interface list. This is useful because the gateway MAC is not always populated reliably. function clearGatewayMac(str) { if (typeof str != 'string') return null; @@ -1086,35 +1065,6 @@ function server_check_consentTimer(id) { return false; } -function tunnel_finalized() -{ - console.info1('Tunnel Request Finalized'); -} -function tunnel_checkServerIdentity(certs) -{ - /* - try { sendConsoleText("certs[0].digest: " + certs[0].digest); } catch (ex) { sendConsoleText(ex); } - try { sendConsoleText("certs[0].fingerprint: " + certs[0].fingerprint); } catch (ex) { sendConsoleText(ex); } - try { sendConsoleText("control-digest: " + require('MeshAgent').ServerInfo.ControlChannelCertificate.digest); } catch (ex) { sendConsoleText(ex); } - try { sendConsoleText("control-fingerprint: " + require('MeshAgent').ServerInfo.ControlChannelCertificate.fingerprint); } catch (ex) { sendConsoleText(ex); } - */ - - // Check if this is an old agent, no certificate checks are possible in this situation. Display a warning. - if ((require('MeshAgent').ServerInfo == null) || (require('MeshAgent').ServerInfo.ControlChannelCertificate == null) || (certs[0].digest == null)) { sendAgentMessage("This agent is using insecure tunnels, consider updating.", 3, 119, true); return; } - - // If the tunnel certificate matches the control channel certificate, accept the connection - if (require('MeshAgent').ServerInfo.ControlChannelCertificate.digest == certs[0].digest) return; // Control channel certificate matches using full cert hash - if ((certs[0].fingerprint != null) && (require('MeshAgent').ServerInfo.ControlChannelCertificate.fingerprint == certs[0].fingerprint)) return; // Control channel certificate matches using public key hash - - // Check that the certificate is the one expected by the server, fail if not. - if ((tunnel_checkServerIdentity.servertlshash != null) && (tunnel_checkServerIdentity.servertlshash.toLowerCase() != certs[0].digest.split(':').join('').toLowerCase())) { throw new Error('BadCert') } -} - -function tunnel_onError() -{ - sendConsoleText("ERROR: Unable to connect relay tunnel to: " + this.url + ", " + JSON.stringify(e)); -} - // Handle a mesh agent command function handleServerCommand(data) { if (typeof data == 'object') { @@ -1134,8 +1084,7 @@ function handleServerCommand(data) { } break; } - case 'tunnel': - { + case 'tunnel': { if (data.value != null) { // Process a new tunnel connection request // Create a new tunnel object var xurl = getServerTargetUrlEx(data.value); @@ -1147,15 +1096,31 @@ function handleServerCommand(data) { // Perform manual server TLS certificate checking based on the certificate hash given by the server. woptions.rejectUnauthorized = 0; - woptions.checkServerIdentity = tunnel_checkServerIdentity; + woptions.checkServerIdentity = function checkServerIdentity(certs) { + /* + try { sendConsoleText("certs[0].digest: " + certs[0].digest); } catch (ex) { sendConsoleText(ex); } + try { sendConsoleText("certs[0].fingerprint: " + certs[0].fingerprint); } catch (ex) { sendConsoleText(ex); } + try { sendConsoleText("control-digest: " + require('MeshAgent').ServerInfo.ControlChannelCertificate.digest); } catch (ex) { sendConsoleText(ex); } + try { sendConsoleText("control-fingerprint: " + require('MeshAgent').ServerInfo.ControlChannelCertificate.fingerprint); } catch (ex) { sendConsoleText(ex); } + */ + + // Check if this is an old agent, no certificate checks are possible in this situation. Display a warning. + if ((require('MeshAgent').ServerInfo == null) || (require('MeshAgent').ServerInfo.ControlChannelCertificate == null) || (certs[0].digest == null)) { sendAgentMessage("This agent is using insecure tunnels, consider updating.", 3, 119, true); return; } + + // If the tunnel certificate matches the control channel certificate, accept the connection + if (require('MeshAgent').ServerInfo.ControlChannelCertificate.digest == certs[0].digest) return; // Control channel certificate matches using full cert hash + if ((certs[0].fingerprint != null) && (require('MeshAgent').ServerInfo.ControlChannelCertificate.fingerprint == certs[0].fingerprint)) return; // Control channel certificate matches using public key hash + + // Check that the certificate is the one expected by the server, fail if not. + if ((checkServerIdentity.servertlshash != null) && (checkServerIdentity.servertlshash.toLowerCase() != certs[0].digest.split(':').join('').toLowerCase())) { throw new Error('BadCert') } + } woptions.checkServerIdentity.servertlshash = data.servertlshash; //sendConsoleText(JSON.stringify(woptions)); //sendConsoleText('TUNNEL: ' + JSON.stringify(data, null, 2)); - var tunnel = http.request(woptions); tunnel.upgrade = onTunnelUpgrade; - tunnel.on('error', tunnel_onError); + tunnel.on('error', function (e) { sendConsoleText("ERROR: Unable to connect relay tunnel to: " + this.url + ", " + JSON.stringify(e)); }); tunnel.sessionid = data.sessionid; tunnel.rights = data.rights; tunnel.consent = data.consent; @@ -1175,19 +1140,15 @@ function handleServerCommand(data) { tunnel.soptions = data.soptions; tunnel.consentTimeout = (tunnel.soptions && tunnel.soptions.consentTimeout) ? tunnel.soptions.consentTimeout : 30; tunnel.consentAutoAccept = (tunnel.soptions && (tunnel.soptions.consentAutoAccept === true)); - tunnel.consentAutoAcceptIfNoUser = (tunnel.soptions && (tunnel.soptions.consentAutoAcceptIfNoUser === true)); - tunnel.oldStyle = (tunnel.soptions && tunnel.soptions.oldStyle) ? tunnel.soptions.oldStyle : false; tunnel.tcpaddr = data.tcpaddr; tunnel.tcpport = data.tcpport; tunnel.udpaddr = data.udpaddr; tunnel.udpport = data.udpport; - + tunnel.end(); // Put the tunnel in the tunnels list var index = nextTunnelIndex++; tunnel.index = index; tunnels[index] = tunnel; - tunnel.once('~', tunnel_finalized); - tunnel.end(); //sendConsoleText('New tunnel connection #' + index + ': ' + tunnel.url + ', rights: ' + tunnel.rights, data.sessionid); } @@ -1219,37 +1180,42 @@ function handleServerCommand(data) { } case 'messagebox': { // Display a message box - if (data.title && data.msg) { + if (data.title && data.msg) + { MeshServerLogEx(18, [data.title, data.msg], "Displaying message box, title=" + data.title + ", message=" + data.msg, data); - if (process.platform == 'win32') { - if (global._clientmessage) { + if (process.platform == 'win32') + { + if(global._clientmessage) + { global._clientmessage.addMessage(data.msg); } - else { - try { + else + { + try + { require('win-dialog'); var ipr = server_getUserImage(data.userid); ipr.title = data.title; ipr.message = data.msg; ipr.username = data.username; if (data.realname && (data.realname != '')) { ipr.username = data.realname; } - ipr.timeout = (typeof data.timeout === 'number' ? data.timeout : 120000); - global._clientmessage = ipr.then(function (img) { - var options = { b64Image: img.split(',').pop(), background: color_options.background, foreground: color_options.foreground } - if (this.timeout != 0) { options.timeout = this.timeout; } - this.messagebox = require('win-dialog').create(this.title, this.message, this.username, options); + global._clientmessage = ipr.then(function (img) + { + this.messagebox = require('win-dialog').create(this.title, this.message, this.username, { timeout: 120000, b64Image: img.split(',').pop(), background: color_options.background, foreground: color_options.foreground }); this.__childPromise.addMessage = this.messagebox.addMessage.bind(this.messagebox); return (this.messagebox); }); global._clientmessage.then(function () { global._clientmessage = null; }); } - catch (z) { + catch(z) + { try { require('message-box').create(data.title, data.msg, 120).then(function () { }).catch(function () { }); } catch (ex) { } } } } - else { + else + { try { require('message-box').create(data.title, data.msg, 120).then(function () { }).catch(function () { }); } catch (ex) { } } } @@ -1268,9 +1234,6 @@ function handleServerCommand(data) { // Requestion details information about a process if (data.pid) { var info = {}; // TODO: Replace with real data. Feel free not to give all values if not available. - try { - info = processManager.getProcessInfo(data.pid); - }catch(e){ } /* info.processUser = "User"; // String info.processDomain = "Domain"; // String @@ -1307,41 +1270,6 @@ function handleServerCommand(data) { } break; } - case 'service': { - // return information about the service - try { - var service = require('service-manager').manager.getService(data.serviceName); - if (service != null) { - var reply = { - name: (service.name ? service.name : ''), - status: (service.status ? service.status : ''), - startType: (service.startType ? service.startType : ''), - failureActions: (service.failureActions ? service.failureActions : ''), - installedDate: (service.installedDate ? service.installedDate : ''), - installedBy: (service.installedBy ? service.installedBy : '') , - user: (service.user ? service.user : '') - }; - if(reply.installedBy.indexOf('S-1-5') != -1) { - var cmd = "(Get-WmiObject -Class win32_userAccount -Filter \"SID='"+service.installedBy+"'\").Caption"; - var replydata = ""; - var pws = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], {}); - pws.descriptorMetadata = 'UserSIDPowerShell'; - pws.stdout.on('data', function (c) { replydata += c.toString(); }); - pws.stderr.on('data', function (c) { replydata += c.toString(); }); - pws.stdin.write(cmd + '\r\nexit\r\n'); - pws.on('exit', function () { - if (replydata != "") reply.installedBy = replydata; - mesh.SendCommand({ action: 'msg', type: 'service', value: JSON.stringify(reply), sessionid: data.sessionid }); - delete pws; - }); - } else { - mesh.SendCommand({ action: 'msg', type: 'service', value: JSON.stringify(reply), sessionid: data.sessionid }); - } - } - } catch (ex) { - mesh.SendCommand({ action: 'msg', type: 'service', error: ex, sessionid: data.sessionid }) - } - } case 'services': { // Return the list of installed services var services = null; @@ -1397,13 +1325,11 @@ function handleServerCommand(data) { child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); child.stderr.on('data', function () { }); child.waitExit(); - mesh.SendCommand({ action: 'msg', type: 'deskBackground', sessionid: data.sessionid, data: (current != '' ? "" : require('MeshAgent')._wallpaper), }); } else { var id = require('user-sessions').consoleUid(); var current = require('linux-gnome-helpers').getDesktopWallpaper(id); if (current != '/dev/null') { require('MeshAgent')._wallpaper = current; } require('linux-gnome-helpers').setDesktopWallpaper(id, current != '/dev/null' ? undefined : require('MeshAgent')._wallpaper); - mesh.SendCommand({ action: 'msg', type: 'deskBackground', sessionid: data.sessionid, data: (current != '/dev/null' ? "" : require('MeshAgent')._wallpaper), }); } } catch (ex) { sendConsoleText(ex); @@ -1428,7 +1354,7 @@ function handleServerCommand(data) { } }); } else { - require('clipboard').read().then(function (str) { + require("clipboard").read().then(function (str) { if (str) { MeshServerLogEx(21, [str.length], "Getting clipboard content, " + str.length + " byte(s)", data); mesh.SendCommand({ action: 'msg', type: 'getclip', sessionid: data.sessionid, data: str, tag: data.tag }); @@ -1438,34 +1364,34 @@ function handleServerCommand(data) { break; } case 'setclip': { - if (pendingSetClip) return; // Set the load clipboard to a user value - if (typeof data.data == 'string') { + if (typeof data.data == 'string') + { MeshServerLogEx(22, [data.data.length], "Setting clipboard content, " + data.data.length + " byte(s)", data); - if (require('MeshAgent').isService) { - if (process.platform != 'win32') { + if (require('MeshAgent').isService) + { + if (process.platform != 'win32') + { require('clipboard').dispatchWrite(data.data); mesh.SendCommand({ action: 'msg', type: 'setclip', sessionid: data.sessionid, success: true }); } - else { + else + { var clipargs = data.data; var uid = require('user-sessions').consoleUid(); var user = require('user-sessions').getUsername(uid); var domain = require('user-sessions').getDomain(uid); user = (domain + '\\' + user); - if (this._dispatcher) { this._dispatcher.close(); } this._dispatcher = require('win-dispatcher').dispatch({ user: user, modules: [{ name: 'clip-dispatch', script: "module.exports = { dispatch: function dispatch(val) { require('clipboard')(val); process.exit(); } };" }], launch: { module: 'clip-dispatch', method: 'dispatch', args: [clipargs] } }); this._dispatcher.parent = this; //require('events').setFinalizerMetadata.call(this._dispatcher, 'clip-dispatch'); - pendingSetClip = true; - this._dispatcher.on('connection', function (c) { + this._dispatcher.on('connection', function (c) + { this._c = c; this._c.root = this.parent; this._c.on('end', function () { - pendingSetClip = false; - try { this.root._dispatcher.close(); } catch (ex) { } this.root._dispatcher = null; this.root = null; mesh.SendCommand({ action: 'msg', type: 'setclip', sessionid: data.sessionid, success: true }); @@ -1473,8 +1399,9 @@ function handleServerCommand(data) { }); } } - else { - require('clipboard')(data.data); + else + { + require("clipboard")(data.data); mesh.SendCommand({ action: 'msg', type: 'setclip', sessionid: data.sessionid, success: true }); } // Set the clipboard } @@ -1507,14 +1434,6 @@ function handleServerCommand(data) { sendConsoleText('localappMsg: ' + data.appid + ', ' + JSON.stringify(data.value)); if (data.appid != null) { sendToRegisteredApp(data.appid, data.value); } else { broadcastToRegisteredApps(data.value); } break; - case 'alertbox': { - // Display an old style alert box - if (data.title && data.msg) { - MeshServerLogEx(158, [data.title, data.msg], "Displaying alert box, title=" + data.title + ", message=" + data.msg, data); - try { require('message-box').create(data.title, data.msg, 9999, 1).then(function () { }).catch(function () { }); } catch (ex) { } - } - break; - } default: // Unknown action, ignore it. break; @@ -1538,7 +1457,7 @@ function handleServerCommand(data) { } case 'runcommands': { if (mesh.cmdchild != null) { sendConsoleText("Run commands can't execute, already busy."); break; } - if (!data.reply) sendConsoleText("Run commands (" + data.runAsUser + "): " + data.cmds); + sendConsoleText("Run commands (" + data.runAsUser + "): " + data.cmds); // data.runAsUser: 0=Agent,1=UserOrAgent,2=UserOnly var options = {}; @@ -1550,57 +1469,33 @@ function handleServerCommand(data) { if (options.uid == null) break; if (((require('user-sessions').minUid != null) && (options.uid < require('user-sessions').minUid()))) break; // This command can only run as user. } - var replydata = ""; + if (process.platform == 'win32') { if (data.type == 1) { // Windows command shell mesh.cmdchild = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['cmd'], options); mesh.cmdchild.descriptorMetadata = 'UserCommandsShell'; - mesh.cmdchild.stdout.on('data', function (c) { replydata += c.toString(); }); - mesh.cmdchild.stderr.on('data', function (c) { replydata += c.toString(); }); + mesh.cmdchild.stdout.on('data', function (c) { sendConsoleText(c.toString()); }); + mesh.cmdchild.stderr.on('data', function (c) { sendConsoleText(c.toString()); }); mesh.cmdchild.stdin.write(data.cmds + '\r\nexit\r\n'); - mesh.cmdchild.on('exit', function () { - if (data.reply) { - mesh.SendCommand({ action: 'msg', type: 'runcommands', result: replydata, sessionid: data.sessionid, responseid: data.responseid }); - } else { - sendConsoleText(replydata); - sendConsoleText("Run commands completed."); - } - delete mesh.cmdchild; - }); + mesh.cmdchild.on('exit', function () { sendConsoleText("Run commands completed."); delete mesh.cmdchild; }); } else if (data.type == 2) { // Windows Powershell mesh.cmdchild = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], options); mesh.cmdchild.descriptorMetadata = 'UserCommandsPowerShell'; - mesh.cmdchild.stdout.on('data', function (c) { replydata += c.toString(); }); - mesh.cmdchild.stderr.on('data', function (c) { replydata += c.toString(); }); + mesh.cmdchild.stdout.on('data', function (c) { sendConsoleText(c.toString()); }); + mesh.cmdchild.stderr.on('data', function (c) { sendConsoleText(c.toString()); }); mesh.cmdchild.stdin.write(data.cmds + '\r\nexit\r\n'); - mesh.cmdchild.on('exit', function () { - if (data.reply) { - mesh.SendCommand({ action: 'msg', type: 'runcommands', result: replydata, sessionid: data.sessionid, responseid: data.responseid }); - } else { - sendConsoleText(replydata); - sendConsoleText("Run commands completed."); - } - delete mesh.cmdchild; - }); + mesh.cmdchild.on('exit', function () { sendConsoleText("Run commands completed."); delete mesh.cmdchild; }); } } else if (data.type == 3) { // Linux shell mesh.cmdchild = require('child_process').execFile('/bin/sh', ['sh'], options); mesh.cmdchild.descriptorMetadata = 'UserCommandsShell'; - mesh.cmdchild.stdout.on('data', function (c) { replydata += c.toString(); }); - mesh.cmdchild.stderr.on('data', function (c) { replydata += c.toString(); }); + mesh.cmdchild.stdout.on('data', function (c) { sendConsoleText(c.toString()); }); + mesh.cmdchild.stderr.on('data', function (c) { sendConsoleText(c.toString()); }); mesh.cmdchild.stdin.write(data.cmds.split('\r').join('') + '\nexit\n'); - mesh.cmdchild.on('exit', function () { - if (data.reply) { - mesh.SendCommand({ action: 'msg', type: 'runcommands', result: replydata, sessionid: data.sessionid, responseid: data.responseid }); - } else { - sendConsoleText(replydata); - sendConsoleText("Run commands completed."); - } - delete mesh.cmdchild; - }); + mesh.cmdchild.on('exit', function () { sendConsoleText("Run commands completed."); delete mesh.cmdchild; }); } break; } @@ -1877,16 +1772,10 @@ function onFileWatcher(a, b) { } */ -// Replace all key name spaces with _ in an object recursively. -// This is a workaround since require('computer-identifiers').get() returns key names with spaces in them on Linux. -function replaceSpacesWithUnderscoresRec(o) { - if (typeof o != 'object') return; - for (var i in o) { if (i.indexOf(' ') >= 0) { o[i.split(' ').join('_')] = o[i]; delete o[i]; } replaceSpacesWithUnderscoresRec(o[i]); } -} - function getSystemInformation(func) { try { - var results = { hardware: require('computer-identifiers').get() }; // Hardware info + var results = { hardware: require('identifiers').get() }; // Hardware info + if (results.hardware && results.hardware.windows) { // Remove extra entries and things that change quickly var x = results.hardware.windows.osinfo; @@ -1902,68 +1791,34 @@ function getSystemInformation(func) { if (results.hardware.windows.osinfo) { delete results.hardware.windows.osinfo.Node; } if (results.hardware.windows.partitions) { for (var i in results.hardware.windows.partitions) { delete results.hardware.windows.partitions[i].Node; } } } catch (ex) { } - if (x.LastBootUpTime) { // detect windows uptime - var thedate = { - year: parseInt(x.LastBootUpTime.substring(0, 4)), - month: parseInt(x.LastBootUpTime.substring(4, 6)) - 1, // Months are 0-based in JavaScript (0 - January, 11 - December) - day: parseInt(x.LastBootUpTime.substring(6, 8)), - hours: parseInt(x.LastBootUpTime.substring(8, 10)), - minutes: parseInt(x.LastBootUpTime.substring(10, 12)), - seconds: parseInt(x.LastBootUpTime.substring(12, 14)), - }; - var thelastbootuptime = new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds); - meshCoreObj.lastbootuptime = thelastbootuptime.getTime(); // store the last boot up time in coreinfo for columns - meshCoreObjChanged(); - var nowtime = new Date(); - var differenceInMilliseconds = Math.abs(thelastbootuptime - nowtime); - if (differenceInMilliseconds < 300000) { // computer uptime less than 5 minutes - MeshServerLogEx(159, [thelastbootuptime.toString()], "Device Powered On", null); - } - } } - if(results.hardware && results.hardware.linux) { - if(results.hardware.linux.LastBootUpTime) { - var thelastbootuptime = new Date(results.hardware.linux.LastBootUpTime); - meshCoreObj.lastbootuptime = thelastbootuptime.getTime(); // store the last boot up time in coreinfo for columns - meshCoreObjChanged(); - var nowtime = new Date(); - var differenceInMilliseconds = Math.abs(thelastbootuptime - nowtime); - if (differenceInMilliseconds < 300000) { // computer uptime less than 5 minutes - MeshServerLogEx(159, [thelastbootuptime.toString()], "Device Powered On", null); - } - } - } - if(results.hardware && results.hardware.darwin){ - if(results.hardware.darwin.LastBootUpTime) { - var thelastbootuptime = new Date(results.hardware.darwin.LastBootUpTime * 1000); // must times by 1000 even tho timestamp is correct? - meshCoreObj.lastbootuptime = thelastbootuptime.getTime(); // store the last boot up time in coreinfo for columns - meshCoreObjChanged(); - var nowtime = new Date(); - var differenceInMilliseconds = Math.abs(thelastbootuptime - nowtime); - if (differenceInMilliseconds < 300000) { // computer uptime less than 5 minutes - MeshServerLogEx(159, [thelastbootuptime.toString()], "Device Powered On", null); - } - } - } results.hardware.agentvers = process.versions; - results.hardware.network = { dns: require('os').dns() }; - replaceSpacesWithUnderscoresRec(results); var hasher = require('SHA384Stream').create(); + results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex'); + func(results); + /* // On Windows platforms, get volume information - Needs more testing. if (process.platform == 'win32') { results.pendingReboot = require('win-info').pendingReboot(); // Pending reboot - if (require('win-volumes').volumes_promise != null) + + if (require('identifiers').volumes_promise != null) { - var p = require('win-volumes').volumes_promise(); + var p = require('identifiers').volumes_promise(); p.then(function (res) { - results.hardware.windows.volumes = cleanGetBitLockerVolumeInfo(res); + results.volumes = res; results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex'); func(results); }); } + else if (require('identifiers').volumes != null) + { + results.volumes = require('identifiers').volumes(); + results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex'); + func(results); + } else { results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex'); @@ -1975,7 +1830,7 @@ function getSystemInformation(func) { results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex'); func(results); } - + */ } catch (ex) { func(null, ex); } } @@ -1985,10 +1840,11 @@ function getDirectoryInfo(reqpath) { if (((reqpath == undefined) || (reqpath == '')) && (process.platform == 'win32')) { // List all the drives in the root, or the root itself var results = null; - try { results = fs.readDrivesSync(); } catch (ex) { } + try { results = fs.readDrivesSync(); } catch (ex) { } // TODO: Anyway to get drive total size and free space? Could draw a progress bar. if (results != null) { for (var i = 0; i < results.length; ++i) { - var drive = { n: results[i].name, t: 1, dt: results[i].type, s: (results[i].size ? results[i].size : 0), f: (results[i].free ? results[i].free : 0) }; + var drive = { n: results[i].name, t: 1 }; + if (results[i].type == 'REMOVABLE') { drive.dt = 'removable'; } // TODO: See if this is USB/CDROM or something else, we can draw icons. response.dir.push(drive); } } @@ -2021,34 +1877,20 @@ function getDirectoryInfo(reqpath) { return response; } -function tunnel_s_finalized() -{ - console.info1('Tunnel Socket Finalized'); -} - - -function tunnel_onIdleTimeout() -{ - this.ping(); - this.setTimeout(require('MeshAgent').idleTimeout * 1000); -} - // Tunnel callback operations -function onTunnelUpgrade(response, s, head) -{ - +function onTunnelUpgrade(response, s, head) { this.s = s; - s.once('~', tunnel_s_finalized); s.httprequest = this; s.end = onTunnelClosed; s.tunnel = this; s.descriptorMetadata = "MeshAgent_relayTunnel"; - - if (require('MeshAgent').idleTimeout != null) - { + if (require('MeshAgent').idleTimeout != null) { s.setTimeout(require('MeshAgent').idleTimeout * 1000); - s.on('timeout', tunnel_onIdleTimeout); + s.on('timeout', function () { + this.ping(); + this.setTimeout(require('MeshAgent').idleTimeout * 1000); + }); } //sendConsoleText('onTunnelUpgrade - ' + this.tcpport + ' - ' + this.udpport); @@ -2069,8 +1911,7 @@ function onTunnelUpgrade(response, s, head) try { mesh.SendCommand({ action: 'sessions', type: 'tcp', value: tunnelUserCount.tcp }); } catch (ex) { } broadcastSessionsToRegisteredApps(); } - } - if (this.udpport != null) { + } if (this.udpport != null) { // This is a UDP relay connection, get the UDP socket setup. // TODO: *************** s.data = onUdpRelayServerTunnelData; s.udprelay = require('dgram').createSocket({ type: 'udp4' }); @@ -2088,8 +1929,7 @@ function onTunnelUpgrade(response, s, head) try { mesh.SendCommand({ action: 'sessions', type: 'udp', value: tunnelUserCount.tcp }); } catch (ex) { } broadcastSessionsToRegisteredApps(); } - } - else { + } else { // This is a normal connect for KVM/Terminal/Files s.data = onTunnelData; } @@ -2132,25 +1972,7 @@ function onTcpRelayServerTunnelData(data) { } } -function onTunnelClosed() -{ - if (this.httprequest._dispatcher != null && this.httprequest.term == null) - { - // Windows Dispatcher was created to spawn a child connection, but the child didn't connect yet, so we have to shutdown the dispatcher, otherwise the child may end up hanging - if (this.httprequest._dispatcher.close) { this.httprequest._dispatcher.close(); } - this.httprequest._dispatcher = null; - } - - if (this.tunnel) - { - if (tunnels[this.httprequest.index] == null) - { - this.tunnel.s = null; - this.tunnel = null; - return; - } - } - +function onTunnelClosed() { var tunnel = tunnels[this.httprequest.index]; if (tunnel == null) return; // Stop duplicate calls. @@ -2200,7 +2022,7 @@ function onTunnelClosed() } catch (ex) { } //sendConsoleText("Tunnel #" + this.httprequest.index + " closed. Sent -> " + this.bytesSent_uncompressed + ' bytes (uncompressed), ' + this.bytesSent_actual + ' bytes (actual), ' + this.bytesSent_ratio + '% compression', this.httprequest.sessionid); - + if (this.httprequest.index) { delete tunnels[this.httprequest.index]; } /* // Close the watcher if required @@ -2227,735 +2049,11 @@ function onTunnelClosed() } // Clean up WebSocket - delete tunnels[this.httprequest.index]; - tunnel = null; - this.tunnel.s = null; - this.tunnel = null; this.removeAllListeners('data'); } function onTunnelSendOk() { /*sendConsoleText("Tunnel #" + this.index + " SendOK.", this.sessionid);*/ } - -function terminal_onconnection (c) -{ - if (this.httprequest.connectionPromise.completed) - { - c.end(); - } - else - { - this.httprequest.connectionPromise._res(c); - } -} -function terminal_user_onconnection(c) -{ - console.info1('completed-2: ' + this.connectionPromise.completed); - - if (this.connectionPromise.completed) - { - c.end(); - } - else - { - this.connectionPromise._res(c); - } -} -function terminal_stderr_ondata(c) -{ - this.stdout.write(c); -} -function terminal_onend() -{ - this.httprequest.process.kill(); -} - -function terminal_onexit() -{ - this.tunnel.end(); -} -function terminal_onfinalized() -{ - this.httprequest = null; - console.info1('Dispatcher Finalized'); -} -function terminal_end() -{ - if (this.httprequest == null) { return; } - if (this.httprequest.tpromise._consent) { this.httprequest.tpromise._consent.close(); } - if (this.httprequest.connectionPromise) { this.httprequest.connectionPromise._rej('Closed'); } - - // Remove the terminal session to the count to update the server - if (this.httprequest.userid != null) - { - var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest); - if (tunnelUserCount.terminal[userid] != null) { tunnelUserCount.terminal[userid]--; if (tunnelUserCount.terminal[userid] <= 0) { delete tunnelUserCount.terminal[userid]; } } - try { mesh.SendCommand({ action: 'sessions', type: 'terminal', value: tunnelUserCount.terminal }); } catch (ex) { } - broadcastSessionsToRegisteredApps(); - } - - if (process.platform == 'win32') - { - // Unpipe the web socket - this.unpipe(this.httprequest._term); - if (this.httprequest._term) { this.httprequest._term.unpipe(this); } - - // Unpipe the WebRTC channel if needed (This will also be done when the WebRTC channel ends). - if (this.rtcchannel) - { - this.rtcchannel.unpipe(this.httprequest._term); - if (this.httprequest._term) { this.httprequest._term.unpipe(this.rtcchannel); } - } - - // Clean up - if (this.httprequest._term) { this.httprequest._term.end(); } - this.httprequest._term = null; - this.httprequest._dispatcher = null; - } - - this.httprequest = null; - -} - -function terminal_consent_ask(ws) { - ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); - var consentMessage = currentTranslation['terminalConsent'].replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); - var consentTitle = 'MeshCentral'; - if (ws.httprequest.soptions != null) { - if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; } - if (ws.httprequest.soptions.consentMsgTerminal != null) { consentMessage = ws.httprequest.soptions.consentMsgTerminal.replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); } - } - if (process.platform == 'win32') { - var enhanced = false; - if (ws.httprequest.oldStyle === false) { - try { require('win-userconsent'); enhanced = true; } catch (ex) { } - } - if (enhanced) { - var ipr = server_getUserImage(ws.httprequest.userid); - ipr.consentTitle = consentTitle; - ipr.consentMessage = consentMessage; - ipr.consentTimeout = ws.httprequest.consentTimeout; - ipr.consentAutoAccept = ws.httprequest.consentAutoAccept; - ipr.username = ws.httprequest.realname; - ipr.tsid = ws.tsid; - ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; - ws.httprequest.tpromise._consent = ipr.then(function (img) { - this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: this.consentTimeout * 1000, timeoutAutoAccept: this.consentAutoAccept, translations: this.translations, background: color_options.background, foreground: color_options.foreground }); - this.__childPromise.close = this.consent.close.bind(this.consent); - return (this.consent); - }); - } else { - ws.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout); - } - } else { - ws.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout); - } - ws.httprequest.tpromise._consent.retPromise = ws.httprequest.tpromise; - ws.httprequest.tpromise._consent.then(function (always) { - if (always && process.platform == 'win32') { server_set_consentTimer(this.retPromise.httprequest.userid); } - // Success - MeshServerLogEx(27, null, "Local user accepted remote terminal request (" + this.retPromise.httprequest.remoteaddr + ")", this.retPromise.that.httprequest); - this.retPromise.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: null, msgid: 0 })); - this.retPromise._consent = null; - this.retPromise._res(); - }, function (e) { - if (this.retPromise.that) { - if(this.retPromise.that.httprequest){ // User Consent Denied - MeshServerLogEx(28, null, "Local user rejected remote terminal request (" + this.retPromise.that.httprequest.remoteaddr + ")", this.retPromise.that.httprequest); - } else { } // Connection was closed server side, maybe log some messages somewhere? - this.retPromise._consent = null; - this.retPromise.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); - } else { } // no websocket, maybe log some messages somewhere? - this.retPromise._rej(e.toString()); - }); -} - -function terminal_promise_connection_rejected(e) -{ - // FAILED to connect terminal - this.ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); - this.ws.end(); -} - -function terminal_promise_connection_resolved(term) -{ - this._internal.completedArgs = []; - - // SUCCESS - var stdoutstream; - var stdinstream; - if (process.platform == 'win32') - { - this.ws.httprequest._term = term; - this.ws.httprequest._term.tunnel = this.ws; - stdoutstream = stdinstream = term; - } - else - { - term.descriptorMetadata = 'Remote Terminal'; - this.ws.httprequest.process = term; - this.ws.httprequest.process.tunnel = this.ws; - term.stderr.stdout = term.stdout; - term.stderr.on('data', terminal_stderr_ondata); - stdoutstream = term.stdout; - stdinstream = term.stdin; - this.ws.prependListener('end', terminal_onend); - term.prependListener('exit', terminal_onexit); - } - - this.ws.removeAllListeners('data'); - this.ws.on('data', onTunnelControlData); - - stdoutstream.pipe(this.ws, { dataTypeSkip: 1 }); // 0 = Binary, 1 = Text. - this.ws.pipe(stdinstream, { dataTypeSkip: 1, end: false }); // 0 = Binary, 1 = Text. - - // Add the terminal session to the count to update the server - if (this.ws.httprequest.userid != null) - { - var userid = getUserIdAndGuestNameFromHttpRequest(this.ws.httprequest); - if (tunnelUserCount.terminal[userid] == null) { tunnelUserCount.terminal[userid] = 1; } else { tunnelUserCount.terminal[userid]++; } - try { mesh.SendCommand({ action: 'sessions', type: 'terminal', value: tunnelUserCount.terminal }); } catch (ex) { } - broadcastSessionsToRegisteredApps(); - } - - // Toast Notification, if required - if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 2)) - { - // User Notifications is required - var notifyMessage = currentTranslation['terminalNotify'].replace('{0}', this.ws.httprequest.realname ? this.ws.httprequest.realname : this.ws.httprequest.username); - var notifyTitle = "MeshCentral"; - if (this.ws.httprequest.soptions != null) - { - if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } - if (this.ws.httprequest.soptions.notifyMsgTerminal != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgTerminal.replace('{0}', this.ws.httprequest.realname).replace('{1}', this.ws.httprequest.username); } - } - try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } - } - this.ws = null; -} -function terminal_promise_consent_rejected(e) -{ - // DO NOT start terminal - this.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); - this.that.end(); - - this.that = null; - this.httprequest = null; -} -function promise_init(res, rej) { this._res = res; this._rej = rej; } -function terminal_userpromise_resolved(u) -{ - - var that = this.that; - if (u.Active.length > 0) - { - var tmp; - var username = '"' + u.Active[0].Domain + '\\' + u.Active[0].Username + '"'; - - - if (require('win-virtual-terminal').supported) - { - // ConPTY PseudoTerminal - tmp = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [this.cols, this.rows] } }); - } - else - { - // Legacy Terminal - tmp = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-terminal', script: getJSModule('win-terminal') }], launch: { module: 'win-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [this.cols, this.rows] } }); - } - that.httprequest._dispatcher = tmp; - that.httprequest._dispatcher.connectionPromise = that.httprequest.connectionPromise; - that.httprequest._dispatcher.on('connection', terminal_user_onconnection); - that.httprequest._dispatcher.on('~', terminal_onfinalized); - } - this.that = null; - that = null; -} - -function terminal_promise_consent_resolved() -{ - this.httprequest.connectionPromise = new promise(promise_init); - this.httprequest.connectionPromise.ws = this.that; - - // Start Terminal - if (process.platform == 'win32') - { - try - { - var cols = 80, rows = 25; - if (this.httprequest.xoptions) - { - if (this.httprequest.xoptions.rows) { rows = this.httprequest.xoptions.rows; } - if (this.httprequest.xoptions.cols) { cols = this.httprequest.xoptions.cols; } - } - - if ((this.httprequest.protocol == 1) || (this.httprequest.protocol == 6)) - { - // Admin Terminal - if (require('win-virtual-terminal').supported) - { - // ConPTY PseudoTerminal - // this.httprequest._term = require('win-virtual-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](80, 25); - - // The above line is commented out, because there is a bug with ClosePseudoConsole() API, so this is the workaround - this.httprequest._dispatcher = require('win-dispatcher').dispatch({ modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } }); - this.httprequest._dispatcher.httprequest = this.httprequest; - this.httprequest._dispatcher.on('connection', terminal_onconnection); - this.httprequest._dispatcher.on('~', terminal_onfinalized); - } - else - { - // Legacy Terminal - this.httprequest.connectionPromise._res(require('win-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](cols, rows)); - } - } - else - { - // Logged in user - var userPromise = require('user-sessions').enumerateUsers(); - userPromise.that = this; - userPromise.cols = cols; - userPromise.rows = rows; - userPromise.then(terminal_userpromise_resolved); - } - } catch (ex) - { - this.httprequest.connectionPromise._rej('Failed to start remote terminal session, ' + ex.toString()); - } - } - else - { - try - { - var bash = fs.existsSync('/bin/bash') ? '/bin/bash' : false; - var sh = fs.existsSync('/bin/sh') ? '/bin/sh' : false; - var login = process.platform == 'linux' ? '/bin/login' : '/usr/bin/login'; - - var env = { HISTCONTROL: 'ignoreboth' }; - if (process.env['LANG']) { env['LANG'] = process.env['LANG']; } - if (process.env['PATH']) { env['PATH'] = process.env['PATH']; } - if (this.httprequest.xoptions) - { - if (this.httprequest.xoptions.rows) { env.LINES = ('' + this.httprequest.xoptions.rows); } - if (this.httprequest.xoptions.cols) { env.COLUMNS = ('' + this.httprequest.xoptions.cols); } - } - var options = { type: childProcess.SpawnTypes.TERM, uid: (this.httprequest.protocol == 8) ? require('user-sessions').consoleUid() : null, env: env }; - if (this.httprequest.xoptions && this.httprequest.xoptions.requireLogin) - { - if (!require('fs').existsSync(login)) { throw ('Unable to spawn login process'); } - this.httprequest.connectionPromise._res(childProcess.execFile(login, ['login'], options)); // Start login shell - } - else if (bash) - { - var p = childProcess.execFile(bash, ['bash'], options); // Start bash - // Spaces at the beginning of lines are needed to hide commands from the command history - if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) - { - if (obj.serverInfo.termlaunchcommand[process.platform] != '') { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); } - } else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); } - this.httprequest.connectionPromise._res(p); - } - else if (sh) - { - var p = childProcess.execFile(sh, ['sh'], options); // Start sh - // Spaces at the beginning of lines are needed to hide commands from the command history - if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) - { - if (obj.serverInfo.termlaunchcommand[process.platform] != '') { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); } - } else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); } - this.httprequest.connectionPromise._res(p); - } - else - { - this.httprequest.connectionPromise._rej('Failed to start remote terminal session, no shell found'); - } - } catch (ex) - { - this.httprequest.connectionPromise._rej('Failed to start remote terminal session, ' + ex.toString()); - } - } - - this.httprequest.connectionPromise.then(terminal_promise_connection_resolved, terminal_promise_connection_rejected); - this.that = null; - this.httprequest = null; -} -function tunnel_kvm_end() -{ - --this.desktop.kvm.connectionCount; - - // Remove ourself from the list of remote desktop session - var i = this.desktop.kvm.tunnels.indexOf(this); - if (i >= 0) { this.desktop.kvm.tunnels.splice(i, 1); } - - // Send a metadata update to all desktop sessions - var users = {}; - if (this.httprequest.desktop.kvm.tunnels != null) - { - for (var i in this.httprequest.desktop.kvm.tunnels) - { - try - { - var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest.desktop.kvm.tunnels[i].httprequest); - if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } - } catch (ex) { sendConsoleText(ex); } - } - for (var i in this.httprequest.desktop.kvm.tunnels) - { - try { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); } catch (ex) { } - } - tunnelUserCount.desktop = users; - try { mesh.SendCommand({ action: 'sessions', type: 'kvm', value: users }); } catch (ex) { } - broadcastSessionsToRegisteredApps(); - } - - // Unpipe the web socket - try - { - this.unpipe(this.httprequest.desktop.kvm); - this.httprequest.desktop.kvm.unpipe(this); - } catch (ex) { } - - // Unpipe the WebRTC channel if needed (This will also be done when the WebRTC channel ends). - if (this.rtcchannel) - { - try - { - this.rtcchannel.unpipe(this.httprequest.desktop.kvm); - this.httprequest.desktop.kvm.unpipe(this.rtcchannel); - } - catch (ex) { } - } - - // Place wallpaper back if needed - // TODO - - if (this.desktop.kvm.connectionCount == 0) - { - // Display a toast message. This may not be supported on all platforms. - // try { require('toaster').Toast('MeshCentral', 'Remote Desktop Control Ended.'); } catch (ex) { } - - this.httprequest.desktop.kvm.end(); - if (this.httprequest.desktop.kvm.connectionBar) - { - this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); - this.httprequest.desktop.kvm.connectionBar.close(); - this.httprequest.desktop.kvm.connectionBar = null; - } - } else - { - for (var i in this.httprequest.desktop.kvm.users) - { - if ((this.httprequest.desktop.kvm.users[i] == this.httprequest.username) && this.httprequest.desktop.kvm.connectionBar) - { - for (var j in this.httprequest.desktop.kvm.rusers) { if (this.httprequest.desktop.kvm.rusers[j] == this.httprequest.realname) { this.httprequest.desktop.kvm.rusers.splice(j, 1); break; } } - this.httprequest.desktop.kvm.users.splice(i, 1); - this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); - this.httprequest.desktop.kvm.connectionBar.close(); - this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options); - this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest; - this.httprequest.desktop.kvm.connectionBar.on('close', function () - { - MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); - for (var i in this.httprequest.desktop.kvm._pipedStreams) - { - this.httprequest.desktop.kvm._pipedStreams[i].end(); - } - this.httprequest.desktop.kvm.end(); - }); - break; - } - } - } - - if(this.httprequest.desktop.kvm.connectionBar) - { - console.info1('Setting ConnectionBar request to NULL'); - this.httprequest.desktop.kvm.connectionBar.httprequest = null; - } - - this.httprequest = null; - this.desktop.tunnel = null; -} - -function kvm_tunnel_consentpromise_closehandler() -{ - if (this._consentpromise && this._consentpromise.close) { this._consentpromise.close(); } -} - -function kvm_consent_ok(ws) { - // User Consent Prompt is not required because no user is present - if (ws.httprequest.consent && (ws.httprequest.consent & 1)){ - // User Notifications is required - MeshServerLogEx(35, null, "Started remote desktop with toast notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest); - var notifyMessage = currentTranslation['desktopNotify'].replace('{0}', ws.httprequest.realname); - var notifyTitle = "MeshCentral"; - if (ws.httprequest.soptions != null) { - if (ws.httprequest.soptions.notifyTitle != null) { notifyTitle = ws.httprequest.soptions.notifyTitle; } - if (ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = ws.httprequest.soptions.notifyMsgDesktop.replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); } - } - try { require('toaster').Toast(notifyTitle, notifyMessage, ws.tsid); } catch (ex) { } - } else { - MeshServerLogEx(36, null, "Started remote desktop without notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest); - } - if (ws.httprequest.consent && (ws.httprequest.consent & 0x40)) { - // Connection Bar is required - if (ws.httprequest.desktop.kvm.connectionBar) { - ws.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); - ws.httprequest.desktop.kvm.connectionBar.close(); - } - try { - ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(ws.httprequest.privacybartext.replace('{0}', ws.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', ws.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options); - MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + ws.httprequest.remoteaddr + ")", ws.httprequest); - } catch (ex) { - MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + ws.httprequest.remoteaddr + ")", ws.httprequest); - } - if (ws.httprequest.desktop.kvm.connectionBar) { - ws.httprequest.desktop.kvm.connectionBar.state = { - userid: ws.httprequest.userid, - xuserid: ws.httprequest.xuserid, - username: ws.httprequest.username, - sessionid: ws.httprequest.sessionid, - remoteaddr: ws.httprequest.remoteaddr, - guestname: ws.httprequest.guestname, - desktop: ws.httprequest.desktop - }; - ws.httprequest.desktop.kvm.connectionBar.on('close', function () { - console.info1('Connection Bar Forcefully closed'); - MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.state.remoteaddr + ")", this.state); - for (var i in this.state.desktop.kvm._pipedStreams) { - this.state.desktop.kvm._pipedStreams[i].end(); - } - this.state.desktop.kvm.end(); - }); - } - } - ws.httprequest.desktop.kvm.pipe(ws, { dataTypeSkip: 1 }); - if (ws.httprequest.autolock) { - destopLockHelper_pipe(ws.httprequest); - } -} - -function kvm_consent_ask(ws){ - // Send a console message back using the console channel, "\n" is supported. - ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); - var consentMessage = currentTranslation['desktopConsent'].replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); - var consentTitle = 'MeshCentral'; - if (ws.httprequest.soptions != null) { - if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; } - if (ws.httprequest.soptions.consentMsgDesktop != null) { consentMessage = ws.httprequest.soptions.consentMsgDesktop.replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); } - } - var pr; - if (process.platform == 'win32') { - var enhanced = false; - if (ws.httprequest.oldStyle === false) { - try { require('win-userconsent'); enhanced = true; } catch (ex) { } - } - if (enhanced) { - var ipr = server_getUserImage(ws.httprequest.userid); - ipr.consentTitle = consentTitle; - ipr.consentMessage = consentMessage; - ipr.consentTimeout = ws.httprequest.consentTimeout; - ipr.consentAutoAccept = ws.httprequest.consentAutoAccept; - ipr.tsid = ws.tsid; - ipr.username = ws.httprequest.realname; - ipr.translation = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; - pr = ipr.then(function (img) { - this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: this.consentTimeout * 1000, timeoutAutoAccept: this.consentAutoAccept, translations: this.translation, background: color_options.background, foreground: color_options.foreground }); - this.__childPromise.close = this.consent.close.bind(this.consent); - return (this.consent); - }); - } else { - pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null, ws.tsid); - } - } else { - pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null, ws.tsid); - } - pr.ws = ws; - ws.pause(); - ws._consentpromise = pr; - ws.prependOnceListener('end', kvm_tunnel_consentpromise_closehandler); - pr.then(kvm_consentpromise_resolved, kvm_consentpromise_rejected); -} - -function kvm_consentpromise_rejected(e) -{ - if (this.ws) { - if(this.ws.httprequest){ // User Consent Denied - MeshServerLogEx(34, null, "Failed to start remote desktop after local user rejected (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - } else { } // Connection was closed server side, maybe log some messages somewhere? - this.ws._consentpromise = null; - this.ws.end(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); - this.ws = null; - } else { } // no websocket, maybe log some messages somewhere? -} -function kvm_consentpromise_resolved(always) -{ - if (always && process.platform=='win32') { server_set_consentTimer(this.ws.httprequest.userid); } - - // Success - this.ws._consentpromise = null; - MeshServerLogEx(30, null, "Starting remote desktop after local user accepted (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - this.ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: null, msgid: 0 })); - if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 1)) - { - // User Notifications is required - var notifyMessage = currentTranslation['desktopNotify'].replace('{0}', this.ws.httprequest.realname); - var notifyTitle = "MeshCentral"; - if (this.ws.httprequest.soptions != null) - { - if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } - if (this.ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgDesktop.replace('{0}', this.ws.httprequest.realname).replace('{1}', this.ws.httprequest.username); } - } - try { require('toaster').Toast(notifyTitle, notifyMessage, tsid); } catch (ex) { } - } - if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 0x40)) - { - // Connection Bar is required - if (this.ws.httprequest.desktop.kvm.connectionBar) - { - this.ws.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); - this.ws.httprequest.desktop.kvm.connectionBar.close(); - } - try - { - this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options); - MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - } catch (ex) - { - if (process.platform != 'darwin') - { - MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or Not Supported (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - } - } - try { - if (this.ws.httprequest.desktop.kvm.connectionBar) { - this.ws.httprequest.desktop.kvm.connectionBar.httprequest = this.ws.httprequest; - this.ws.httprequest.desktop.kvm.connectionBar.on('close', function () { - MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); - for (var i in this.httprequest.desktop.kvm._pipedStreams) { - this.httprequest.desktop.kvm._pipedStreams[i].end(); - } - this.httprequest.desktop.kvm.end(); - }); - } - } - catch (ex) - { - if (process.platform != 'darwin') - { - MeshServerLogEx(32, null, "Failed2(" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - } - } - } - this.ws.httprequest.desktop.kvm.pipe(this.ws, { dataTypeSkip: 1 }); - if (this.ws.httprequest.autolock) - { - destopLockHelper_pipe(this.ws.httprequest); - } - this.ws.resume(); - this.ws = null; -} - -function files_consent_ok(ws){ - // User Consent Prompt is not required - if (ws.httprequest.consent && (ws.httprequest.consent & 4)) { - // User Notifications is required - MeshServerLogEx(42, null, "Started remote files with toast notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest); - var notifyMessage = currentTranslation['fileNotify'].replace('{0}', ws.httprequest.realname); - var notifyTitle = "MeshCentral"; - if (ws.httprequest.soptions != null) { - if (ws.httprequest.soptions.notifyTitle != null) { notifyTitle = ws.httprequest.soptions.notifyTitle; } - if (ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = ws.httprequest.soptions.notifyMsgFiles.replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); } - } - try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } - } else { - MeshServerLogEx(43, null, "Started remote files without notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest); - } - ws.resume(); -} - -function files_consent_ask(ws){ - // Send a console message back using the console channel, "\n" is supported. - ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); - var consentMessage = currentTranslation['fileConsent'].replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); - var consentTitle = 'MeshCentral'; - - if (ws.httprequest.soptions != null) { - if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; } - if (ws.httprequest.soptions.consentMsgFiles != null) { consentMessage = ws.httprequest.soptions.consentMsgFiles.replace('{0}', ws.httprequest.realname).replace('{1}', ws.httprequest.username); } - } - var pr; - if (process.platform == 'win32') { - var enhanced = false; - if (ws.httprequest.oldStyle === false) { - try { require('win-userconsent'); enhanced = true; } catch (ex) { } - } - if (enhanced) { - var ipr = server_getUserImage(ws.httprequest.userid); - ipr.consentTitle = consentTitle; - ipr.consentMessage = consentMessage; - ipr.consentTimeout = ws.httprequest.consentTimeout; - ipr.consentAutoAccept = ws.httprequest.consentAutoAccept; - ipr.username = ws.httprequest.realname; - ipr.tsid = ws.tsid; - ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; - pr = ipr.then(function (img) { - this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: this.consentTimeout * 1000, timeoutAutoAccept: this.consentAutoAccept, translations: this.translations, background: color_options.background, foreground: color_options.foreground }); - this.__childPromise.close = this.consent.close.bind(this.consent); - return (this.consent); - }); - } else { - pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null); - } - } else { - pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null); - } - pr.ws = ws; - ws.pause(); - ws._consentpromise = pr; - ws.prependOnceListener('end', files_tunnel_endhandler); - pr.then(files_consentpromise_resolved, files_consentpromise_rejected); -} - -function files_consentpromise_resolved(always) -{ - if (always && process.platform == 'win32') { server_set_consentTimer(this.ws.httprequest.userid); } - - // Success - this.ws._consentpromise = null; - MeshServerLogEx(40, null, "Starting remote files after local user accepted (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - this.ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: null })); - if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 4)) - { - // User Notifications is required - var notifyMessage = currentTranslation['fileNotify'].replace('{0}', this.ws.httprequest.realname); - var notifyTitle = "MeshCentral"; - if (this.ws.httprequest.soptions != null) - { - if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } - if (this.ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgFiles.replace('{0}', this.ws.httprequest.realname).replace('{1}', this.ws.httprequest.username); } - } - try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } - } - this.ws.resume(); - this.ws = null; -} -function files_consentpromise_rejected(e) -{ - if (this.ws) { - if(this.ws.httprequest){ // User Consent Denied - MeshServerLogEx(41, null, "Failed to start remote files after local user rejected (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); - } else { } // Connection was closed server side, maybe log some messages somewhere? - this.ws._consentpromise = null; - this.ws.end(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); - this.ws = null; - } else { } // no websocket, maybe log some messages somewhere? -} -function files_tunnel_endhandler() -{ - if (this._consentpromise && this._consentpromise.close) { this._consentpromise.close(); } -} - -function onTunnelData(data) -{ +function onTunnelData(data) { + //console.log("OnTunnelData"); //sendConsoleText('OnTunnelData, ' + data.length + ', ' + typeof data + ', ' + data); // If this is upload data, save it to file @@ -2976,12 +2074,8 @@ function onTunnelData(data) if (this.httprequest.state == 0) { // Check if this is a relay connection - if ((data == 'c') || (data == 'cr')) { - this.httprequest.state = 1; - //sendConsoleText("Tunnel #" + this.httprequest.index + " now active", this.httprequest.sessionid); - } - } - else { + if ((data == 'c') || (data == 'cr')) { this.httprequest.state = 1; /*sendConsoleText("Tunnel #" + this.httprequest.index + " now active", this.httprequest.sessionid);*/ } + } else { // Handle tunnel data if (this.httprequest.protocol == 0) { // 1 = Terminal (admin), 2 = Desktop, 5 = Files, 6 = PowerShell (admin), 7 = Plugin Data Exchange, 8 = Terminal (user), 9 = PowerShell (user), 10 = FileTransfer // Take a look at the protocol @@ -3017,8 +2111,7 @@ function onTunnelData(data) // // Check user access rights for terminal - if (((this.httprequest.rights & MESHRIGHT_REMOTECONTROL) == 0) || ((this.httprequest.rights != 0xFFFFFFFF) && ((this.httprequest.rights & MESHRIGHT_NOTERMINAL) != 0))) - { + if (((this.httprequest.rights & MESHRIGHT_REMOTECONTROL) == 0) || ((this.httprequest.rights != 0xFFFFFFFF) && ((this.httprequest.rights & MESHRIGHT_NOTERMINAL) != 0))) { // Disengage this tunnel, user does not have the rights to do this!! this.httprequest.protocol = 999999; this.httprequest.s.end(); @@ -3028,14 +2121,7 @@ function onTunnelData(data) this.descriptorMetadata = "Remote Terminal"; - // Look for a TSID - var tsid = null; - if ((this.httprequest.xoptions != null) && (typeof this.httprequest.xoptions.tsid == 'number')) { tsid = this.httprequest.xoptions.tsid; } - require('MeshAgent')._tsid = tsid; - this.tsid = tsid; - - if (process.platform == 'win32') - { + if (process.platform == 'win32') { if (!require('win-terminal').PowerShellCapable() && (this.httprequest.protocol == 6 || this.httprequest.protocol == 9)) { this.httprequest.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: 'PowerShell is not supported on this version of windows', msgid: 1 })); this.httprequest.s.end(); @@ -3044,41 +2130,254 @@ function onTunnelData(data) } var prom = require('promise'); - this.httprequest.tpromise = new prom(promise_init); + this.httprequest.tpromise = new prom(function (res, rej) { this._res = res; this._rej = rej; }); this.httprequest.tpromise.that = this; this.httprequest.tpromise.httprequest = this.httprequest; - this.end = terminal_end; + + this.end = function () { + if (this.httprequest.tpromise._consent) { this.httprequest.tpromise._consent.close(); } + if (this.httprequest.connectionPromise) { this.httprequest.connectionPromise._rej('Closed'); } + + // Remove the terminal session to the count to update the server + if (this.httprequest.userid != null) { + var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest); + if (tunnelUserCount.terminal[userid] != null) { tunnelUserCount.terminal[userid]--; if (tunnelUserCount.terminal[userid] <= 0) { delete tunnelUserCount.terminal[userid]; } } + try { mesh.SendCommand({ action: 'sessions', type: 'terminal', value: tunnelUserCount.terminal }); } catch (ex) { } + broadcastSessionsToRegisteredApps(); + } + + if (process.platform == 'win32') { + // Unpipe the web socket + this.unpipe(this.httprequest._term); + if (this.httprequest._term) { this.httprequest._term.unpipe(this); } + + // Unpipe the WebRTC channel if needed (This will also be done when the WebRTC channel ends). + if (this.rtcchannel) { + this.rtcchannel.unpipe(this.httprequest._term); + if (this.httprequest._term) { this.httprequest._term.unpipe(this.rtcchannel); } + } + + // Clean up + if (this.httprequest._term) { this.httprequest._term.end(); } + this.httprequest._term = null; + } + }; // Perform User-Consent if needed. if (this.httprequest.consent && (this.httprequest.consent & 16)) { - // User asked for consent so now we check if we can auto accept if no user is present/loggedin - if (this.httprequest.consentAutoAcceptIfNoUser) { - var p = require('user-sessions').enumerateUsers(); - p.sessionid = this.httprequest.sessionid; - p.ws = this; - p.then(function (u) { - var v = []; - for (var i in u) { - if (u[i].State == 'Active') { v.push({ tsid: i, type: u[i].StationName, user: u[i].Username, domain: u[i].Domain }); } - } - if (v.length == 0) { // No user is present, auto accept - this.ws.httprequest.tpromise._res(); - } else { - // User is present so we still need consent - terminal_consent_ask(this.ws); - } - }); - } else { - terminal_consent_ask(this); + this.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); + var consentMessage = currentTranslation['terminalConsent'].replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); + var consentTitle = 'MeshCentral'; + + if (this.httprequest.soptions != null) { + if (this.httprequest.soptions.consentTitle != null) { consentTitle = this.httprequest.soptions.consentTitle; } + if (this.httprequest.soptions.consentMsgTerminal != null) { consentMessage = this.httprequest.soptions.consentMsgTerminal.replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); } } - } else { + if (process.platform == 'win32') { + var enhanced = false; + try { require('win-userconsent'); enhanced = true; } catch (ex) { } + if (enhanced) { + var ipr = server_getUserImage(this.httprequest.userid); + ipr.consentTitle = consentTitle; + ipr.consentMessage = consentMessage; + ipr.consentTimeout = this.httprequest.consentTimeout; + ipr.consentAutoAccept = this.httprequest.consentAutoAccept; + ipr.username = this.httprequest.realname; + ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; + this.httprequest.tpromise._consent = ipr.then(function (img) { + this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: this.consentTimeout * 1000, timeoutAutoAccept: this.consentAutoAccept, translations: this.translations, background: color_options.background, foreground: color_options.foreground }); + this.__childPromise.close = this.consent.close.bind(this.consent); + return (this.consent); + }); + } else { + this.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, this.consentTimeout); + } + } else { + this.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, this.consentTimeout); + } + this.httprequest.tpromise._consent.retPromise = this.httprequest.tpromise; + this.httprequest.tpromise._consent.then( + function (always) { + if (always) { server_set_consentTimer(this.retPromise.httprequest.userid); } + + // Success + MeshServerLogEx(27, null, "Local user accepted remote terminal request (" + this.retPromise.httprequest.remoteaddr + ")", this.retPromise.that.httprequest); + this.retPromise.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: null, msgid: 0 })); + this.retPromise._consent = null; + this.retPromise._res(); + }, + function (e) { + // Denied + MeshServerLogEx(28, null, "Local user rejected remote terminal request (" + this.retPromise.that.httprequest.remoteaddr + ")", this.retPromise.that.httprequest); + this.retPromise.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); + this.retPromise._rej(e.toString()); + }); + } + else { // User-Consent is not required, so just resolve this promise this.httprequest.tpromise._res(); } - this.httprequest.tpromise.then(terminal_promise_consent_resolved, terminal_promise_consent_rejected); + + + this.httprequest.tpromise.then( + function () { + this.httprequest.connectionPromise = new prom(function (res, rej) { this._res = res; this._rej = rej; }); + this.httprequest.connectionPromise.ws = this.that; + + // Start Terminal + if (process.platform == 'win32') { + try { + var cols = 80, rows = 25; + if (this.httprequest.xoptions) { + if (this.httprequest.xoptions.rows) { rows = this.httprequest.xoptions.rows; } + if (this.httprequest.xoptions.cols) { cols = this.httprequest.xoptions.cols; } + } + + if ((this.httprequest.protocol == 1) || (this.httprequest.protocol == 6)) { + // Admin Terminal + if (require('win-virtual-terminal').supported) { + // ConPTY PseudoTerminal + // this.httprequest._term = require('win-virtual-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](80, 25); + + // The above line is commented out, because there is a bug with ClosePseudoConsole() API, so this is the workaround + this.httprequest._dispatcher = require('win-dispatcher').dispatch({ modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } }); + this.httprequest._dispatcher.httprequest = this.httprequest; + this.httprequest._dispatcher.on('connection', function (c) { if (this.httprequest.connectionPromise.completed) { c.end(); } else { this.httprequest.connectionPromise._res(c); } }); + } + else { + // Legacy Terminal + this.httprequest.connectionPromise._res(require('win-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](cols, rows)); + } + } + else { + // Logged in user + var userPromise = require('user-sessions').enumerateUsers(); + userPromise.that = this; + userPromise.then(function (u) { + var that = this.that; + if (u.Active.length > 0) { + var username = '"' + u.Active[0].Domain + '\\' + u.Active[0].Username + '"'; + //sendConsoleText('Terminal: ' + username); + if (require('win-virtual-terminal').supported) { + // ConPTY PseudoTerminal + that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } }); + } + else { + // Legacy Terminal + that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-terminal', script: getJSModule('win-terminal') }], launch: { module: 'win-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } }); + } + that.httprequest._dispatcher.ws = that; + that.httprequest._dispatcher.on('connection', function (c) { if (this.ws.httprequest.connectionPromise.completed) { c.end(); } else { this.ws.httprequest.connectionPromise._res(c); } }); + } + }); + } + } catch (ex) { + this.httprequest.connectionPromise._rej('Failed to start remote terminal session, ' + ex.toString()); + } + } + else { + try { + var bash = fs.existsSync('/bin/bash') ? '/bin/bash' : false; + var sh = fs.existsSync('/bin/sh') ? '/bin/sh' : false; + var login = process.platform == 'linux' ? '/bin/login' : '/usr/bin/login'; + + var env = { HISTCONTROL: 'ignoreboth' }; + if (process.env['LANG']) { env['LANG'] = process.env['LANG']; } + if (process.env['PATH']) { env['PATH'] = process.env['PATH']; } + if (this.httprequest.xoptions) { + if (this.httprequest.xoptions.rows) { env.LINES = ('' + this.httprequest.xoptions.rows); } + if (this.httprequest.xoptions.cols) { env.COLUMNS = ('' + this.httprequest.xoptions.cols); } + } + var options = { type: childProcess.SpawnTypes.TERM, uid: (this.httprequest.protocol == 8) ? require('user-sessions').consoleUid() : null, env: env }; + if (this.httprequest.xoptions && this.httprequest.xoptions.requireLogin) { + if (!require('fs').existsSync(login)) { throw ('Unable to spawn login process'); } + this.httprequest.connectionPromise._res(childProcess.execFile(login, ['login'], options)); // Start login shell + } + else if (bash) { + var p = childProcess.execFile(bash, ['bash'], options); // Start bash + // Spaces at the beginning of lines are needed to hide commands from the command history + if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) { + if (obj.serverInfo.termlaunchcommand[process.platform] != '') { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); } + } else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); } + this.httprequest.connectionPromise._res(p); + } + else if (sh) { + var p = childProcess.execFile(sh, ['sh'], options); // Start sh + // Spaces at the beginning of lines are needed to hide commands from the command history + if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) { + if (obj.serverInfo.termlaunchcommand[process.platform] != '') { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); } + } else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); } + this.httprequest.connectionPromise._res(p); + } + else { + this.httprequest.connectionPromise._rej('Failed to start remote terminal session, no shell found'); + } + } catch (ex) { + this.httprequest.connectionPromise._rej('Failed to start remote terminal session, ' + ex.toString()); + } + } + + this.httprequest.connectionPromise.then( + function (term) { + // SUCCESS + var stdoutstream; + var stdinstream; + if (process.platform == 'win32') { + this.ws.httprequest._term = term; + this.ws.httprequest._term.tunnel = this.ws; + stdoutstream = stdinstream = term; + } + else { + term.descriptorMetadata = 'Remote Terminal'; + this.ws.httprequest.process = term; + this.ws.httprequest.process.tunnel = this.ws; + term.stderr.stdout = term.stdout; + term.stderr.on('data', function (c) { this.stdout.write(c); }); + stdoutstream = term.stdout; + stdinstream = term.stdin; + this.ws.prependListener('end', function () { this.httprequest.process.kill(); }); + term.prependListener('exit', function () { this.tunnel.end(); }); + } + + this.ws.removeAllListeners('data'); + this.ws.on('data', onTunnelControlData); + + stdoutstream.pipe(this.ws, { dataTypeSkip: 1 }); // 0 = Binary, 1 = Text. + this.ws.pipe(stdinstream, { dataTypeSkip: 1, end: false }); // 0 = Binary, 1 = Text. + + // Add the terminal session to the count to update the server + if (this.ws.httprequest.userid != null) { + var userid = getUserIdAndGuestNameFromHttpRequest(this.ws.httprequest); + if (tunnelUserCount.terminal[userid] == null) { tunnelUserCount.terminal[userid] = 1; } else { tunnelUserCount.terminal[userid]++; } + try { mesh.SendCommand({ action: 'sessions', type: 'terminal', value: tunnelUserCount.terminal }); } catch (ex) { } + broadcastSessionsToRegisteredApps(); + } + + // Toast Notification, if required + if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 2)) { + // User Notifications is required + var notifyMessage = currentTranslation['terminalNotify'].replace('{0}', this.ws.httprequest.username); + var notifyTitle = "MeshCentral"; + if (this.ws.httprequest.soptions != null) { + if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } + if (this.ws.httprequest.soptions.notifyMsgTerminal != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgTerminal.replace('{0}', this.ws.httprequest.realname).replace('{1}', this.ws.httprequest.username); } + } + try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } + } + }, + function (e) { + // FAILED to connect terminal + this.ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); + this.ws.end(); + }); + }, + function (e) { + // DO NOT start terminal + this.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); + this.that.end(); + }); } - else if (this.httprequest.protocol == 2) - { + else if (this.httprequest.protocol == 2) { // // Remote Desktop // @@ -3098,22 +2397,7 @@ function onTunnelData(data) var tsid = null; if ((this.httprequest.xoptions != null) && (typeof this.httprequest.xoptions.tsid == 'number')) { tsid = this.httprequest.xoptions.tsid; } require('MeshAgent')._tsid = tsid; - this.tsid = tsid; - // If MacOS, Wake up device with caffeinate - if(process.platform == 'darwin'){ - try { - var options = {}; - try { options.uid = require('user-sessions').consoleUid(); } catch (ex) { } - options.type = require('child_process').SpawnTypes.TERM; - var replydata = ""; - var cmdchild = require('child_process').execFile('/usr/bin/caffeinate', ['caffeinate', '-u', '-t', '10'], options); - cmdchild.descriptorMetadata = 'UserCommandsShell'; - cmdchild.stdout.on('data', function (c) { replydata += c.toString(); }); - cmdchild.stderr.on('data', function (c) { replydata + c.toString(); }); - cmdchild.on('exit', function () { delete cmdchild; }); - } catch(err) { } - } // Remote desktop using native pipes this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(tsid), tunnel: this }; this.httprequest.desktop.kvm.parent = this.httprequest.desktop; @@ -3125,17 +2409,14 @@ function onTunnelData(data) // Send a metadata update to all desktop sessions var users = {}; - if (this.httprequest.desktop.kvm.tunnels != null) - { - for (var i in this.httprequest.desktop.kvm.tunnels) - { + if (this.httprequest.desktop.kvm.tunnels != null) { + for (var i in this.httprequest.desktop.kvm.tunnels) { try { var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest.desktop.kvm.tunnels[i].httprequest); if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } } catch (ex) { sendConsoleText(ex); } } - for (var i in this.httprequest.desktop.kvm.tunnels) - { + for (var i in this.httprequest.desktop.kvm.tunnels) { try { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); } catch (ex) { } } tunnelUserCount.desktop = users; @@ -3143,8 +2424,79 @@ function onTunnelData(data) broadcastSessionsToRegisteredApps(); } - this.end = tunnel_kvm_end; + this.end = function () { + --this.desktop.kvm.connectionCount; + // Remove ourself from the list of remote desktop session + var i = this.desktop.kvm.tunnels.indexOf(this); + if (i >= 0) { this.desktop.kvm.tunnels.splice(i, 1); } + + // Send a metadata update to all desktop sessions + var users = {}; + if (this.httprequest.desktop.kvm.tunnels != null) { + for (var i in this.httprequest.desktop.kvm.tunnels) { + try { + var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest.desktop.kvm.tunnels[i].httprequest); + if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } + } catch (ex) { sendConsoleText(ex); } + } + for (var i in this.httprequest.desktop.kvm.tunnels) { + try { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); } catch (ex) { } + } + tunnelUserCount.desktop = users; + try { mesh.SendCommand({ action: 'sessions', type: 'kvm', value: users }); } catch (ex) { } + broadcastSessionsToRegisteredApps(); + } + + // Unpipe the web socket + try { + this.unpipe(this.httprequest.desktop.kvm); + this.httprequest.desktop.kvm.unpipe(this); + } catch (ex) { } + + // Unpipe the WebRTC channel if needed (This will also be done when the WebRTC channel ends). + if (this.rtcchannel) { + try { + this.rtcchannel.unpipe(this.httprequest.desktop.kvm); + this.httprequest.desktop.kvm.unpipe(this.rtcchannel); + } + catch (ex) { } + } + + // Place wallpaper back if needed + // TODO + + if (this.desktop.kvm.connectionCount == 0) { + // Display a toast message. This may not be supported on all platforms. + // try { require('toaster').Toast('MeshCentral', 'Remote Desktop Control Ended.'); } catch (ex) { } + + this.httprequest.desktop.kvm.end(); + if (this.httprequest.desktop.kvm.connectionBar) { + this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); + this.httprequest.desktop.kvm.connectionBar.close(); + this.httprequest.desktop.kvm.connectionBar = null; + } + } else { + for (var i in this.httprequest.desktop.kvm.users) { + if ((this.httprequest.desktop.kvm.users[i] == this.httprequest.username) && this.httprequest.desktop.kvm.connectionBar) { + for (var j in this.httprequest.desktop.kvm.rusers) { if (this.httprequest.desktop.kvm.rusers[j] == this.httprequest.realname) { this.httprequest.desktop.kvm.rusers.splice(j, 1); break; } } + this.httprequest.desktop.kvm.users.splice(i, 1); + this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); + this.httprequest.desktop.kvm.connectionBar.close(); + this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid, color_options); + this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest; + this.httprequest.desktop.kvm.connectionBar.on('close', function () { + MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); + for (var i in this.httprequest.desktop.kvm._pipedStreams) { + this.httprequest.desktop.kvm._pipedStreams[i].end(); + } + this.httprequest.desktop.kvm.end(); + }); + break; + } + } + } + }; if (this.httprequest.desktop.kvm.hasOwnProperty('connectionCount')) { this.httprequest.desktop.kvm.connectionCount++; this.httprequest.desktop.kvm.rusers.push(this.httprequest.realname); @@ -3157,13 +2509,10 @@ function onTunnelData(data) this.httprequest.desktop.kvm.users = [this.httprequest.username]; } - if ((this.httprequest.desktopviewonly != true) && ((this.httprequest.rights == 0xFFFFFFFF) || (((this.httprequest.rights & MESHRIGHT_REMOTECONTROL) != 0) && ((this.httprequest.rights & MESHRIGHT_REMOTEVIEW) == 0)))) - { + if ((this.httprequest.desktopviewonly != true) && ((this.httprequest.rights == 0xFFFFFFFF) || (((this.httprequest.rights & MESHRIGHT_REMOTECONTROL) != 0) && ((this.httprequest.rights & MESHRIGHT_REMOTEVIEW) == 0)))) { // If we have remote control rights, pipe the KVM input this.pipe(this.httprequest.desktop.kvm, { dataTypeSkip: 1, end: false }); // 0 = Binary, 1 = Text. Pipe the Browser --> KVM input. - } - else - { + } else { // We need to only pipe non-mouse & non-keyboard inputs. // sendConsoleText('Warning: No Remote Desktop Input Rights.'); // TODO!!! @@ -3171,37 +2520,152 @@ function onTunnelData(data) // Perform notification if needed. Toast messages may not be supported on all platforms. if (this.httprequest.consent && (this.httprequest.consent & 8)) { - - // User asked for consent but now we check if can auto accept if no user is present - if (this.httprequest.consentAutoAcceptIfNoUser) { - // Get list of users to check if we any actual users logged in, and if users logged in, we still need consent - var p = require('user-sessions').enumerateUsers(); - p.sessionid = this.httprequest.sessionid; - p.ws = this; - p.then(function (u) { - var v = []; - for (var i in u) { - if (u[i].State == 'Active') { v.push({ tsid: i, type: u[i].StationName, user: u[i].Username, domain: u[i].Domain }); } - } - if (v.length == 0) { // No user is present, auto accept - kvm_consent_ok(this.ws); - } else { - // User is present so we still need consent - kvm_consent_ask(this.ws); - } - }); - } else { - // User Consent Prompt is required - kvm_consent_ask(this); + // User Consent Prompt is required + // Send a console message back using the console channel, "\n" is supported. + this.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); + var consentMessage = currentTranslation['desktopConsent'].replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); + var consentTitle = 'MeshCentral'; + if (this.httprequest.soptions != null) { + if (this.httprequest.soptions.consentTitle != null) { consentTitle = this.httprequest.soptions.consentTitle; } + if (this.httprequest.soptions.consentMsgDesktop != null) { consentMessage = this.httprequest.soptions.consentMsgDesktop.replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); } } + var pr; + if (process.platform == 'win32') { + var enhanced = false; + try { require('win-userconsent'); enhanced = true; } catch (ex) { } + if (enhanced) { + var ipr = server_getUserImage(this.httprequest.userid); + ipr.consentTitle = consentTitle; + ipr.consentMessage = consentMessage; + ipr.consentTimeout = this.httprequest.consentTimeout; + ipr.consentAutoAccept = this.httprequest.consentAutoAccept; + ipr.tsid = tsid; + ipr.username = this.httprequest.realname; + ipr.translation = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; + pr = ipr.then(function (img) { + this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: this.consentTimeout * 1000, timeoutAutoAccept: this.consentAutoAccept, translations: this.translation, background: color_options.background, foreground: color_options.foreground }); + this.__childPromise.close = this.consent.close.bind(this.consent); + return (this.consent); + }); + } + else { + pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null, tsid); + } + } + else { + pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null, tsid); + } + pr.ws = this; + this.pause(); + this._consentpromise = pr; + this.prependOnceListener('end', function () { + if (this._consentpromise && this._consentpromise.close) { + this._consentpromise.close(); + } + }); + pr.then( + function (always) { + if (always) { server_set_consentTimer(this.ws.httprequest.userid); } + + // Success + this.ws._consentpromise = null; + MeshServerLogEx(30, null, "Starting remote desktop after local user accepted (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); + this.ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: null, msgid: 0 })); + if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 1)) { + // User Notifications is required + var notifyMessage = currentTranslation['desktopNotify'].replace('{0}', this.ws.httprequest.realname); + var notifyTitle = "MeshCentral"; + if (this.ws.httprequest.soptions != null) { + if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } + if (this.ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgDesktop.replace('{0}', this.ws.httprequest.realname).replace('{1}', this.ws.httprequest.username); } + } + try { require('toaster').Toast(notifyTitle, notifyMessage, tsid); } catch (ex) { } + } + if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 0x40)) { + // Connection Bar is required + if (this.ws.httprequest.desktop.kvm.connectionBar) { + this.ws.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); + this.ws.httprequest.desktop.kvm.connectionBar.close(); + } + try { + this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid, color_options); + MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); + } catch (ex) { + if (process.platform != 'darwin') { + MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or Not Supported (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); + } + } + if (this.ws.httprequest.desktop.kvm.connectionBar) { + this.ws.httprequest.desktop.kvm.connectionBar.httprequest = this.ws.httprequest; + this.ws.httprequest.desktop.kvm.connectionBar.on('close', function () { + MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); + for (var i in this.httprequest.desktop.kvm._pipedStreams) { + this.httprequest.desktop.kvm._pipedStreams[i].end(); + } + this.httprequest.desktop.kvm.end(); + }); + } + } + this.ws.httprequest.desktop.kvm.pipe(this.ws, { dataTypeSkip: 1 }); + if (this.ws.httprequest.autolock) { + destopLockHelper_pipe(this.ws.httprequest); + } + this.ws.resume(); + }, + function (e) { + // User Consent Denied/Failed + this.ws._consentpromise = null; + MeshServerLogEx(34, null, "Failed to start remote desktop after local user rejected (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); + this.ws.end(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); + }); } else { // User Consent Prompt is not required - kvm_consent_ok(this); + if (this.httprequest.consent && (this.httprequest.consent & 1)) { + // User Notifications is required + MeshServerLogEx(35, null, "Started remote desktop with toast notification (" + this.httprequest.remoteaddr + ")", this.httprequest); + var notifyMessage = currentTranslation['desktopNotify'].replace('{0}', this.httprequest.realname); + var notifyTitle = "MeshCentral"; + if (this.httprequest.soptions != null) { + if (this.httprequest.soptions.notifyTitle != null) { notifyTitle = this.httprequest.soptions.notifyTitle; } + if (this.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = this.httprequest.soptions.notifyMsgDesktop.replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); } + } + try { require('toaster').Toast(notifyTitle, notifyMessage, tsid); } catch (ex) { } + } else { + MeshServerLogEx(36, null, "Started remote desktop without notification (" + this.httprequest.remoteaddr + ")", this.httprequest); + } + if (this.httprequest.consent && (this.httprequest.consent & 0x40)) { + // Connection Bar is required + if (this.httprequest.desktop.kvm.connectionBar) { + this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); + this.httprequest.desktop.kvm.connectionBar.close(); + } + try { + this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid, color_options); + MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.httprequest.remoteaddr + ")", this.httprequest); + } catch (ex) { + MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + this.httprequest.remoteaddr + ")", this.httprequest); + } + if (this.httprequest.desktop.kvm.connectionBar) { + this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest; + this.httprequest.desktop.kvm.connectionBar.on('close', function () { + MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); + for (var i in this.httprequest.desktop.kvm._pipedStreams) { + this.httprequest.desktop.kvm._pipedStreams[i].end(); + } + this.httprequest.desktop.kvm.end(); + }); + } + } + this.httprequest.desktop.kvm.pipe(this, { dataTypeSkip: 1 }); + if (this.httprequest.autolock) { + destopLockHelper_pipe(this.httprequest); + } } this.removeAllListeners('data'); this.on('data', onTunnelControlData); //this.write('MeshCore KVM Hello!1'); + } else if (this.httprequest.protocol == 5) { // // Remote Files @@ -3218,12 +2682,6 @@ function onTunnelData(data) this.descriptorMetadata = "Remote Files"; - // Look for a TSID - var tsid = null; - if ((this.httprequest.xoptions != null) && (typeof this.httprequest.xoptions.tsid == 'number')) { tsid = this.httprequest.xoptions.tsid; } - require('MeshAgent')._tsid = tsid; - this.tsid = tsid; - // Add the files session to the count to update the server if (this.httprequest.userid != null) { var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest); @@ -3232,8 +2690,7 @@ function onTunnelData(data) broadcastSessionsToRegisteredApps(); } - this.end = function () - { + this.end = function () { // Remove the files session from the count to update the server if (this.httprequest.userid != null) { var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest); @@ -3244,33 +2701,87 @@ function onTunnelData(data) }; // Perform notification if needed. Toast messages may not be supported on all platforms. - if (this.httprequest.consent && (this.httprequest.consent & 32)) - { - // User asked for consent so now we check if we can auto accept if no user is present/loggedin - if (this.httprequest.consentAutoAcceptIfNoUser) { - var p = require('user-sessions').enumerateUsers(); - p.sessionid = this.httprequest.sessionid; - p.ws = this; - p.then(function (u) { - var v = []; - for (var i in u) { - if (u[i].State == 'Active') { v.push({ tsid: i, type: u[i].StationName, user: u[i].Username, domain: u[i].Domain }); } - } - if (v.length == 0) { // No user is present, auto accept - // User Consent Prompt is not required - files_consent_ok(this.ws); - } else { - // User is present so we still need consent - files_consent_ask(this.ws); - } - }); - } else { - // User Consent Prompt is required - files_consent_ask(this); + if (this.httprequest.consent && (this.httprequest.consent & 32)) { + // User Consent Prompt is required + // Send a console message back using the console channel, "\n" is supported. + this.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); + var consentMessage = currentTranslation['fileConsent'].replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); + var consentTitle = 'MeshCentral'; + + if (this.httprequest.soptions != null) { + if (this.httprequest.soptions.consentTitle != null) { consentTitle = this.httprequest.soptions.consentTitle; } + if (this.httprequest.soptions.consentMsgFiles != null) { consentMessage = this.httprequest.soptions.consentMsgFiles.replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); } } - } else { + var pr; + if (process.platform == 'win32') { + var enhanced = false; + try { require('win-userconsent'); enhanced = true; } catch (ex) { } + if (enhanced) { + var ipr = server_getUserImage(this.httprequest.userid); + ipr.consentTitle = consentTitle; + ipr.consentMessage = consentMessage; + ipr.consentTimeout = this.httprequest.consentTimeout; + ipr.consentAutoAccept = this.httprequest.consentAutoAccept; + ipr.username = this.httprequest.realname; + ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; + pr = ipr.then(function (img) { + this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: this.consentTimeout * 1000, timeoutAutoAccept: this.consentAutoAccept, translations: this.translations, background: color_options.background, foreground: color_options.foreground }); + this.__childPromise.close = this.consent.close.bind(this.consent); + return (this.consent); + }); + } else { + pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null); + } + } else { + pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null); + } + pr.ws = this; + this.pause(); + this._consentpromise = pr; + this.prependOnceListener('end', function () { if (this._consentpromise && this._consentpromise.close) { this._consentpromise.close(); } }); + pr.then( + function (always) { + if (always) { server_set_consentTimer(this.ws.httprequest.userid); } + + // Success + this.ws._consentpromise = null; + MeshServerLogEx(40, null, "Starting remote files after local user accepted (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); + this.ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: null })); + if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 4)) { + // User Notifications is required + var notifyMessage = currentTranslation['fileNotify'].replace('{0}', this.ws.httprequest.realname); + var notifyTitle = "MeshCentral"; + if (this.ws.httprequest.soptions != null) { + if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } + if (this.ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgFiles.replace('{0}', this.ws.httprequest.realname).replace('{1}', this.ws.httprequest.username); } + } + try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } + } + this.ws.resume(); + }, + function (e) { + // User Consent Denied/Failed + this.ws._consentpromise = null; + MeshServerLogEx(41, null, "Failed to start remote files after local user rejected (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); + this.ws.end(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 })); + }); + } + else { // User Consent Prompt is not required - files_consent_ok(this); + if (this.httprequest.consent && (this.httprequest.consent & 4)) { + // User Notifications is required + MeshServerLogEx(42, null, "Started remote files with toast notification (" + this.httprequest.remoteaddr + ")", this.httprequest); + var notifyMessage = currentTranslation['fileNotify'].replace('{0}', this.httprequest.realname); + var notifyTitle = "MeshCentral"; + if (this.httprequest.soptions != null) { + if (this.httprequest.soptions.notifyTitle != null) { notifyTitle = this.httprequest.soptions.notifyTitle; } + if (this.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = this.httprequest.soptions.notifyMsgFiles.replace('{0}', this.httprequest.realname).replace('{1}', this.httprequest.username); } + } + try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } + } else { + MeshServerLogEx(43, null, "Started remote files without notification (" + this.httprequest.remoteaddr + ")", this.httprequest); + } + this.resume(); } // Setup files @@ -3350,13 +2861,6 @@ function onTunnelData(data) } break; } - case 'open': { - // Open the local file/folder on the users desktop - if (cmd.path) { - MeshServerLogEx(20, [cmd.path], "Opening: " + cmd.path, cmd); - openFileOnDesktop(cmd.path); - } - } case 'markcoredump': { // If we are asking for the coredump file, set the right path. var coreDumpPath = null; @@ -3416,7 +2920,7 @@ function onTunnelData(data) if (cmd.sub == 'startack') { sendNextBlock = ((typeof cmd.ack == 'number') ? cmd.ack : 8); } else if (cmd.sub == 'stop') { delete this.filedownload; } else if (cmd.sub == 'ack') { sendNextBlock = 1; } } // Send the next download block(s) - if (sendNextBlock > 0) { + while (sendNextBlock > 0) { sendNextBlock--; var buf = Buffer.alloc(16384); var len = fs.readSync(this.filedownload.f, buf, 4, 16380, null); @@ -3525,24 +3029,6 @@ function onTunnelData(data) this.zip.on('progress', require('events').moderated(function (name, p) { this.xws.write(Buffer.from(JSON.stringify({ action: 'dialogmessage', msg: 'zippingFile', file: ((process.platform == 'win32') ? (name.split('/').join('\\')) : name), progress: p }))); }, 1000)); this.zip.pipe(out); break; - case 'unzip': - if (this.unzip != null) return; // Unzip operating is currently running, exit now. - this.unzip = require('zip-reader').read(cmd.input); - this.unzip._dest = cmd.dest; - this.unzip.xws = this; - this.unzip.then(function (zipped) { - this.xws.write(Buffer.from(JSON.stringify({ action: 'dialogmessage', msg: 'unzipping' }))); - zipped.xws = this.xws; - zipped.extractAll(this._dest).then(function () { // finished extracting - zipped.xws.write(Buffer.from(JSON.stringify({ action: 'dialogmessage', msg: null }))); - zipped.xws.write(Buffer.from(JSON.stringify({ action: 'refresh' }))); - delete zipped.xws.unzip; - }, function (e) { // error extracting - zipped.xws.write(Buffer.from(JSON.stringify({ action: 'dialogmessage', msg: 'unziperror', error: e }))); - delete zipped.xws.unzip; - }); - }, function (e) { this.xws.write(Buffer.from(JSON.stringify({ action: 'dialogmessage', msg: 'unziperror', error: e }))); delete this.xws.unzip }); - break; case 'cancel': // Cancel zip operation if present try { this.zipcancel = true; this.zip.cancel(function () { }); } catch (ex) { } @@ -3607,44 +3093,6 @@ function onTunnelWebRTCControlData(data) { } } -function tunnel_webrtc_onEnd() -{ - // The WebRTC channel closed, unpipe the KVM now. This is also done when the web socket closes. - //sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC data channel closed'); - if (this.websocket.desktop && this.websocket.desktop.kvm) - { - try - { - this.unpipe(this.websocket.desktop.kvm); - this.websocket.httprequest.desktop.kvm.unpipe(this); - } catch (ex) { } - } - this.httprequest = null; - this.websocket = null; -} -function tunnel_webrtc_DataChannel_OnFinalized() -{ - console.info1('WebRTC DataChannel Finalized'); -} -function tunnel_webrtc_OnDataChannel(rtcchannel) -{ - //sendConsoleText('WebRTC Datachannel open, protocol: ' + this.websocket.httprequest.protocol); - //rtcchannel.maxFragmentSize = 32768; - rtcchannel.xrtc = this; - rtcchannel.websocket = this.websocket; - this.rtcchannel = rtcchannel; - this.rtcchannel.once('~', tunnel_webrtc_DataChannel_OnFinalized); - this.websocket.rtcchannel = rtcchannel; - this.websocket.rtcchannel.on('data', onTunnelWebRTCControlData); - this.websocket.rtcchannel.on('end', tunnel_webrtc_onEnd); - this.websocket.write('{\"ctrlChannel\":\"102938\",\"type\":\"webrtc0\"}'); // Indicate we are ready for WebRTC switch-over. -} - -function tunnel_webrtc_OnFinalized() -{ - console.info1('WebRTC Connection Finalized'); -} - // Called when receiving control data on websocket function onTunnelControlData(data, ws) { var obj; @@ -3718,8 +3166,7 @@ function onTunnelControlData(data, ws) { break; } case 'webrtc0': { // Browser indicates we can start WebRTC switch-over. - if (ws.httprequest.protocol == 1) - { // Terminal + if (ws.httprequest.protocol == 1) { // Terminal // This is a terminal data stream, unpipe the terminal now and indicate to the other side that terminal data will no longer be received over WebSocket if (process.platform == 'win32') { ws.httprequest._term.unpipe(ws); @@ -3730,8 +3177,7 @@ function onTunnelControlData(data, ws) { } else if (ws.httprequest.protocol == 2) { // Desktop // This is a KVM data stream, unpipe the KVM now and indicate to the other side that KVM data will no longer be received over WebSocket ws.httprequest.desktop.kvm.unpipe(ws); - } else - { + } else { // Switch things around so all WebRTC data goes to onTunnelData(). ws.rtcchannel.httprequest = ws.httprequest; ws.rtcchannel.removeAllListeners('data'); @@ -3740,10 +3186,8 @@ function onTunnelControlData(data, ws) { ws.write("{\"ctrlChannel\":\"102938\",\"type\":\"webrtc1\"}"); // End of data marker break; } - case 'webrtc1': - { - if ((ws.httprequest.protocol == 1) || (ws.httprequest.protocol == 6)) - { // Terminal + case 'webrtc1': { + if ((ws.httprequest.protocol == 1) || (ws.httprequest.protocol == 6)) { // Terminal // Switch the user input from websocket to webrtc at this point. if (process.platform == 'win32') { ws.unpipe(ws.httprequest._term); @@ -3753,19 +3197,10 @@ function onTunnelControlData(data, ws) { ws.rtcchannel.pipe(ws.httprequest.process.stdin, { dataTypeSkip: 1 }); // 0 = Binary, 1 = Text. } ws.resume(); // Resume the websocket to keep receiving control data - } - else if (ws.httprequest.protocol == 2) - { // Desktop + } else if (ws.httprequest.protocol == 2) { // Desktop // Switch the user input from websocket to webrtc at this point. ws.unpipe(ws.httprequest.desktop.kvm); - if ((ws.httprequest.desktopviewonly != true) && ((ws.httprequest.rights == 0xFFFFFFFF) || (((ws.httprequest.rights & MESHRIGHT_REMOTECONTROL) != 0) && ((ws.httprequest.rights & MESHRIGHT_REMOTEVIEW) == 0)))) { - // If we have remote control rights, pipe the KVM input - try { ws.webrtc.rtcchannel.pipe(ws.httprequest.desktop.kvm, { dataTypeSkip: 1, end: false }); } catch (ex) { sendConsoleText('EX2'); } // 0 = Binary, 1 = Text. - } else { - // We need to only pipe non-mouse & non-keyboard inputs. - // sendConsoleText('Warning: No Remote Desktop Input Rights.'); - // TODO!!! - } + try { ws.webrtc.rtcchannel.pipe(ws.httprequest.desktop.kvm, { dataTypeSkip: 1, end: false }); } catch (ex) { sendConsoleText('EX2'); } // 0 = Binary, 1 = Text. ws.resume(); // Resume the websocket to keep receiving control data } ws.write('{\"ctrlChannel\":\"102938\",\"type\":\"webrtc2\"}'); // Indicates we will no longer get any data on websocket, switching to WebRTC at this point. @@ -3789,12 +3224,29 @@ function onTunnelControlData(data, ws) { // This is a WebRTC offer. if ((ws.httprequest.protocol == 1) || (ws.httprequest.protocol == 6)) return; // TODO: Terminal is currently broken with WebRTC. Reject WebRTC upgrade for now. ws.webrtc = rtc.createConnection(); - ws.webrtc.once('~', tunnel_webrtc_OnFinalized); ws.webrtc.websocket = ws; - //ws.webrtc.on('connected', function () { /*sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC connected');*/ }); - //ws.webrtc.on('disconnected', function () { /*sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC disconnected');*/ }); - ws.webrtc.on('dataChannel', tunnel_webrtc_OnDataChannel); - + ws.webrtc.on('connected', function () { /*sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC connected');*/ }); + ws.webrtc.on('disconnected', function () { /*sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC disconnected');*/ }); + ws.webrtc.on('dataChannel', function (rtcchannel) { + //sendConsoleText('WebRTC Datachannel open, protocol: ' + this.websocket.httprequest.protocol); + //rtcchannel.maxFragmentSize = 32768; + rtcchannel.xrtc = this; + rtcchannel.websocket = this.websocket; + this.rtcchannel = rtcchannel; + this.websocket.rtcchannel = rtcchannel; + this.websocket.rtcchannel.on('data', onTunnelWebRTCControlData); + this.websocket.rtcchannel.on('end', function () { + // The WebRTC channel closed, unpipe the KVM now. This is also done when the web socket closes. + //sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC data channel closed'); + if (this.websocket.desktop && this.websocket.desktop.kvm) { + try { + this.unpipe(this.websocket.desktop.kvm); + this.websocket.httprequest.desktop.kvm.unpipe(this); + } catch (ex) { } + } + }); + this.websocket.write('{\"ctrlChannel\":\"102938\",\"type\":\"webrtc0\"}'); // Indicate we are ready for WebRTC switch-over. + }); var sdp = null; try { sdp = ws.webrtc.setOffer(obj.sdp); } catch (ex) { } if (sdp != null) { ws.write({ type: 'answer', ctrlChannel: '102938', sdp: sdp }); } @@ -3824,64 +3276,6 @@ function consoleHttpResponse(response) { response.close = function () { sendConsoleText('httprequest.response.close', this.sessionid); consoleHttpRequest = null; } } -// Open a local file on current user's desktop -function openFileOnDesktop(file) { - var child = null; - try { - switch (process.platform) { - case 'win32': - var uid = require('user-sessions').consoleUid(); - var user = require('user-sessions').getUsername(uid); - var domain = require('user-sessions').getDomain(uid); - var task = { name: 'MeshChatTask', user: user, domain: domain, execPath: (require('fs').statSync(file).isDirectory() ? process.env['windir'] + '\\explorer.exe' : file) }; - if (require('fs').statSync(file).isDirectory()) task.arguments = [file]; - try { - require('win-tasks').addTask(task); - require('win-tasks').getTask({ name: 'MeshChatTask' }).run(); - require('win-tasks').deleteTask('MeshChatTask'); - return (true); - } - catch (ex) { - var taskoptions = { env: { _target: (require('fs').statSync(file).isDirectory() ? process.env['windir'] + '\\explorer.exe' : file), _user: '"' + domain + '\\' + user + '"' }, _args: "" }; - if (require('fs').statSync(file).isDirectory()) taskoptions.env._args = file; - for (var c1e in process.env) { - taskoptions.env[c1e] = process.env[c1e]; - } - var child = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], taskoptions); - child.stderr.on('data', function (c) { }); - child.stdout.on('data', function (c) { }); - child.stdin.write('SCHTASKS /CREATE /F /TN MeshChatTask /SC ONCE /ST 00:00 '); - if (user) { child.stdin.write('/RU $env:_user '); } - child.stdin.write('/TR "$env:_target $env:_args"\r\n'); - child.stdin.write('$ts = New-Object -ComObject Schedule.service\r\n'); - child.stdin.write('$ts.connect()\r\n'); - child.stdin.write('$tsfolder = $ts.getfolder("\\")\r\n'); - child.stdin.write('$task = $tsfolder.GetTask("MeshChatTask")\r\n'); - child.stdin.write('$taskdef = $task.Definition\r\n'); - child.stdin.write('$taskdef.Settings.StopIfGoingOnBatteries = $false\r\n'); - child.stdin.write('$taskdef.Settings.DisallowStartIfOnBatteries = $false\r\n'); - child.stdin.write('$taskdef.Actions.Item(1).Path = $env:_target\r\n'); - child.stdin.write('$taskdef.Actions.Item(1).Arguments = $env:_args\r\n'); - child.stdin.write('$tsfolder.RegisterTaskDefinition($task.Name, $taskdef, 4, $null, $null, $null)\r\n'); - child.stdin.write('SCHTASKS /RUN /TN MeshChatTask\r\n'); - child.stdin.write('SCHTASKS /DELETE /F /TN MeshChatTask\r\nexit\r\n'); - child.waitExit(); - } - break; - case 'linux': - child = require('child_process').execFile('/usr/bin/xdg-open', ['xdg-open', file], { uid: require('user-sessions').consoleUid() }); - break; - case 'darwin': - child = require('child_process').execFile('/usr/bin/open', ['open', file]); - break; - default: - // Unknown platform, ignore this command. - break; - } - } catch (ex) { } - return child; -} - // Open a web browser to a specified URL on current user's desktop function openUserDesktopUrl(url) { if ((url.toLowerCase().startsWith('http://') == false) && (url.toLowerCase().startsWith('https://') == false)) { return null; } @@ -3894,15 +3288,18 @@ function openUserDesktopUrl(url) { var domain = require('user-sessions').getDomain(uid); var task = { name: 'MeshChatTask', user: user, domain: domain, execPath: process.env['windir'] + '\\system32\\cmd.exe', arguments: ['/C START ' + url.split('&').join('^&')] }; - try { + try + { require('win-tasks').addTask(task); require('win-tasks').getTask({ name: 'MeshChatTask' }).run(); require('win-tasks').deleteTask('MeshChatTask'); return (true); } - catch (ex) { + catch(zz) + { var taskoptions = { env: { _target: process.env['windir'] + '\\system32\\cmd.exe', _args: '/C START ' + url.split('&').join('^&'), _user: '"' + domain + '\\' + user + '"' } }; - for (var c1e in process.env) { + for (var c1e in process.env) + { taskoptions.env[c1e] = process.env[c1e]; } var child = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], taskoptions); @@ -3947,15 +3344,13 @@ function processConsoleCommand(cmd, args, rights, sessionid) { var response = null; switch (cmd) { case 'help': { // Displays available commands - var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coreinfoupdate,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg,task,uninstallagent,display,openfile'; + var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg,task'; if (require('os').dns != null) { availcommands += ',dnsinfo'; } try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { } - if (process.platform == 'win32') { - availcommands += ',bitlocker,cs,wpfhwacceleration,uac,volumes,rdpport,deskbackground'; + if (process.platform == 'win32') + { + availcommands += ',cs,wpfhwacceleration,uac,volumes'; if (bcdOK()) { availcommands += ',safemode'; } - if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; } - try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { } - try { require('win-info'); availcommands += ',installedapps,qfe'; } catch (ex) { } } if (amt != null) { availcommands += ',amt,amtconfig,amtevents'; } if (process.platform != 'freebsd') { availcommands += ',vm'; } @@ -3971,105 +3366,18 @@ function processConsoleCommand(cmd, args, rights, sessionid) { response = "Available commands: \r\n" + fin + "."; break; } - case 'mousetrails': - try { require('win-deskutils'); } catch (ex) { response = 'Unknown command "mousetrails", type "help" for list of available commands.'; break; } - var id = require('user-sessions').getProcessOwnerName(process.pid).tsid == 0 ? 1 : null; - switch (args['_'].length) - { - case 0: - var trails = require('win-deskutils').mouse.getTrails(id); - response = trails == 0 ? 'MouseTrails Disabled' : ('MouseTrails enabled (' + trails + ')'); - response += '\nTo change setting, specify a positive integer, where 0 is disable: mousetrails [n]'; - break; - case 1: - var trails = parseInt(args['_'][0]); - require('win-deskutils').mouse.setTrails(trails, id); - trails = require('win-deskutils').mouse.getTrails(id); - response = trails == 0 ? 'MouseTrails Disabled' : ('MouseTrails enabled (' + trails + ')'); - break; - default: - response = 'Proper usage: mousetrails [n]'; - break; - } - break; - case 'deskbackground': - try { require('win-deskutils'); } catch (ex) { response = 'Unknown command "deskbackground", type "help" for list of available commands.'; break; } - var id = require('user-sessions').getProcessOwnerName(process.pid).tsid == 0 ? 1 : null; - switch (args['_'].length) - { - case 0: - response = 'Desktop Background: ' + require('win-deskutils').background.get(id); - break; - case 1: - require('win-deskutils').background.set(args['_'][0], id); - response = 'Desktop Background: ' + require('win-deskutils').background.get(id); - break; - default: - response = 'Proper usage: deskbackground [path]'; - break; - } - break; - case 'taskbar': - try { require('win-utils'); } catch (ex) { response = 'Unknown command "taskbar", type "help" for list of available commands.'; break; } - switch (args['_'].length) { - case 1: - case 2: - { - var tsid = parseInt(args['_'][1]); - if (isNaN(tsid)) { tsid = require('user-sessions').consoleUid(); } - sendConsoleText('Changing TaskBar AutoHide status. Please wait...', sessionid); - try { - var result = require('win-utils').taskBar.autoHide(tsid, args['_'][0].toLowerCase() == 'hide'); - response = 'Current Status of TaskBar AutoHide: ' + result; - } catch (ex) { response = 'Unable to change TaskBar settings'; } - } - break; - default: - { - response = 'Proper usage: taskbar HIDE|SHOW [TSID]'; - break; - } - } - break; - case 'privacybar': - if (process.platform != 'win32' || require('notifybar-desktop').DefaultPinned == null) { - response = 'Unknown command "privacybar", type "help" for list of available commands.'; - } - else { - switch (args['_'].length) { - default: - // Show Help - response = "Current Default Pinned State: " + (require('notifybar-desktop').DefaultPinned ? "PINNED" : "UNPINNED") + '\r\n'; - response += "To set default pinned state:\r\n privacybar [PINNED|UNPINNED]\r\n"; - break; - case 1: - switch (args['_'][0].toUpperCase()) { - case 'PINNED': - require('notifybar-desktop').DefaultPinned = true; - response = "privacybar default pinned state is: PINNED"; - break; - case 'UNPINNED': - require('notifybar-desktop').DefaultPinned = false; - response = "privacybar default pinned state is: UNPINNED"; - break; - default: - response = "INVALID parameter: " + args['_'][0].toUpperCase(); - break; - } - break; - } - } - break; case 'domain': response = getDomainInfo(); break; case 'domaininfo': { - if (process.platform != 'win32') { - response = 'Unknown command "cs", type "help" for list of available commands.'; + if(process.platform != 'win32') + { + response = 'Unknown command "cs", type "help" for list of avaialble commands.'; break; } - if (global._domainQuery != null) { + if(global._domainQuery != null) + { response = "There is already an outstanding Domain Controller Query... Please try again later..."; break; } @@ -4077,28 +3385,34 @@ function processConsoleCommand(cmd, args, rights, sessionid) { sendConsoleText('Querying Domain Controller... This can take up to 60 seconds. Please wait...', sessionid); global._domainQuery = require('win-wmi').queryAsync('ROOT\\CIMV2', 'SELECT * FROM Win32_NTDomain'); global._domainQuery.session = sessionid; - global._domainQuery.then(function (v) { + global._domainQuery.then(function (v) + { var results = []; - if (Array.isArray(v)) { + if (Array.isArray(v)) + { var i; var r; - for (i = 0; i < v.length; ++i) { + for (i = 0; i < v.length; ++i) + { r = {}; if (v[i].DomainControllerAddress != null) { r.DomainControllerAddress = v[i].DomainControllerAddress.split('\\').pop(); } if (r.DomainControllerName != null) { r.DomainControllerName = v[i].DomainControllerName.split('\\').pop(); } r.DomainGuid = v[i].DomainGuid; r.DomainName = v[i].DomainName; - if (r.DomainGuid != null) { + if (r.DomainGuid != null) + { results.push(r); } } } - if (results.length > 0) { + if (results.length > 0) + { sendConsoleText('Domain Controller Results:', this.session); sendConsoleText(JSON.stringify(results, null, 1), this.session); sendConsoleText('End of results...', this.session); } - else { + else + { sendConsoleText('Domain Controller: No results returned. Is the domain controller reachable?', this.session); } global._domainQuery = null; @@ -4112,17 +3426,9 @@ function processConsoleCommand(cmd, args, rights, sessionid) { case 'volumes': response = JSON.stringify(require('win-volumes').getVolumes(), null, 1); break; - case 'bitlocker': - if (process.platform == 'win32') { - if (require('win-volumes').volumes_promise != null) { - var p = require('win-volumes').volumes_promise(); - p.then(function (res) { sendConsoleText(JSON.stringify(cleanGetBitLockerVolumeInfo(res), null, 1), this.session); }); - } - } - break; case 'dhcp': // This command is only supported on Linux, this is because Linux does not give us the DNS suffix for each network adapter independently so we have to ask the DHCP server. { - try { require('linux-dhcp'); } catch (ex) { response = 'Unknown command "dhcp", type "help" for list of available commands.'; break; } + try { require('linux-dhcp'); } catch (ex) { response = 'Unknown command "dhcp", type "help" for list of avaialble commands.'; break; } if (args['_'].length == 0) { var j = require('os').networkInterfaces(); var ifcs = []; @@ -4149,7 +3455,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } case 'cs': if (process.platform != 'win32') { - response = 'Unknown command "cs", type "help" for list of available commands.'; + response = 'Unknown command "cs", type "help" for list of avaialble commands.'; break; } switch (args['_'].length) { @@ -4225,71 +3531,11 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; case 'msh': - if (args['_'].length == 0) { - response = JSON.stringify(_MSH(), null, 2); - } else if (args['_'].length > 3) { - response = 'Proper usage: msh [get|set|delete]\r\nmsh get MeshServer\r\nmsh set abc "xyz"\r\nmsh delete abc'; - } else { - var mshFileName = process.execPath.replace('.exe','') + '.msh'; - switch (args['_'][0].toLocaleLowerCase()) { - case 'get': - if (typeof args['_'][1] != 'string' || args['_'].length > 2) { - response = 'Proper usage: msh get MeshServer'; - } else if(_MSH()[args['_'][1]]) { - response = _MSH()[args['_'][1]]; - } else { - response = "Unknown Value: " + args['_'][1]; - } - break; - case 'set': - if (typeof args['_'][1] != 'string' || typeof args['_'][2] != 'string') { - response = 'Proper usage: msh set abc "xyz"'; - } else { - var jsonToSave = _MSH(); - jsonToSave[args['_'][1]] = args['_'][2]; - var updatedContent = ''; - for (var key in jsonToSave) { - if (jsonToSave.hasOwnProperty(key)) { - updatedContent += key + '=' + jsonToSave[key] + '\n'; - } - } - try { - require('fs').writeFileSync(mshFileName, updatedContent); - response = "msh set " + args['_'][1] + " successful" - } catch (ex) { - response = "msh set " + args['_'][1] + " unsuccessful"; - } - } - break; - case 'delete': - if (typeof args['_'][1] != 'string') { - response = 'Proper usage: msh delete abc'; - } else { - var jsonToSave = _MSH(); - delete jsonToSave[args['_'][1]]; - var updatedContent = ''; - for (var key in jsonToSave) { - if (jsonToSave.hasOwnProperty(key)) { - updatedContent += key + '=' + jsonToSave[key] + '\n'; - } - } - try { - require('fs').writeFileSync(mshFileName, updatedContent); - response = "msh delete " + args['_'][1] + " successful" - } catch (ex) { - response = "msh delete " + args['_'][1] + " unsuccessful"; - } - } - break; - default: - response = 'Proper usage: msh [get|set|delete]\r\nmsh get MeshServer\r\nmsh set abc "xyz"\r\nmsh delete abc'; - break; - } - } + response = JSON.stringify(_MSH(), null, 2); break; case 'dnsinfo': if (require('os').dns == null) { - response = "Unknown command \"" + cmd + "\", type \"help\" for list of available commands."; + response = "Unknown command \"" + cmd + "\", type \"help\" for list of avaialble commands."; } else { response = 'DNS Servers: '; @@ -4303,44 +3549,6 @@ function processConsoleCommand(cmd, args, rights, sessionid) { case 'timerinfo': response = require('ChainViewer').getTimerInfo(); break; - case 'rdpport': - if (process.platform != 'win32') { - response = 'Unknown command "rdpport", type "help" for list of available commands.'; - return; - } - if (args['_'].length == 0) { - response = 'Proper usage: rdpport [get|default|PORTNUMBER]'; - } else { - switch (args['_'][0].toLocaleLowerCase()) { - case 'get': - var rdpport = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp', 'PortNumber'); - response = "Current RDP Port Set To: " + rdpport + '\r\n'; - break; - case 'default': - try { - require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp', 'PortNumber', 3389); - response = 'RDP Port Set To 3389, Please Dont Forget To Restart Your Computer To Fully Apply'; - } catch (ex) { - response = 'Unable to Set RDP Port To: 3389'; - } - break; - default: - if (isNaN(parseFloat(args['_'][0]))){ - response = 'Proper usage: rdpport [get|default|PORTNUMBER]'; - } else if(parseFloat(args['_'][0]) < 0 || args['_'][0] > 65535) { - response = 'RDP Port Must Be More Than 0 And Less Than 65535'; - } else { - try { - require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp', 'PortNumber', parseFloat(args['_'][0])); - response = 'RDP Port Set To ' + args['_'][0] + ', Please Dont Forget To Restart Your Computer To Fully Apply'; - } catch (ex) { - response = 'Unable to Set RDP Port To: '+args['_'][0]; - } - } - break; - } - } - break; case 'find': if (args['_'].length <= 1) { response = "Proper usage:\r\n find root criteria [criteria2] [criteria n...]"; @@ -4360,13 +3568,12 @@ function processConsoleCommand(cmd, args, rights, sessionid) { break; } case 'coreinfoupdate': { - sendPeriodicServerUpdate(null, true); - response = "Core Info Update Requested" + sendPeriodicServerUpdate(); break; } case 'agentmsg': { if (args['_'].length == 0) { - response = "Proper usage:\r\n agentmsg add \"[message]\" [iconIndex]\r\n agentmsg remove [id]\r\n agentmsg list"; // Display usage + response = "Proper usage:\r\n agentmsg add \"[message]\" [iconIndex]\r\n agentmsg remove [index]\r\n agentmsg list"; // Display usage } else { if ((args['_'][0] == 'add') && (args['_'].length > 1)) { var msgID, iconIndex = 0; @@ -4474,12 +3681,12 @@ function processConsoleCommand(cmd, args, rights, sessionid) { break; case 'unzip': if (args['_'].length == 0) { - response = "Proper usage: unzip input,destination"; // Display usage + response = "Proper usage: unzip input, destination"; // Display usage } else { var p = args['_'].join(' ').split(','); - if (p.length != 2) { response = "Proper usage: unzip input,destination"; break; } // Display usage - var prom = require('zip-reader').read(p[0].trim()); - prom._dest = p[1].trim(); + if (p.length != 2) { response = "Proper usage: unzip input, destination"; break; } // Display usage + var prom = require('zip-reader').read(p[0]); + prom._dest = p[1]; prom.self = this; prom.sessionid = sessionid; prom.then(function (zipped) { @@ -4511,7 +3718,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) { break; case 'uac': if (process.platform != 'win32') { - response = 'Unknown command "uac", type "help" for list of available commands.'; + response = 'Unknown command "uac", type "help" for list of avaialble commands.'; break; } if (args['_'].length != 1) { @@ -4546,14 +3753,14 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; case 'vm': - response = 'Virtual Machine = ' + require('computer-identifiers').isVM(); + response = 'Virtual Machine = ' + require('identifiers').isVM(); break; case 'startupoptions': response = JSON.stringify(require('MeshAgent').getStartupOptions()); break; case 'kvmmode': if (require('MeshAgent').maxKvmTileSize == null) { - response = "Unknown command \"kvmmode\", type \"help\" for list of available commands."; + response = "Unknown command \"kvmmode\", type \"help\" for list of avaialble commands."; } else { if (require('MeshAgent').maxKvmTileSize == 0) { @@ -4584,11 +3791,10 @@ function processConsoleCommand(cmd, args, rights, sessionid) { if (process.platform == 'win32') { // Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value var writtenSize = 0; - var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent')); - try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize'); } catch (ex) { response = ex; } + try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { response = ex; } if (writtenSize != actualSize) { response = "Size updated from: " + writtenSize + " to: " + actualSize; - try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize', actualSize); } catch (ex) { response = ex; } + try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { response = ex; } } else { response = "Agent Size: " + actualSize + " kb"; } } else @@ -4719,11 +3925,14 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; case 'safemode': - if (process.platform != 'win32') { + if (process.platform != 'win32') + { response = 'safemode only supported on Windows Platforms' } - else { - if (!bcdOK()) { + else + { + if (!bcdOK()) + { response = 'safemode not supported on 64 bit Windows from a 32 bit process' break; } @@ -4800,13 +4009,11 @@ function processConsoleCommand(cmd, args, rights, sessionid) { if (require('MeshAgent').isService) { require('clipboard').dispatchRead().then(function (str) { sendConsoleText(str, sessionid); }); } else { - require('clipboard').read().then(function (str) { sendConsoleText(str, sessionid); }); + require("clipboard").read().then(function (str) { sendConsoleText(str, sessionid); }); } break; case 'setclip': { - if (pendingSetClip) { - response = 'Busy'; - } else if (args['_'].length != 1) { + if (args['_'].length != 1) { response = 'Proper usage: setclip "sample text"'; } else { if (require('MeshAgent').isService) { @@ -4820,18 +4027,13 @@ function processConsoleCommand(cmd, args, rights, sessionid) { var domain = require('user-sessions').getDomain(uid); user = (domain + '\\' + user); - if (this._dispatcher) { this._dispatcher.close(); } this._dispatcher = require('win-dispatcher').dispatch({ user: user, modules: [{ name: 'clip-dispatch', script: "module.exports = { dispatch: function dispatch(val) { require('clipboard')(val); process.exit(); } };" }], launch: { module: 'clip-dispatch', method: 'dispatch', args: [clipargs] } }); this._dispatcher.parent = this; //require('events').setFinalizerMetadata.call(this._dispatcher, 'clip-dispatch'); - pendingSetClip = true; this._dispatcher.on('connection', function (c) { this._c = c; this._c.root = this.parent; - this._c.on('end', function () - { - pendingSetClip = false; - try { this.root._dispatcher.close(); } catch (ex) { } + this._c.on('end', function () { this.root._dispatcher = null; this.root = null; }); @@ -4840,7 +4042,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) { response = 'Setting clipboard to: "' + args['_'][0] + '"'; } else { - require('clipboard')(args['_'][0]); response = 'Setting clipboard to: "' + args['_'][0] + '"'; + require("clipboard")(args['_'][0]); response = 'Setting clipboard to: "' + args['_'][0] + '"'; } } break; @@ -4850,11 +4052,6 @@ function processConsoleCommand(cmd, args, rights, sessionid) { else { if (openUserDesktopUrl(args['_'][0]) == null) { response = 'Failed.'; } else { response = 'Success.'; } } break; } - case 'openfile': { - if (args['_'].length != 1) { response = 'Proper usage: openfile (filepath)'; } // Display usage - else { if (openFileOnDesktop(args['_'][0]) == null) { response = 'Failed.'; } else { response = 'Success.'; } } - break; - } case 'users': { if (meshCoreObj.users == null) { response = 'Active users are unknown.'; } else { response = 'Active Users: ' + meshCoreObj.users.join(', ') + '.'; } require('user-sessions').enumerateUsers().then(function (u) { for (var i in u) { sendConsoleText(u[i]); } }); @@ -4966,11 +4163,8 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } case 'sysinfo': { // Return system information getSystemInformation(function (results, err) { - if (results == null) { - sendConsoleText(err, this.sessionid); - } else { + if (results == null) { sendConsoleText(err, this.sessionid); } else { sendConsoleText(JSON.stringify(results, null, 1), this.sessionid); - mesh.SendCommand({ action: 'sysinfo', sessionid: this.sessionid, data: results }); } }); break; @@ -4983,9 +4177,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) { response += '\r\nServer Connection: ' + mesh.isControlChannelConnected + ', State: ' + meshServerConnectionState + '.'; var oldNodeId = db.Get('OldNodeId'); if (oldNodeId != null) { response += '\r\nOldNodeID: ' + oldNodeId + '.'; } - response += '\r\nNode ID: ' + Buffer.from(require('_agentNodeId')(), 'hex').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); if (process.platform == 'linux' || process.platform == 'freebsd') { response += '\r\nX11 support: ' + require('monitor-info').kvm_x11_support + '.'; } - response += '\r\nApplication Location: ' + process.cwd(); //response += '\r\Debug Console: ' + debugConsole + '.'; break; } @@ -5212,21 +4404,6 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; } - case 'display': { - if (args['_'].length != 1) { - response = 'Proper usage: display (sleep | awake)'; - } else { - var sleepawake = [args['_'][0]]; - if(sleepawake=='sleep'){ - require('power-monitor').sleepDisplay() - }else if(sleepawake=='awake'){ - require('power-monitor').wakeDisplay() - - } - response = 'Setting Display To ' + sleepawake; - } - break; - } case 'sendall': { // Send a message to all consoles on this mesh sendConsoleText(args['_'].join(' ')); break; @@ -5376,6 +4553,14 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; } + case 'task': { + if (!scriptTask) { response = "Tasks are not supported on this agent"; } + else { + if (args['_'][0]) { args.cmd = args['_'][0].toLowerCase(); } + response = scriptTask.processCommand(args, rights, sessionid); + } + break; + } case 'plugin': { if (typeof args['_'][0] == 'string') { try { @@ -5391,21 +4576,8 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; } - case 'installedapps': { - if(process.platform == 'win32'){ - require('win-info').installedApps().then(function (apps){ sendConsoleText(JSON.stringify(apps,null,1)); }); - } - break; - } - case 'qfe': { - if(process.platform == 'win32'){ - var qfe = require('win-info').qfe(); - sendConsoleText(JSON.stringify(qfe,null,1)); - } - break; - } default: { // This is an unknown command, return an error message - response = "Unknown command \"" + cmd + "\", type \"help\" for list of available commands."; + response = "Unknown command \"" + cmd + "\", type \"help\" for list of avaialble commands."; break; } } @@ -5668,12 +4840,12 @@ function windows_execve(name, agentfilename, sessionid) { sendAgentMessage('Self Update failed because msvcrt.dll is missing', 3); return; } - + var cmd = require('_GenericMarshal').CreateVariable(process.env['windir'] + '\\system32\\cmd.exe', { wide: true }); var args = require('_GenericMarshal').CreateVariable(3 * require('_GenericMarshal').PointerSize); var arg1 = require('_GenericMarshal').CreateVariable('cmd.exe', { wide: true }); - var arg2 = require('_GenericMarshal').CreateVariable('/C net stop "' + name + '" & "' + process.cwd() + agentfilename + '.update.exe" -b64exec ' + 'dHJ5CnsKICAgIHZhciBzZXJ2aWNlTG9jYXRpb24gPSBwcm9jZXNzLmFyZ3YucG9wKCkudG9Mb3dlckNhc2UoKTsKICAgIHJlcXVpcmUoJ3Byb2Nlc3MtbWFuYWdlcicpLmVudW1lcmF0ZVByb2Nlc3NlcygpLnRoZW4oZnVuY3Rpb24gKHByb2MpCiAgICB7CiAgICAgICAgZm9yICh2YXIgcCBpbiBwcm9jKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKHByb2NbcF0ucGF0aCAmJiAocHJvY1twXS5wYXRoLnRvTG93ZXJDYXNlKCkgPT0gc2VydmljZUxvY2F0aW9uKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcHJvY2Vzcy5raWxsKHByb2NbcF0ucGlkKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcm9jZXNzLmV4aXQoKTsKICAgIH0pOwp9CmNhdGNoIChlKQp7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQ==' + - ' "' + process.execPath + '" & copy "' + process.cwd() + agentfilename + '.update.exe" "' + process.execPath + '" & net start "' + name + '" & erase "' + process.cwd() + agentfilename + '.update.exe"', { wide: true }); + var arg2 = require('_GenericMarshal').CreateVariable('/C wmic service "' + name + '" call stopservice & "' + process.cwd() + agentfilename + '.update.exe" -b64exec ' + 'dHJ5CnsKICAgIHZhciBzZXJ2aWNlTG9jYXRpb24gPSBwcm9jZXNzLmFyZ3YucG9wKCkudG9Mb3dlckNhc2UoKTsKICAgIHJlcXVpcmUoJ3Byb2Nlc3MtbWFuYWdlcicpLmVudW1lcmF0ZVByb2Nlc3NlcygpLnRoZW4oZnVuY3Rpb24gKHByb2MpCiAgICB7CiAgICAgICAgZm9yICh2YXIgcCBpbiBwcm9jKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKHByb2NbcF0ucGF0aCAmJiAocHJvY1twXS5wYXRoLnRvTG93ZXJDYXNlKCkgPT0gc2VydmljZUxvY2F0aW9uKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcHJvY2Vzcy5raWxsKHByb2NbcF0ucGlkKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcm9jZXNzLmV4aXQoKTsKICAgIH0pOwp9CmNhdGNoIChlKQp7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQ==' + + ' "' + process.execPath + '" & copy "' + process.cwd() + agentfilename + '.update.exe" "' + process.execPath + '" & wmic service "' + name + '" call startservice & erase "' + process.cwd() + agentfilename + '.update.exe"', { wide: true }); arg1.pointerBuffer().copy(args.toBuffer()); arg2.pointerBuffer().copy(args.toBuffer(), require('_GenericMarshal').PointerSize); @@ -5863,7 +5035,6 @@ function handleServerConnection(state) { // Update the server on with basic info, logged in users and more advanced stuff, like Intel ME and Network Settings meInfoStr = null; - LastPeriodicServerUpdate = null; sendPeriodicServerUpdate(null, true); if (selfInfoUpdateTimer == null) { selfInfoUpdateTimer = setInterval(sendPeriodicServerUpdate, 1200000); // 20 minutes @@ -5905,7 +5076,6 @@ function sendNetworkUpdate(force) { function sendPeriodicServerUpdate(flags, force) { if (meshServerConnectionState == 0) return; // Not connected to server, do nothing. if (!flags) { flags = 0xFFFFFFFF; } - if (!force) { force = false; } // If we have a connected MEI, get Intel ME information if ((flags & 1) && (amt != null) && (amt.state == 2)) { @@ -5938,15 +5108,6 @@ function sendPeriodicServerUpdate(flags, force) { }); } catch (ex) { } } - - // Get Defender for Windows Server - try { - var d = require('win-info').defender(); - d.then(function(res){ - meshCoreObj.defender = res; - meshCoreObjChanged(); - }); - } catch (ex) { } } // Send available data right now @@ -5960,26 +5121,6 @@ function sendPeriodicServerUpdate(flags, force) { } } -// Sort the names in an object -function sortObject(obj) { return Object.keys(obj).sort().reduce(function(a, v) { a[v] = obj[v]; return a; }, {}); } - -// Fix the incoming data and cut down how much data we use -function cleanGetBitLockerVolumeInfo(volumes) { - for (var i in volumes) { - const v = volumes[i]; - if (typeof v.size == 'string') { v.size = parseInt(v.size); } - if (typeof v.sizeremaining == 'string') { v.sizeremaining = parseInt(v.sizeremaining); } - if (v.identifier == '') { delete v.identifier; } - if (v.name == '') { delete v.name; } - if (v.removable != true) { delete v.removable; } - if (v.cdrom != true) { delete v.cdrom; } - if (v.protectionStatus == 'On') { v.protectionStatus = true; } else { delete v.protectionStatus; } - if (v.volumeStatus == 'FullyDecrypted') { delete v.volumeStatus; } - if (v.recoveryPassword == '') { delete v.recoveryPassword; } - } - return sortObject(volumes); -} - // Once we are done collecting all the data, send to server if needed var LastPeriodicServerUpdate = null; var PeriodicServerUpdateNagleTimer = null; diff --git a/agents/meshinstall-linux.js b/agents/meshinstall-linux.js index 1f047aff..cbc5dca3 100644 --- a/agents/meshinstall-linux.js +++ b/agents/meshinstall-linux.js @@ -103,13 +103,14 @@ if (msh.agentName) { connectArgs.push('--agentName="' + msh.agentName + '"'); } function _install(parms) { - var i; var mstr = require('fs').createWriteStream(process.execPath + '.msh', { flags: 'wb' }); - - for (i in msh) - { - mstr.write(i + '=' + msh[i] + '\n'); - } + mstr.write('MeshName=' + msh.MeshName + '\n'); + mstr.write('MeshType=' + msh.MeshType + '\n'); + mstr.write('MeshID=' + msh.MeshID + '\n'); + mstr.write('ServerID=' + msh.ServerID + '\n'); + mstr.write('MeshServer=' + msh.MeshServer + '\n'); + if (msh.agentName) { mstr.write('agentName=' + msh.agentName + '\n'); } + if (msh.meshServiceName) { mstr.write('meshServiceName=' + msh.meshServiceName + '\n'); } mstr.end(); if (parms == null) { parms = []; } @@ -155,7 +156,7 @@ if (process.argv.includes('-translations')) console.log(JSON.stringify(translation)); process.exit(); } -if (process.argv.includes('-help') || (process.platform == 'linux' && process.env['XAUTHORITY'] == null && process.env['DISPLAY'] == null && process.argv.length == 1)) +if (process.argv.includes('-help')) { console.log("\n" + translation[lang].commands + ": "); if ((msh.InstallFlags & 1) == 1) @@ -220,7 +221,9 @@ if ((!skip) && ((msh.InstallFlags & 2) == 2)) } } - if (!skip) +if (!skip) +{ + if (process.platform != 'darwin') { if (process.argv.includes('-install') || process.argv.includes('-update')) { @@ -231,10 +234,6 @@ if ((!skip) && ((msh.InstallFlags & 2) == 2)) { p.push('--installPath="' + process.argv[i].split('=').pop() + '"'); } - else if(process.argv[i].startsWith('--')) - { - p.push(process.argv[i]); - } } _install(p); process.exit(); @@ -272,11 +271,12 @@ if ((!skip) && ((msh.InstallFlags & 2) == 2)) process.exit(); } } - if (process.platform == 'darwin') - { - if (!require('user-sessions').isRoot()) { console.log('\n' + translation[lang].elevation); process.exit(); } - } } + else + { + if (!require('user-sessions').isRoot()) { console.log('\n' + translation[lang].elevation); process.exit(); } + } +} if (!skip) diff --git a/agents/modules_meshcmd/amt-ider.js b/agents/modules_meshcmd/amt-ider.js index 98fdb12b..0c00a72d 100644 --- a/agents/modules_meshcmd/amt-ider.js +++ b/agents/modules_meshcmd/amt-ider.js @@ -57,9 +57,6 @@ module.exports = function CreateAmtRemoteIder() { var IDE_ModeSence_Ls120Error_Recovery_Array = new Buffer([0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]); var IDE_ModeSence_CDError_Recovery_Array = new Buffer([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00]); - // CD info and performance - var RD_CD_DiskInfo = new Buffer([0x00, 0x20, 0x0e, 0x01, 0x01, 0x01, 0x01, 0x20, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); - var RD_CD_Performance = new Buffer([0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00]); // Private method, called by parent when it change state obj.xxStateChange = function (newstate) { @@ -98,7 +95,7 @@ module.exports = function CreateAmtRemoteIder() { // Private method obj.ProcessData = function (data) { obj.bytesFromAmt += data.length; - if (obj.acc == null) { obj.acc = data; } else { obj.acc = Buffer.concat([obj.acc, data]); } + if (obj.acc == null) { obj.acc = data; } else { obj.acc = Buffer.concat(obj.acc, data); } if (obj.debug) console.log('IDER-ProcessData', obj.acc.length, obj.acc.toString('hex')); // Process as many commands as possible @@ -531,12 +528,6 @@ module.exports = function CreateAmtRemoteIder() { obj.SendDataToHost(dev, true, r, featureRegister & 1); } break; - case 0x51: // READ_DISK_INFORMATION - obj.SendDataToHost(dev, true, RD_CD_DiskInfo, featureRegister & 1); - break; - case 0xAC: // GET_PERFORMANCE - obj.SendDataToHost(dev, true, RD_CD_Performance, featureRegister & 1); - break; default: // UNKNOWN COMMAND if (obj.debug) console.log("IDER: Unknown SCSI command", cdb[0]); obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); diff --git a/agents/modules_meshcmd/amt-redir-duk.js b/agents/modules_meshcmd/amt-redir-duk.js index 5bbcaf76..512c0cd5 100644 --- a/agents/modules_meshcmd/amt-redir-duk.js +++ b/agents/modules_meshcmd/amt-redir-duk.js @@ -21,10 +21,10 @@ module.exports = function CreateAmtRedirect(module) { obj.protocol = module.protocol; // 1 = SOL, 2 = KVM, 3 = IDER obj.xtlsoptions = null; - obj.amtaccumulator = Buffer.alloc(0); + obj.amtaccumulator = null; obj.amtsequence = 1; obj.amtkeepalivetimer = null; - obj.authuri = '/RedirectionService'; + obj.authuri = "/RedirectionService"; obj.digestRealmMatch = null; obj.onStateChanged = null; @@ -80,7 +80,7 @@ module.exports = function CreateAmtRedirect(module) { } */ - if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CONNECTED'); } + if (urlvars && urlvars['redirtrace']) { console.log("REDIR-CONNECTED"); } //obj.Debug("Socket Connected"); obj.xxStateChange(2); if (obj.protocol == 1) obj.xxSend(obj.RedirectStartSol); // TODO: Put these strings in higher level module to tighten code @@ -89,14 +89,14 @@ module.exports = function CreateAmtRedirect(module) { } obj.xxOnSocketData = function (data) { + //console.log('xxOnSocketData: ' + data.toString('hex'), data.length); if (!data || obj.connectstate == -1) return; - if (urlvars && urlvars['redirtrace']) { console.log('REDIR-RECV(' + data.length + '): ' + data.toString('hex')); } + if (urlvars && urlvars['redirtrace']) { console.log("REDIR-RECV(" + data.length + "): " + data.toString('hex')); } //obj.Debug("Recv(" + data.length + "): " + rstr2hex(data)); if ((obj.protocol == 2 || obj.protocol == 3) && obj.connectstate == 1) { return obj.m.ProcessData(data); } // KVM or IDER traffic, forward it directly. - obj.amtaccumulator = Buffer.concat([obj.amtaccumulator, data]); - //obj.Debug("Recv(" + obj.amtaccumulator.length + "): " + obj.amtaccumulator.toString('hex')); - - while (obj.amtaccumulator.length > 0) { + if (obj.amtaccumulator == null) { obj.amtaccumulator = data; } else { obj.amtaccumulator = Buffer.concat(obj.amtaccumulator, data); } + //obj.Debug("Recv(" + obj.amtaccumulator.length + "): " + rstr2hex(obj.amtaccumulator)); + while (obj.amtaccumulator != null) { var cmdsize = 0; //console.log('CMD: ' + obj.amtaccumulator[0]); switch (obj.amtaccumulator[0]) { @@ -170,9 +170,9 @@ module.exports = function CreateAmtRedirect(module) { qoplen = authDataBuf[curptr]; qop = authDataBuf.slice(curptr + 1, curptr + 1 + qoplen).toString(); curptr += (qoplen + 1); - extra = snc + ':' + cnonce + ':' + qop + ':'; + extra = snc + ":" + cnonce + ":" + qop + ":"; } - var digest = hex_md5(hex_md5(obj.user + ':' + realm + ':' + obj.pass) + ':' + nonce + ':' + extra + hex_md5('POST:' + obj.authuri)); + var digest = hex_md5(hex_md5(obj.user + ":" + realm + ":" + obj.pass) + ":" + nonce + ":" + extra + hex_md5("POST:" + obj.authuri)); var totallen = obj.user.length + realm.length + nonce.length + obj.authuri.length + cnonce.length + snc.length + digest.length + 7; if (authType == 4) totallen += (qop.length + 1); var buf = Buffer.concat([new Buffer([0x13, 0x00, 0x00, 0x00, authType]), new Buffer([totallen & 0xFF, (totallen >> 8) & 0xFF, 0x00, 0x00]), new Buffer([obj.user.length]), new Buffer(obj.user), new Buffer([realm.length]), new Buffer(realm), new Buffer([nonce.length]), new Buffer(nonce), new Buffer([obj.authuri.length]), new Buffer(obj.authuri), new Buffer([cnonce.length]), new Buffer(cnonce), new Buffer([snc.length]), new Buffer(snc), new Buffer([digest.length]), new Buffer(digest)]); @@ -181,6 +181,7 @@ module.exports = function CreateAmtRedirect(module) { } else if (status == 0) { // Success if (obj.protocol == 1) { + /* // Serial-over-LAN: Send Intel AMT serial settings... var MaxTxBuffer = 10000; var TxTimeout = 100; @@ -189,6 +190,7 @@ module.exports = function CreateAmtRedirect(module) { var RxFlushTimeout = 100; var Heartbeat = 0;//5000; obj.xxSend(String.fromCharCode(0x20, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++) + ToShortStr(MaxTxBuffer) + ToShortStr(TxTimeout) + ToShortStr(TxOverflowTimeout) + ToShortStr(RxTimeout) + ToShortStr(RxFlushTimeout) + ToShortStr(Heartbeat) + ToIntStr(0)); + */ } if (obj.protocol == 2) { // Remote Desktop: Send traffic directly... @@ -217,7 +219,7 @@ module.exports = function CreateAmtRedirect(module) { if (obj.amtaccumulator.length < 10) break; var cs = (10 + ((obj.amtaccumulator[9] & 0xFF) << 8) + (obj.amtaccumulator[8] & 0xFF)); if (obj.amtaccumulator.length < cs) break; - obj.m.ProcessData(obj.amtaccumulator.slice(10, cs)); + obj.m.ProcessData(obj.amtaccumulator.substring(10, cs)); cmdsize = cs; break; case 0x2B: // Keep alive message (43) @@ -233,22 +235,21 @@ module.exports = function CreateAmtRedirect(module) { cmdsize = obj.amtaccumulator.length; break; default: - console.log('Unknown Intel AMT command: ' + obj.amtaccumulator[0] + ' acclen=' + obj.amtaccumulator.length); + console.log("Unknown Intel AMT command: " + obj.amtaccumulator[0] + " acclen=" + obj.amtaccumulator.length); obj.Stop(); return; } if (cmdsize == 0) return; - obj.amtaccumulator = obj.amtaccumulator.slice(cmdsize); + if (cmdsize == obj.amtaccumulator.length) { obj.amtaccumulator = null; } else { obj.amtaccumulator = obj.amtaccumulator.slice(cmdsize); } } } obj.xxSend = function (x) { - if (urlvars && urlvars['redirtrace']) { console.log('REDIR-SEND(' + x.length + '): ' + rstr2hex(x)); } - //obj.Debug('Send(' + x.length + '): ' + Buffer.from(x, 'binary').toString('hex')); - if (typeof x == 'string') { obj.socket.write(Buffer.from(x, 'binary')); } else { obj.socket.write(x); } + if (urlvars && urlvars['redirtrace']) { console.log("REDIR-SEND(" + x.length + "): " + rstr2hex(x)); } + //obj.Debug("Send(" + x.length + "): " + Buffer.from(x, "binary").toString('hex')); + if (typeof x == 'string') { obj.socket.write(Buffer.from(x, "binary")); } else { obj.socket.write(x); } } - // Send Serial-over-LAN ASCII characters obj.Send = function (x) { if (obj.socket == null || obj.connectstate != 1) return; if (obj.protocol == 1) { obj.xxSend(String.fromCharCode(0x28, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++) + ToShortStr(x.length) + x); } else { obj.xxSend(x); } @@ -262,14 +263,14 @@ module.exports = function CreateAmtRedirect(module) { // Uses OpenSSL random to generate a hex string obj.xxRandomValueHex = function (len) { var t = [], l = Math.floor(len / 2); - for (var i = 0; i < l; i++) { t.push(obj.tls.generateRandomInteger('0', '255')); } + for (var i = 0; i < l; i++) { t.push(obj.tls.generateRandomInteger("0", "255")); } return new Buffer(t).toString('hex'); } obj.xxOnSocketClosed = function () { obj.socket = null; - if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CLOSED'); } - //obj.Debug('Socket Closed'); + if (urlvars && urlvars['redirtrace']) { console.log("REDIR-CLOSED"); } + //obj.Debug("Socket Closed"); obj.Stop(); } @@ -281,11 +282,11 @@ module.exports = function CreateAmtRedirect(module) { } obj.Stop = function () { - if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CLOSED'); } - //obj.Debug('Socket Stopped'); + if (urlvars && urlvars['redirtrace']) { console.log("REDIR-CLOSED"); } + //obj.Debug("Socket Stopped"); obj.xxStateChange(0); obj.connectstate = -1; - obj.amtaccumulator = Buffer.alloc(0); + obj.amtaccumulator = ""; if (obj.socket != null) { obj.socket.destroy(); obj.socket = null; } if (obj.amtkeepalivetimer != null) { clearInterval(obj.amtkeepalivetimer); obj.amtkeepalivetimer = null; } } diff --git a/agents/modules_meshcmd/amt-sol.js b/agents/modules_meshcmd/amt-sol.js deleted file mode 100644 index e2136c06..00000000 --- a/agents/modules_meshcmd/amt-sol.js +++ /dev/null @@ -1,20 +0,0 @@ -/** -* @description Serial-over-LAN Handling Module -* @author Ylian Saint-Hilaire -*/ - -// meshservice meshcmd.js amtterm --host 192.168.2.186 --pass P@ssw0rd - -// Construct a Intel AMT Serial-over-LAN object -module.exports = function CreateAmtRemoteSol() { - var obj = {}; - obj.protocol = 1; // Serial-over-LAN - obj.debug = false; - obj.onData = null; - obj.xxStateChange = function (newstate) { if (obj.debug) console.log('SOL-StateChange', newstate); if (newstate == 0) { obj.Stop(); } if (newstate == 3) { obj.Start(); } } - obj.Start = function () { if (obj.debug) { console.log('SOL-Start'); } } - obj.Stop = function () { if (obj.debug) { console.log('SOL-Stop'); } } - obj.ProcessData = function (data) { if (obj.debug) { console.log('SOL-ProcessData', data); } if (obj.onData) { obj.onData(obj, data); } } - obj.Send = function(text) { if (obj.debug) { console.log('SOL-Send', text); } obj.parent.Send(text); } - return obj; -} \ No newline at end of file diff --git a/agents/modules_meshcmd/amt-wsman-duk.js b/agents/modules_meshcmd/amt-wsman-duk.js index fee29f4d..954d548b 100644 --- a/agents/modules_meshcmd/amt-wsman-duk.js +++ b/agents/modules_meshcmd/amt-wsman-duk.js @@ -86,7 +86,7 @@ function CreateWsmanComm(/*host, port, user, pass, tls, extra*/) { //console.log('Request ' + (obj.RequestCount++)); if (globalDebugFlags & 1) { console.log('Request ' + (obj.RequestCount++)); } // DEBUG - req.on('error', function (err) { obj.gotNextMessagesError({ status: 600, error: '' + err }, 'error', null, [postdata, callback, tag]); }); + req.on('error', function (e) { obj.gotNextMessagesError({ status: 600 }, 'error', null, [postdata, callback, tag]); }); req.on('response', function (response) { //console.log(JSON.stringify(response, null, 2)); if (globalDebugFlags & 1) { console.log('Response: ' + response.statusCode); } @@ -126,7 +126,7 @@ function CreateWsmanComm(/*host, port, user, pass, tls, extra*/) { if (obj.FailAllError == 999) return; if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; } //if (status != 200) { console.log("ERROR, status=" + status + "\r\n\r\nreq=" + callArgs[0]); } // Debug: Display the request & response if something did not work. - if (obj.FailAllError != 999) { callArgs[1]({ Header: { HttpError: request.status, error: request.error } }, request.status, callArgs[2]); } + if (obj.FailAllError != 999) { callArgs[1]({ Header: { HttpError: request.status } }, request.status, callArgs[2]); } obj.PerformNextAjax(); } diff --git a/agents/modules_meshcmd/amt-wsman.js b/agents/modules_meshcmd/amt-wsman.js index 280c617d..717fd4c9 100644 --- a/agents/modules_meshcmd/amt-wsman.js +++ b/agents/modules_meshcmd/amt-wsman.js @@ -43,7 +43,7 @@ function WsmanStackCreateService(/*CreateWsmanComm, host, port, user, pass, tls, obj.PerformAjax = function PerformAjax(postdata, callback, tag, pri, namespaces) { if (namespaces == null) namespaces = ''; obj.comm.PerformAjax('
' + postdata, function (data, status, tag) { - if (status != 200) { callback(obj, null, (data != null) ? data : { Header: { HttpError: status } }, status, tag); return; } + if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; } var wsresponse = obj.xmlParser.ParseWsman(data); if (!wsresponse || wsresponse == null) { callback(obj, null, { Header: { HttpError: status } }, 601, tag); } else { callback(obj, wsresponse.Header["ResourceURI"], wsresponse, 200, tag); } }, tag, pri); diff --git a/agents/modules_meshcmd/amt.js b/agents/modules_meshcmd/amt.js index 173e14ca..9a027fba 100644 --- a/agents/modules_meshcmd/amt.js +++ b/agents/modules_meshcmd/amt.js @@ -514,98 +514,60 @@ function AmtStackCreateService(wsmanStack) { var _SystemEntityTypes = "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('|'); obj.RealmNames = "||Redirection|PT Administration|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('|'); obj.WatchdogCurrentStates = { 1: 'Not Started', 2: 'Stopped', 4: 'Running', 8: 'Expired', 16: 'Suspended' }; - var _OCRProgressEvents = ["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"]; - var _OCRErrorEvents = ['', "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"]; - var _OCRSource = { 1: '', 2: "HTTPS", 4: "Local PBA", 8: "WinRE" }; function _GetEventDetailStr(eventSensorType, eventOffset, eventDataField, entity) { - if (eventSensorType == 15) { + + if (eventSensorType == 15) + { if (eventDataField[0] == 235) return "Invalid Data"; - if (eventOffset == 0) { - return _SystemFirmwareError[eventDataField[1]]; - } else if (eventOffset == 3) { - if ((eventDataField[0] == 170) && (eventDataField[1] == 48)) { - return format("One Click Recovery: {0}", _OCRErrorEvents[eventDataField[2]]); - } else if ((eventDataField[0] == 170) && (eventDataField[1] == 64)) { - if (eventDataField[2] == 1) return "Got an error erasing Device SSD"; - if (eventDataField[2] == 2) return "Erasing Device TPM is not supported"; - if (eventDataField[2] == 3) return "Reached Max Counter"; - } else { - return "OEM Specific Firmware Error event"; - } - } else if (eventOffset == 5) { - if ((eventDataField[0] == 170) && (eventDataField[1] == 48)) { - if (eventDataField[2] == 1) { - return format("One Click Recovery: CSME Boot Option {0}:{1} added successfully", (eventDataField[3]), _OCRSource[(eventDataField[3])]); - } else if (eventDataField[2] < 7) { - return format("One Click Recovery: {0}", _OCRProgressEvents[eventDataField[2]]); - } else { - return format("One Click Recovery: Unknown progress event {0}", eventDataField[2]); - } - } else if ((eventDataField[0] == 170) && (eventDataField[1] == 64)) { - if (eventDataField[2] == 1) { - if (eventDataField[3] == 2) return "Started erasing Device SSD"; - if (eventDataField[3] == 3) return "Started erasing Device TPM"; - if (eventDataField[3] == 5) return "Started erasing Device BIOS Reload of Golden Config"; - } - if (eventDataField[2] == 2) { - if (eventDataField[3] == 2) return "Erasing Device SSD ended successfully"; - if (eventDataField[3] == 3) return "Erasing Device TPM ended successfully"; - if (eventDataField[3] == 5) return "Erasing Device BIOS Reload of Golden Config ended successfully"; - } - if (eventDataField[2] == 3) return "Beginning Platform Erase"; - if (eventDataField[2] == 4) return "Clear Reserved Parameters"; - if (eventDataField[2] == 5) return "All setting decremented"; - } else { - return "OEM Specific Firmware Progress event"; - } - } else { - return _SystemFirmwareProgress[eventDataField[1]]; - } + if (eventOffset == 0) return _SystemFirmwareError[eventDataField[1]]; + return _SystemFirmwareProgress[eventDataField[1]]; } - if ((eventSensorType == 18) && (eventDataField[0] == 170)) // System watchdog event + if (eventSensorType == 18 && eventDataField[0] == 170) // System watchdog event { return "Agent watchdog " + char2hex(eventDataField[4]) + char2hex(eventDataField[3]) + char2hex(eventDataField[2]) + char2hex(eventDataField[1]) + "-" + char2hex(eventDataField[6]) + char2hex(eventDataField[5]) + "-... changed to " + obj.WatchdogCurrentStates[eventDataField[7]]; } - if ((eventSensorType == 5) && (eventOffset == 0)) // System chassis - { - return "Case intrusion"; - } + //if (eventSensorType == 5 && eventOffset == 0) // System chassis + //{ + // return "Case intrusion"; + //} - if ((eventSensorType == 192) && (eventOffset == 0) && (eventDataField[0] == 170) && (eventDataField[1] == 48)) - { - if (eventDataField[2] == 0) return "A remote Serial Over LAN session was established."; - if (eventDataField[2] == 1) return "Remote Serial Over LAN session finished. User control was restored."; - if (eventDataField[2] == 2) return "A remote IDE-Redirection session was established."; - if (eventDataField[2] == 3) return "Remote IDE-Redirection session finished. User control was restored."; - } + //if (eventSensorType == 192 && eventOffset == 0 && eventDataField[0] == 170 && eventDataField[1] == 48) + //{ + // if (eventDataField[2] == 0) return "A remote Serial Over LAN session was established."; + // if (eventDataField[2] == 1) return "Remote Serial Over LAN session finished. User control was restored."; + // if (eventDataField[2] == 2) return "A remote IDE-Redirection session was established."; + // if (eventDataField[2] == 3) return "Remote IDE-Redirection session finished. User control was restored."; + //} - if (eventSensorType == 36) - { - var handle = (eventDataField[1] << 24) + (eventDataField[2] << 16) + (eventDataField[3] << 8) + eventDataField[4]; - var nic = '#' + eventDataField[0]; - if (eventDataField[0] == 0xAA) nic = "wired"; // TODO: Add wireless ***** - //if (eventDataField[0] == 0xAA) nic = "wireless"; + //if (eventSensorType == 36) + //{ + // long handle = ((long)(eventDataField[1]) << 24) + ((long)(eventDataField[2]) << 16) + ((long)(eventDataField[3]) << 8) + (long)(eventDataField[4]); + // string nic = string.Format("#{0}", eventDataField[0]); + // if (eventDataField[0] == 0xAA) nic = "wired"; // TODO: Add wireless ***** + // //if (eventDataField[0] == 0xAA) nic = "wireless"; - if (handle == 4294967293) { return "All received packet filter was matched on " + nic + " interface."; } - if (handle == 4294967292) { return "All outbound packet filter was matched on " + nic + " interface."; } - if (handle == 4294967290) { return "Spoofed packet filter was matched on " + nic + " interface."; } - return "Filter " + handle + " was matched on " + nic + " interface."; - } + // if (handle == 4294967293) { return string.Format("All received packet filter was matched on {0} interface.", nic); } + // if (handle == 4294967292) { return string.Format("All outbound packet filter was matched on {0} interface.", nic); } + // if (handle == 4294967290) { return string.Format("Spoofed packet filter was matched on {0} interface.", nic); } + // return string.Format("Filter {0} was matched on {1} interface.", handle, nic); + //} - if (eventSensorType == 192) { - if (eventDataField[2] == 0) return "Security policy invoked. Some or all network traffic (TX) was stopped."; - if (eventDataField[2] == 2) return "Security policy invoked. Some or all network traffic (RX) was stopped."; - return "Security policy invoked."; - } + //if (eventSensorType == 192) + //{ + // if (eventDataField[2] == 0) return "Security policy invoked. Some or all network traffic (TX) was stopped."; + // if (eventDataField[2] == 2) return "Security policy invoked. Some or all network traffic (RX) was stopped."; + // return "Security policy invoked."; + //} - if (eventSensorType == 193) { - if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x30) && (eventDataField[2] == 0x00) && (eventDataField[3] == 0x00)) { return "User request for remote connection."; } - if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x20) && (eventDataField[2] == 0x03) && (eventDataField[3] == 0x01)) { return "EAC error: attempt to get posture while NAC in Intel(r) AMT is disabled."; } // eventDataField = 0xAA20030100000000 - if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x20) && (eventDataField[2] == 0x04) && (eventDataField[3] == 0x00)) { return "Certificate revoked. "; } - } + //if (eventSensorType == 193) + //{ + // if (eventDataField[0] == 0xAA && eventDataField[1] == 0x30 && eventDataField[2] == 0x00 && eventDataField[3] == 0x00) { return "User request for remote connection."; } + // if (eventDataField[0] == 0xAA && eventDataField[1] == 0x20 && eventDataField[2] == 0x03 && eventDataField[3] == 0x01) { return "EAC error: attempt to get posture while NAC in Intel(r) AMT is disabled."; // eventDataField = 0xAA20030100000000 } + // if (eventDataField[0] == 0xAA && eventDataField[1] == 0x20 && eventDataField[2] == 0x04 && eventDataField[3] == 0x00) { return "Certificate revoked. "; } + //} if (eventSensorType == 6) return "Authentication failed " + (eventDataField[1] + (eventDataField[2] << 8)) + " times. The system may be under attack."; if (eventSensorType == 30) return "No bootable media"; @@ -709,12 +671,9 @@ function AmtStackCreateService(wsmanStack) { 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", - 2703: "An existing profile sync was modified", - 2704: "An existing profile link preference was changed", - 2705: "Wireless profile share with UEFI enabled setting was changed", + 2700: 'Wireless Profile Added', + 2701: 'Wireless Profile Removed', + 2702: 'Wireless Profile Updated', 2800: 'EAC Posture Signer SET', 2801: 'EAC Enabled', 2802: 'EAC Disabled', @@ -813,6 +772,7 @@ function AmtStackCreateService(wsmanStack) { // Read network access x['MCLocationType'] = e[ptr++]; var netlen = e[ptr++]; + x['NetAddress'] = e.slice(ptr, ptr + netlen).toString(); // Read extended data @@ -1027,8 +987,8 @@ function AmtStackCreateService(wsmanStack) { // Convert a byte array of SID into string function GetSidString(sid) { - var r = 'S-' + sid[0] + '-' + sid[7]; - for (var i = 2; i < (sid.length / 4); i++) r += '-' + ReadIntX(sid, i * 4); + var r = "S-" + sid.charCodeAt(0) + "-" + sid.charCodeAt(7); + for (var i = 2; i < (sid.length / 4); i++) r += "-" + ReadIntX(sid, i * 4); return r; } diff --git a/agents/modules_meshcmd/smbios.js b/agents/modules_meshcmd/smbios.js index 2391b8e9..b149e907 100644 --- a/agents/modules_meshcmd/smbios.js +++ b/agents/modules_meshcmd/smbios.js @@ -269,18 +269,15 @@ function SMBiosTables() this.amtInfo = function amtInfo(data) { if (!data) { throw ('no data'); } var retVal = { AMT: false }; - if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT') - { + if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT') { var amt = data[130].peek(); retVal.AMT = amt[4] ? true : false; - if (retVal.AMT) - { + if (retVal.AMT) { retVal.enabled = amt[5] ? true : false; retVal.storageRedirection = amt[6] ? true : false; retVal.serialOverLan = amt[7] ? true : false; retVal.kvm = amt[14] ? true : false; - if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') - { + if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') { var settings = data[131].peek(); if (settings[0] & 0x04) { retVal.TXT = (settings[0] & 0x08) ? true : false; } if (settings[0] & 0x10) { retVal.VMX = (settings[0] & 0x20) ? true : false; } @@ -298,14 +295,6 @@ function SMBiosTables() } } } - if (!retVal.AMT) - { - if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') - { - var settings = data[131].peek(); - if ((settings[20] & 0x08) == 0x08) { retVal.AMT = true; } - } - } return (retVal); }; this.smTableTypes = { diff --git a/agents/modules_meshcmd/sysinfo.js b/agents/modules_meshcmd/sysinfo.js index 611a7b1a..02c355d9 100644 --- a/agents/modules_meshcmd/sysinfo.js +++ b/agents/modules_meshcmd/sysinfo.js @@ -225,14 +225,19 @@ function macos_memUtilization() function windows_thermals() { var ret = []; - try { - ret = require('win-wmi').query('ROOT\\WMI', 'SELECT CurrentTemperature,InstanceName FROM MSAcpi_ThermalZoneTemperature',['CurrentTemperature','InstanceName']); - if (ret[0]) { - for (var i = 0; i < ret.length; ++i) { - ret[i]['CurrentTemperature'] = ((parseFloat(ret[i]['CurrentTemperature']) / 10) - 273.15).toFixed(2); - } + child = require('child_process').execFile(process.env['windir'] + '\\System32\\wbem\\wmic.exe', ['wmic', '/namespace:\\\\root\\wmi', 'PATH', 'MSAcpi_ThermalZoneTemperature', 'get', 'CurrentTemperature']); + child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); + child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); + child.waitExit(); + + if(child.stdout.str.trim!='') + { + var lines = child.stdout.str.trim().split('\r\n'); + for (var i = 1; i < lines.length; ++i) + { + if (lines[i].trim() != '') { ret.push(((parseFloat(lines[i]) / 10) - 273.15).toFixed(2)); } } - } catch (ex) { } + } return (ret); } @@ -280,10 +285,16 @@ function macos_thermals() return (ret); } -const platformConfig = { - linux: { cpuUtilization: linux_cpuUtilization, memUtilization: linux_memUtilization, thermals: linux_thermals }, - win32: { cpuUtilization: windows_cpuUtilization, memUtilization: windows_memUtilization, thermals: windows_thermals }, - darwin: { cpuUtilization: macos_cpuUtilization, memUtilization: macos_memUtilization, thermals: macos_thermals } -}; +switch(process.platform) +{ + case 'linux': + module.exports = { cpuUtilization: linux_cpuUtilization, memUtilization: linux_memUtilization, thermals: linux_thermals }; + break; + case 'win32': + module.exports = { cpuUtilization: windows_cpuUtilization, memUtilization: windows_memUtilization, thermals: windows_thermals }; + break; + case 'darwin': + module.exports = { cpuUtilization: macos_cpuUtilization, memUtilization: macos_memUtilization, thermals: macos_thermals }; + break; +} -module.exports = platformConfig[process.platform]; diff --git a/agents/modules_meshcore/computer-identifiers.js b/agents/modules_meshcore/computer-identifiers.js deleted file mode 100644 index ce5e3520..00000000 --- a/agents/modules_meshcore/computer-identifiers.js +++ /dev/null @@ -1,902 +0,0 @@ -/* -Copyright 2019-2021 Intel Corporation - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -function trimIdentifiers(val) -{ - for(var v in val) - { - if (!val[v] || val[v] == 'None' || val[v] == '') { delete val[v]; } - } -} -function trimResults(val) -{ - var i, x; - for (i = 0; i < val.length; ++i) - { - for (x in val[i]) - { - if (x.startsWith('_')) - { - delete val[i][x]; - } - else - { - if (val[i][x] == null || val[i][x] == 0) - { - delete val[i][x]; - } - } - } - } -} -function brief(headers, obj) -{ - var i, x; - for (x = 0; x < obj.length; ++x) - { - for (i in obj[x]) - { - if (!headers.includes(i)) - { - delete obj[x][i]; - } - } - } - return (obj); -} - -function dataHandler(c) -{ - this.str += c.toString(); -} - -function linux_identifiers() -{ - var identifiers = {}; - var ret = {}; - var values = {}; - - if (!require('fs').existsSync('/sys/class/dmi/id')) { - if (require('fs').existsSync('/sys/firmware/devicetree/base/model')) { - if (require('fs').readFileSync('/sys/firmware/devicetree/base/model').toString().trim().startsWith('Raspberry')) { - identifiers['board_vendor'] = 'Raspberry Pi'; - identifiers['board_name'] = require('fs').readFileSync('/sys/firmware/devicetree/base/model').toString().trim(); - identifiers['board_serial'] = require('fs').readFileSync('/sys/firmware/devicetree/base/serial-number').toString().trim(); - const memorySlots = []; - var child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stdin.write('vcgencmd get_mem arm && vcgencmd get_mem gpu\nexit\n'); - child.waitExit(); - try { - const lines = child.stdout.str.trim().split('\n'); - if (lines.length == 2) { - memorySlots.push({ Locator: "ARM Memory", Size: lines[0].split('=')[1].trim() }) - memorySlots.push({ Locator: "GPU Memory", Size: lines[1].split('=')[1].trim() }) - ret.memory = { Memory_Device: memorySlots }; - } - } catch (xx) { } - } else { - throw('Unknown board'); - } - } else { - throw ('this platform does not have DMI statistics'); - } - } else { - var entries = require('fs').readdirSync('/sys/class/dmi/id'); - for (var i in entries) { - if (require('fs').statSync('/sys/class/dmi/id/' + entries[i]).isFile()) { - try { - ret[entries[i]] = require('fs').readFileSync('/sys/class/dmi/id/' + entries[i]).toString().trim(); - } catch(z) { } - if (ret[entries[i]] == 'None') { delete ret[entries[i]]; } - } - } - entries = null; - - identifiers['bios_date'] = ret['bios_date']; - identifiers['bios_vendor'] = ret['bios_vendor']; - identifiers['bios_version'] = ret['bios_version']; - identifiers['bios_serial'] = ret['product_serial']; - identifiers['board_name'] = ret['board_name']; - identifiers['board_serial'] = ret['board_serial']; - identifiers['board_vendor'] = ret['board_vendor']; - identifiers['board_version'] = ret['board_version']; - identifiers['product_uuid'] = ret['product_uuid']; - identifiers['product_name'] = ret['product_name']; - } - - try { - identifiers['bios_mode'] = (require('fs').statSync('/sys/firmware/efi').isDirectory() ? 'UEFI': 'Legacy'); - } catch (ex) { identifiers['bios_mode'] = 'Legacy'; } - - var child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stdin.write('cat /proc/cpuinfo | grep -i "model name" | ' + "tr '\\n' ':' | awk -F: '{ print $2 }'\nexit\n"); - child.waitExit(); - identifiers['cpu_name'] = child.stdout.str.trim(); - if (identifiers['cpu_name'] == "") { // CPU BLANK, check lscpu instead - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stdin.write('lscpu | grep -i "model name" | ' + "tr '\\n' ':' | awk -F: '{ print $2 }'\nexit\n"); - child.waitExit(); - identifiers['cpu_name'] = child.stdout.str.trim(); - } - child = null; - - - // Fetch GPU info - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stdin.write("lspci | grep ' VGA ' | tr '\\n' '`' | awk '{ a=split($0,lines" + ',"`"); printf "["; for(i=1;i1 {printf "{\\"size\\":\\"%s\\",\\"used\\":\\"%s\\",\\"available\\":\\"%s\\",\\"mount_point\\":\\"%s\\",\\"type\\":\\"%s\\"},", $1, $2, $3, $4, $5}\' | sed \'$ s/,$//\' | awk \'BEGIN {printf "["} {printf "%s", $0} END {printf "]"}\'\nexit\n'); - child.waitExit(); - try { ret.volumes = JSON.parse(child.stdout.str.trim()); } catch (xx) { } - child = null; - - values.identifiers = identifiers; - values.linux = ret; - trimIdentifiers(values.identifiers); - - var dmidecode = require('lib-finder').findBinary('dmidecode'); - if (dmidecode != null) - { - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stderr.str = ''; child.stderr.on('data', dataHandler); - child.stdin.write(dmidecode + " -t memory | tr '\\n' '`' | "); - child.stdin.write(" awk '{ "); - child.stdin.write(' printf("[");'); - child.stdin.write(' comma="";'); - child.stdin.write(' c=split($0, lines, "``");'); - child.stdin.write(' for(i=1;i<=c;++i)'); - child.stdin.write(' {'); - child.stdin.write(' d=split(lines[i], val, "`");'); - child.stdin.write(' split(val[1], tokens, ",");'); - child.stdin.write(' split(tokens[2], dmitype, " ");'); - child.stdin.write(' dmi = dmitype[3]+0; '); - child.stdin.write(' if(dmi == 5 || dmi == 6 || dmi == 16 || dmi == 17)'); - child.stdin.write(' {'); - child.stdin.write(' ccx="";'); - child.stdin.write(' printf("%s{\\"%s\\": {", comma, val[2]);'); - child.stdin.write(' for(j=3;j1)'); - child.stdin.write(' {'); - child.stdin.write(' sub(/^[ \\t]*/,"",tmp[2]);'); - child.stdin.write(' gsub(/ /,"",tmp[1]);'); - child.stdin.write(' printf("%s\\"%s\\": \\"%s\\"", ccx, tmp[1], tmp[2]);'); - child.stdin.write(' ccx=",";'); - child.stdin.write(' }'); - child.stdin.write(' }'); - child.stdin.write(' printf("}}");'); - child.stdin.write(' comma=",";'); - child.stdin.write(' }'); - child.stdin.write(' }'); - child.stdin.write(' printf("]");'); - child.stdin.write("}'\nexit\n"); - child.waitExit(); - - try - { - var j = JSON.parse(child.stdout.str); - var i, key, key2; - for (i = 0; i < j.length; ++i) - { - for (key in j[i]) - { - delete j[i][key]['ArrayHandle']; - delete j[i][key]['ErrorInformationHandle']; - for (key2 in j[i][key]) - { - if (j[i][key][key2] == 'Unknown' || j[i][key][key2] == 'Not Specified' || j[i][key][key2] == '') - { - delete j[i][key][key2]; - } - } - } - } - - if(j.length > 0){ - var mem = {}; - for (i = 0; i < j.length; ++i) - { - for (key in j[i]) - { - if (mem[key] == null) { mem[key] = []; } - mem[key].push(j[i][key]); - } - } - values.linux.memory = mem; - } - } - catch (e) - { } - child = null; - } - - var usbdevices = require('lib-finder').findBinary('usb-devices'); - if (usbdevices != null) - { - var child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stderr.str = ''; child.stderr.on('data', dataHandler); - child.stdin.write(usbdevices + " | tr '\\n' '`' | "); - child.stdin.write(" awk '"); - child.stdin.write('{'); - child.stdin.write(' comma="";'); - child.stdin.write(' printf("[");'); - child.stdin.write(' len=split($0, group, "``");'); - child.stdin.write(' for(i=1;i<=len;++i)'); - child.stdin.write(' {'); - child.stdin.write(' comma2="";'); - child.stdin.write(' xlen=split(group[i], line, "`");'); - child.stdin.write(' scount=0;'); - child.stdin.write(' for(x=1;x0)'); - child.stdin.write(' {'); - child.stdin.write(' printf("%s{", comma); comma=",";'); - child.stdin.write(' for(x=1;x> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); }; - try { - values = require('win-wmi').query('ROOT\\CIMV2\\Security\\MicrosoftTpm', "SELECT * FROM Win32_Tpm", ['IsActivated_InitialValue','IsEnabled_InitialValue','IsOwned_InitialValue','ManufacturerId','ManufacturerVersion','SpecVersion']); - if(values[0]) { - ret.tpm = { - SpecVersion: values[0].SpecVersion.split(",")[0], - ManufacturerId: IntToStr(values[0].ManufacturerId).replace(/[^\x00-\x7F]/g, ""), - ManufacturerVersion: values[0].ManufacturerVersion, - IsActivated: values[0].IsActivated_InitialValue, - IsEnabled: values[0].IsEnabled_InitialValue, - IsOwned: values[0].IsOwned_InitialValue, - } - } - } catch (ex) { } - - return (ret); -} -function macos_identifiers() -{ - var ret = { identifiers: {}, darwin: {} }; - var child; - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('ioreg -d2 -c IOPlatformExpertDevice | grep board-id | awk -F= \'{ split($2, res, "\\""); print res[2]; }\'\nexit\n'); - child.waitExit(); - ret.identifiers.board_name = child.stdout.str.trim(); - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('ioreg -d2 -c IOPlatformExpertDevice | grep IOPlatformSerialNumber | awk -F= \'{ split($2, res, "\\""); print res[2]; }\'\nexit\n'); - child.waitExit(); - ret.identifiers.board_serial = child.stdout.str.trim(); - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('ioreg -d2 -c IOPlatformExpertDevice | grep manufacturer | awk -F= \'{ split($2, res, "\\""); print res[2]; }\'\nexit\n'); - child.waitExit(); - ret.identifiers.board_vendor = child.stdout.str.trim(); - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('ioreg -d2 -c IOPlatformExpertDevice | grep version | awk -F= \'{ split($2, res, "\\""); print res[2]; }\'\nexit\n'); - child.waitExit(); - ret.identifiers.board_version = child.stdout.str.trim(); - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('ioreg -d2 -c IOPlatformExpertDevice | grep IOPlatformUUID | awk -F= \'{ split($2, res, "\\""); print res[2]; }\'\nexit\n'); - child.waitExit(); - ret.identifiers.product_uuid = child.stdout.str.trim(); - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('sysctl -n machdep.cpu.brand_string\nexit\n'); - child.waitExit(); - ret.identifiers.cpu_name = child.stdout.str.trim(); - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('system_profiler SPMemoryDataType\nexit\n'); - child.waitExit(); - var lines = child.stdout.str.trim().split('\n'); - if(lines.length > 0) { - const memorySlots = []; - if(lines[2].trim().includes('Memory Slots:')) { // OLD MACS WITH SLOTS - var memorySlots1 = child.stdout.str.split(/\n{2,}/).slice(3); - memorySlots1.forEach(function(slot,index) { - var lines = slot.split('\n'); - if(lines.length == 1){ // start here - if(lines[0].trim()!=''){ - var slotObj = { DeviceLocator: lines[0].trim().replace(/:$/, '') }; // Initialize name as an empty string - var nextline = memorySlots1[index+1].split('\n'); - nextline.forEach(function(line) { - if (line.trim() !== '') { - var parts = line.split(':'); - var key = parts[0].trim(); - var value = parts[1].trim(); - value = (key == 'Part Number' || key == 'Manufacturer') ? hexToAscii(parts[1].trim()) : parts[1].trim(); - slotObj[key.replace(' ','')] = value; // Store attribute in the slot object - } - }); - memorySlots.push(slotObj); - } - } - }); - } else { // NEW MACS WITHOUT SLOTS - memorySlots.push({ DeviceLocator: "Onboard Memory", Size: lines[2].split(":")[1].trim(), PartNumber: lines[3].split(":")[1].trim(), Manufacturer: lines[4].split(":")[1].trim() }) - } - ret.darwin.memory = memorySlots; - } - - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('diskutil info -all\nexit\n'); - child.waitExit(); - var sections = child.stdout.str.split('**********\n'); - if(sections.length > 0){ - var devices = []; - for (var i = 0; i < sections.length; i++) { - var lines = sections[i].split('\n'); - var deviceInfo = {}; - var wholeYes = false; - var physicalYes = false; - var oldmac = false; - for (var j = 0; j < lines.length; j++) { - var keyValue = lines[j].split(':'); - var key = keyValue[0].trim(); - var value = keyValue[1] ? keyValue[1].trim() : ''; - if (key === 'Virtual') oldmac = true; - if (key === 'Whole' && value === 'Yes') wholeYes = true; - if (key === 'Virtual' && value === 'No') physicalYes = true; - if(value && key === 'Device / Media Name'){ - deviceInfo['Caption'] = value; - } - if(value && key === 'Disk Size'){ - deviceInfo['Size'] = value.split(' ')[0] + ' ' + value.split(' ')[1]; - } - } - if (wholeYes) { - if (oldmac) { - if (physicalYes) devices.push(deviceInfo); - } else { - devices.push(deviceInfo); - } - } - } - ret.identifiers.storage_devices = devices; - } - - // Fetch storage volumes using df - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stdin.write('df -aHY | awk \'NR>1 {printf "{\\"size\\":\\"%s\\",\\"used\\":\\"%s\\",\\"available\\":\\"%s\\",\\"mount_point\\":\\"%s\\",\\"type\\":\\"%s\\"},", $3, $4, $5, $10, $2}\' | sed \'$ s/,$//\' | awk \'BEGIN {printf "["} {printf "%s", $0} END {printf "]"}\'\nexit\n'); - child.waitExit(); - try { - ret.darwin.volumes = JSON.parse(child.stdout.str.trim()); - for (var index = 0; index < ret.darwin.volumes.length; index++) { - if (ret.darwin.volumes[index].type == 'auto_home'){ - ret.darwin.volumes.splice(index,1); - } - } - if (ret.darwin.volumes.length == 0) { // not sonima OS so dont show type for now - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', dataHandler); - child.stdin.write('df -aH | awk \'NR>1 {printf "{\\"size\\":\\"%s\\",\\"used\\":\\"%s\\",\\"available\\":\\"%s\\",\\"mount_point\\":\\"%s\\"},", $2, $3, $4, $9}\' | sed \'$ s/,$//\' | awk \'BEGIN {printf "["} {printf "%s", $0} END {printf "]"}\'\nexit\n'); - child.waitExit(); - try { - ret.darwin.volumes = JSON.parse(child.stdout.str.trim()); - for (var index = 0; index < ret.darwin.volumes.length; index++) { - if (ret.darwin.volumes[index].size == 'auto_home'){ - ret.darwin.volumes.splice(index,1); - } - } - } catch (xx) { } - } - } catch (xx) { } - child = null; - - // MacOS Last Boot Up Time - try { - child = require('child_process').execFile('/usr/sbin/sysctl', ['', 'kern.boottime']); // must include blank value at begining for some reason? - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stderr.on('data', function () { }); - child.waitExit(); - const timestampMatch = /\{ sec = (\d+), usec = \d+ \}/.exec(child.stdout.str.trim()); - if (!ret.darwin) { - ret.darwin = { LastBootUpTime: parseInt(timestampMatch[1]) }; - } else { - ret.darwin.LastBootUpTime = parseInt(timestampMatch[1]); - } - child = null; - } catch (ex) { } - - trimIdentifiers(ret.identifiers); - - child = null; - return (ret); -} - -function hexToAscii(hexString) { - if(!hexString.startsWith('0x')) return hexString.trim(); - hexString = hexString.startsWith('0x') ? hexString.slice(2) : hexString; - var str = ''; - for (var i = 0; i < hexString.length; i += 2) { - var hexPair = hexString.substr(i, 2); - str += String.fromCharCode(parseInt(hexPair, 16)); - } - str = str.replace(/[\u007F-\uFFFF]/g, ''); // Remove characters from 0x0080 to 0xFFFF - return str.trim(); -} - -function win_chassisType() -{ - // needs to be replaced with win-wmi but due to bug in win-wmi it doesnt handle arrays correctly - var child = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], {}); - if (child == null) { return ([]); } - child.descriptorMetadata = 'process-manager'; - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write('Get-WmiObject Win32_SystemEnclosure | Select-Object -ExpandProperty ChassisTypes\r\n'); - child.stdin.write('exit\r\n'); - child.waitExit(); - try { - return (parseInt(child.stdout.str)); - } catch (e) { - return (2); // unknown - } -} - -function win_systemType() -{ - try { - var tokens = require('win-wmi').query('ROOT\\CIMV2', 'SELECT PCSystemType FROM Win32_ComputerSystem', ['PCSystemType']); - if (tokens[0]) { - return (parseInt(tokens[0]['PCSystemType'])); - } else { - return (parseInt(1)); // default is desktop - } - } catch (ex) { - return (parseInt(1)); // default is desktop - } - -} - -function win_formFactor(chassistype) -{ - var ret = 'DESKTOP'; - switch (chassistype) - { - case 11: // Handheld - case 30: // Tablet - case 31: // Convertible - case 32: // Detachable - ret = 'TABLET'; - break; - case 9: // Laptop - case 10: // Notebook - case 14: // Sub Notebook - ret = 'LAPTOP'; - break; - default: - ret = win_systemType() == 2 ? 'MOBILE' : 'DESKTOP'; - break; - } - - return (ret); -} - -switch(process.platform) -{ - case 'linux': - module.exports = { _ObjectID: 'identifiers', get: linux_identifiers }; - break; - case 'win32': - module.exports = { _ObjectID: 'identifiers', get: windows_identifiers, chassisType: win_chassisType, formFactor: win_formFactor, systemType: win_systemType }; - break; - case 'darwin': - module.exports = { _ObjectID: 'identifiers', get: macos_identifiers }; - break; - default: - module.exports = { get: function () { throw ('Unsupported Platform'); } }; - break; -} -module.exports.isDocker = function isDocker() -{ - if (process.platform != 'linux') { return (false); } - - var child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write("cat /proc/self/cgroup | tr '\n' '`' | awk -F'`' '{ split($1, res, " + '"/"); if(res[2]=="docker"){print "1";} }\'\nexit\n'); - child.waitExit(); - return (child.stdout.str != ''); -}; -module.exports.isBatteryPowered = function isBatteryOperated() -{ - var ret = false; - switch(process.platform) - { - default: - break; - case 'linux': - var devices = require('fs').readdirSync('/sys/class/power_supply'); - for (var i in devices) - { - if (require('fs').readFileSync('/sys/class/power_supply/' + devices[i] + '/type').toString().trim() == 'Battery') - { - ret = true; - break; - } - } - break; - case 'win32': - var GM = require('_GenericMarshal'); - var stats = GM.CreateVariable(12); - var kernel32 = GM.CreateNativeProxy('Kernel32.dll'); - kernel32.CreateMethod('GetSystemPowerStatus'); - if (kernel32.GetSystemPowerStatus(stats).Val != 0) - { - if(stats.toBuffer()[1] != 128 && stats.toBuffer()[1] != 255) - { - ret = true; - } - else - { - // No Battery detected, so lets check if there is supposed to be one - var formFactor = win_formFactor(win_chassisType()); - return (formFactor == 'LAPTOP' || formFactor == 'TABLET' || formFactor == 'MOBILE'); - } - } - break; - case 'darwin': - var child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function(c){ this.str += c.toString(); }); - child.stderr.str = ''; child.stderr.on('data', function(c){ this.str += c.toString(); }); - child.stdin.write("pmset -g batt | tr '\\n' '`' | awk -F'`' '{ if(NF>2) { print \"true\"; }}'\nexit\n"); - child.waitExit(); - if(child.stdout.str.trim() != '') { ret = true; } - break; - } - return (ret); -}; -module.exports.isVM = function isVM() -{ - var ret = false; - var id = this.get(); - if (id.linux && id.linux.sys_vendor) - { - switch (id.linux.sys_vendor) - { - case 'VMware, Inc.': - case 'QEMU': - case 'Xen': - ret = true; - break; - default: - break; - } - } - if (id.identifiers.bios_vendor) - { - switch(id.identifiers.bios_vendor) - { - case 'VMware, Inc.': - case 'Xen': - case 'SeaBIOS': - case 'EFI Development Kit II / OVMF': - case 'Proxmox distribution of EDK II': - ret = true; - break; - default: - break; - } - } - if (id.identifiers.board_vendor && id.identifiers.board_vendor == 'VMware, Inc.') { ret = true; } - if (id.identifiers.board_name) - { - switch (id.identifiers.board_name) - { - case 'VirtualBox': - case 'Virtual Machine': - ret = true; - break; - default: - break; - } - } - - if (process.platform == 'win32' && !ret) - { - for(var i in id.identifiers.gpu_name) - { - if(id.identifiers.gpu_name[i].startsWith('VMware ')) - { - ret = true; - break; - } - } - } - - - if (!ret) { ret = this.isDocker(); } - return (ret); -}; - -// bios_date = BIOS->ReleaseDate -// bios_vendor = BIOS->Manufacturer -// bios_version = BIOS->SMBIOSBIOSVersion -// board_name = BASEBOARD->Product = ioreg/board-id -// board_serial = BASEBOARD->SerialNumber = ioreg/serial-number | ioreg/IOPlatformSerialNumber -// board_vendor = BASEBOARD->Manufacturer = ioreg/manufacturer -// board_version = BASEBOARD->Version diff --git a/agents/modules_meshcore/coretranslations.json b/agents/modules_meshcore/coretranslations.json index 567a08f8..c1e2ecf2 100644 --- a/agents/modules_meshcore/coretranslations.json +++ b/agents/modules_meshcore/coretranslations.json @@ -110,14 +110,10 @@ "ko": { "allow": "허용하다", "deny": "거부", - "terminalNotify": "{0}이(가) 원격 터미널 세션을 시작했습니다.", - "desktopNotify": "{0}이(가) 원격 데스크톱 세션을 시작했습니다.", - "fileNotify": "{0}이(가) 원격 파일 세션을 시작했습니다.", - "privacyBar": "다음과 데스크톱 공유: {0}", - "autoAllowForFive": "다음 5분 동안 모든 연결 자동 수락", - "terminalConsent": "{0} 원격 터미널 액세스를 요청합니다. 액세스 권한을 부여하시겠습니까?", - "desktopConsent": "{0} 원격 데스크톱 액세스를 요청합니다. 액세스 권한을 부여하시겠습니까?", - "fileConsent": "{0}이(가) 원격 파일 액세스를 요청합니다. 액세스 권한을 부여하시겠습니까?" + "terminalNotify": "원격 터미널 세션이 시작되었습니다: {0}", + "desktopNotify": "원격 데스크톱 세션이 시작되었습니다: {0}", + "fileNotify": "원격 파일 전송 세션이 시작되었습니다: {0}", + "privacyBar": "다음과 데스크탑 공유: {0}" }, "nl": { "allow": "Toestaan", @@ -133,15 +129,7 @@ }, "pt": { "allow": "Permitir", - "deny": "Negar", - "autoAllowForFive": "Aceita automaticamente todas as conexões pelos próximos 5 minutos", - "terminalConsent": "{0} está a pedir acesso ao terminal remoto. Conceder acesso?", - "desktopConsent": "{0} está a pedir acesso à área de trabalho remota. Conceder acesso?", - "fileConsent": "{0} está a pedir acesso remoto aos ficheiros. Conceder acesso?", - "terminalNotify": "{0} iniciou uma sessão de terminal remoto.", - "desktopNotify": "{0} iniciou uma sessão de área de trabalho remota.", - "fileNotify": "{0} iniciou uma sessão de ficheiro remoto.", - "privacyBar": "Compartilhando área de trabalho com: {0}" + "deny": "Negar" }, "ru": { "allow": "Разрешить", @@ -157,15 +145,7 @@ }, "sv": { "allow": "Tillåta", - "deny": "Förneka", - "autoAllowForFive": "Acceptera alla anslutningar automatiskt under de kommande 5 minuterna", - "terminalConsent": "{0} begär åtkomst till fjärrterminal. Ge tillgång?", - "desktopConsent": "{0} begär åtkomst till fjärrskrivbord. Ge tillgång?", - "fileConsent": "{0} begär fjärråtkomst till fil. Ge tillgång?", - "terminalNotify": "{0} startade en fjärrterminalsession.", - "desktopNotify": "{0} startade en fjärrskrivbordssession.", - "fileNotify": "{0} startade en fjärrfilsession.", - "privacyBar": "Dela skrivbord med: {0}" + "deny": "Förneka" }, "tr": { "allow": "İzin ver", @@ -181,15 +161,7 @@ }, "zh-chs": { "allow": "允许", - "deny": "否定", - "autoAllowForFive": "在接下来的 5 分钟内自动接受所有连接", - "terminalConsent": "{0} 请求远程终端访问。授予访问权限?", - "desktopConsent": "{0} 请求远程桌面访问。授予访问权限?", - "fileConsent": "{0} 请求远程文件访问。授予访问权限?", - "terminalNotify": "{0} 启动了远程终端会话。", - "desktopNotify": "{0} 启动了远程桌面会话。", - "fileNotify": "{0} 启动了远程文件会话。", - "privacyBar": "与:{0} 共享桌面" + "deny": "否定" }, "da": { "allow": "Tillad", @@ -226,65 +198,5 @@ "desktopNotify": "{0} iniciou uma sessão de área de trabalho remota.", "fileNotify": "{0} {0} iniciou uma sessão de arquivos.", "privacyBar": "Compartilhando área de trabalho com: {0}" - }, - "zh-cht": { - "allow": "允許", - "deny": "否定", - "autoAllowForFive": "在接下來的 5 分鐘內自動接受所有連接", - "terminalConsent": "{0} 請求遠程終端訪問。授予訪問權限?", - "desktopConsent": "{0} 請求遠程桌面訪問。授予訪問權限?", - "fileConsent": "{0} 請求遠程文件訪問。授予訪問權限?", - "terminalNotify": "{0} 啟動了遠程終端會話。", - "desktopNotify": "{0} 啟動了遠程桌面會話。", - "fileNotify": "{0} 啟動了遠程文件會話。", - "privacyBar": "與:{0} 共享桌面" - }, - "bs": { - "allow": "Dopustiti", - "deny": "Deny", - "autoAllowForFive": "Automatski prihvati sve veze u narednih 5 minuta", - "terminalConsent": "{0} zahtijeva pristup udaljenom terminalu. Odobriti pristup?", - "desktopConsent": "{0} zahtijeva pristup udaljenoj radnoj površini. Odobriti pristup?", - "fileConsent": "{0} zahtijeva udaljeni pristup fajlu. Odobriti pristup?", - "terminalNotify": "{0} je započeo sesiju udaljenog terminala.", - "desktopNotify": "{0} je započeo sesiju udaljene radne površine.", - "fileNotify": "{0} je započeo sesiju udaljenog fajla.", - "privacyBar": "Dijeljenje radne površine sa: {0}" - }, - "hu": { - "allow": "Engedélyezés", - "deny": "Elutasítás", - "autoAllowForFive": "Csatlakozások automatikus elfogadása a következő 5 percben", - "terminalConsent": "{0} távoli parancssor,terminál hozzáférést kér. Engedélyezi a hozzáférést?", - "desktopConsent": "{0} távoli asztali hozzáférést kér. Engedélyezi a hozzáférést?", - "fileConsent": "{0} távoli fájlhozzáférést kér. Engedélyezi a hozzáférést?", - "terminalNotify": "{0} távoli parancssor munkamenetet indított.", - "desktopNotify": "{0} távoli asztali munkamenetet indított.", - "fileNotify": "{0} távoli fájlmunkamenetet indított.", - "privacyBar": "Asztal megosztás aktív: {0} felhasználóval" - }, - "ca": { - "allow": "Permetre", - "deny": "Negar", - "autoAllowForFive": "Accepta automàticament totes les connexions durant els propers 5 minuts", - "terminalConsent": "{0} sol·licitant accés al terminal remot. Accés garantit?", - "desktopConsent": "{0} sol·licitant accés a l'escriptori remot. Accés garantit?", - "fileConsent": "{0} sol·licitant accés remot al fitxer. Accés garantit?", - "terminalNotify": "{0} va iniciar una sessió de terminal remota.", - "desktopNotify": "{0} va iniciar una sessió d'escriptori remot.", - "fileNotify": "{0} va iniciar una sessió de fitxer remota.", - "privacyBar": "Compartint escriptori amb: {0}" - }, - "uk": { - "allow": "Дозволити", - "deny": "Відмовити", - "autoAllowForFive": "Автоматично приймати всі підключення впродовж наступних 5 хвилин", - "terminalConsent": "{0} запитує доступ до віддаленого терміналу. Надати доступ?", - "desktopConsent": "{0} запитує віддалений доступ до стільниці. Надати доступ?", - "fileConsent": "{0} запитує віддалений доступ до файлу. Надати доступ?", - "terminalNotify": "{0} почав сеанс віддаленого терміналу.", - "desktopNotify": "{0} розпочав сеанс віддаленої стільниці.", - "fileNotify": "{0} розпочав віддалений файловий сеанс.", - "privacyBar": "Поширити доступ до стільниці з: {0}" } } \ No newline at end of file diff --git a/agents/modules_meshcore/smbios.js b/agents/modules_meshcore/smbios.js index 2391b8e9..b149e907 100644 --- a/agents/modules_meshcore/smbios.js +++ b/agents/modules_meshcore/smbios.js @@ -269,18 +269,15 @@ function SMBiosTables() this.amtInfo = function amtInfo(data) { if (!data) { throw ('no data'); } var retVal = { AMT: false }; - if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT') - { + if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT') { var amt = data[130].peek(); retVal.AMT = amt[4] ? true : false; - if (retVal.AMT) - { + if (retVal.AMT) { retVal.enabled = amt[5] ? true : false; retVal.storageRedirection = amt[6] ? true : false; retVal.serialOverLan = amt[7] ? true : false; retVal.kvm = amt[14] ? true : false; - if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') - { + if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') { var settings = data[131].peek(); if (settings[0] & 0x04) { retVal.TXT = (settings[0] & 0x08) ? true : false; } if (settings[0] & 0x10) { retVal.VMX = (settings[0] & 0x20) ? true : false; } @@ -298,14 +295,6 @@ function SMBiosTables() } } } - if (!retVal.AMT) - { - if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') - { - var settings = data[131].peek(); - if ((settings[20] & 0x08) == 0x08) { retVal.AMT = true; } - } - } return (retVal); }; this.smTableTypes = { diff --git a/agents/modules_meshcore/sysinfo.js b/agents/modules_meshcore/sysinfo.js index cc13574d..02c355d9 100644 --- a/agents/modules_meshcore/sysinfo.js +++ b/agents/modules_meshcore/sysinfo.js @@ -159,7 +159,7 @@ function linux_memUtilization() case 'MemTotal:': ret.total = parseInt(tokens[tokens.length - 2]); break; - case 'MemAvailable:': + case 'MemFree:': ret.free = parseInt(tokens[tokens.length - 2]); break; } @@ -209,13 +209,9 @@ function macos_memUtilization() { var usage = lines[0].split(':')[1]; var bdown = usage.split(','); - if (bdown.length > 2){ // new style - PhysMem: 5750M used (1130M wired, 634M compressor), 1918M unused. - mem.MemFree = parseInt(bdown[2].trim().split(' ')[0]); - } else { // old style - PhysMem: 6683M used (1606M wired), 9699M unused. - mem.MemFree = parseInt(bdown[1].trim().split(' ')[0]); - } - mem.MemUsed = parseInt(bdown[0].trim().split(' ')[0]); - mem.MemTotal = (mem.MemFree + mem.MemUsed); + + mem.MemTotal = parseInt(bdown[0].trim().split(' ')[0]); + mem.MemFree = parseInt(bdown[1].trim().split(' ')[0]); mem.percentFree = ((mem.MemFree / mem.MemTotal) * 100);//.toFixed(2); mem.percentConsumed = (((mem.MemTotal - mem.MemFree) / mem.MemTotal) * 100);//.toFixed(2); return (mem); @@ -229,48 +225,31 @@ function macos_memUtilization() function windows_thermals() { var ret = []; - try { - ret = require('win-wmi').query('ROOT\\WMI', 'SELECT CurrentTemperature,InstanceName FROM MSAcpi_ThermalZoneTemperature',['CurrentTemperature','InstanceName']); - if (ret[0]) { - for (var i = 0; i < ret.length; ++i) { - ret[i]['CurrentTemperature'] = ((parseFloat(ret[i]['CurrentTemperature']) / 10) - 273.15).toFixed(2); - } + child = require('child_process').execFile(process.env['windir'] + '\\System32\\wbem\\wmic.exe', ['wmic', '/namespace:\\\\root\\wmi', 'PATH', 'MSAcpi_ThermalZoneTemperature', 'get', 'CurrentTemperature']); + child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); + child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); + child.waitExit(); + + if(child.stdout.str.trim!='') + { + var lines = child.stdout.str.trim().split('\r\n'); + for (var i = 1; i < lines.length; ++i) + { + if (lines[i].trim() != '') { ret.push(((parseFloat(lines[i]) / 10) - 273.15).toFixed(2)); } } - } catch (ex) { } + } return (ret); } function linux_thermals() { - var ret = []; child = require('child_process').execFile('/bin/sh', ['sh']); child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write("for folder in /sys/class/thermal/thermal_zone*/; do [ -e \"$folder/temp\" ] && echo \"$(cat \"$folder/temp\"),$(cat \"$folder/type\")\"; done\nexit\n"); + child.stdin.write("cat /sys/class/thermal/thermal_zone*/temp | awk '{ print $0 / 1000 }'\nexit\n"); child.waitExit(); - if(child.stdout.str.trim()!='') - { - var lines = child.stdout.str.trim().split('\n'); - for (var i = 0; i < lines.length; ++i) - { - var line = lines[i].trim().split(','); - ret.push({CurrentTemperature: (parseFloat(line[0])/1000), InstanceName: line[1]}); - } - } - child = require('child_process').execFile('/bin/sh', ['sh']); - child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); - child.stdin.write("for mon in /sys/class/hwmon/hwmon*; do for label in \"$mon\"/temp*_label; do if [ -f $label ]; then echo $(cat \"$label\")___$(cat \"${label%_*}_input\"); fi; done; done;\nexit\n"); - child.waitExit(); - if(child.stdout.str.trim()!='') - { - var lines = child.stdout.str.trim().split('\n'); - for (var i = 0; i < lines.length; ++i) - { - var line = lines[i].trim().split('___'); - ret.push({ CurrentTemperature: (parseFloat(line[1])/1000), InstanceName: line[0] }); - } - } + var ret = child.stdout.str.trim().split('\n'); + if (ret.length == 1 && ret[0] == '') { ret = []; } return (ret); } @@ -282,6 +261,7 @@ function macos_thermals() child.stderr.on('data', function () { }); child.stdin.write('powermetrics --help | grep SMC\nexit\n'); child.waitExit(); + if (child.stdout.str.trim() != '') { child = require('child_process').execFile('/bin/sh', ['sh']); @@ -293,19 +273,14 @@ function macos_thermals() { if (tokens[i].split(' die temperature: ').length > 1) { - ret.push({CurrentTemperature: tokens[i].split(' ')[3], InstanceName: tokens[i].split(' ')[0]}); + ret.push(tokens[i].split(' ')[3]); this.parent.kill(); } } }); - child.stderr.on('data', function (c) { - if (c.toString().split('unable to get smc values').length > 1) { // error getting sensors so just kill - this.parent.kill(); - return; - } - }); - child.stdin.write('powermetrics -s smc -i 500 -n 1\n'); - child.waitExit(2000); + child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); + child.stdin.write('powermetrics -s smc\n'); + child.waitExit(5000); } return (ret); } diff --git a/agents/modules_meshcore/win-deskutils.js b/agents/modules_meshcore/win-deskutils.js deleted file mode 100644 index 44e92f47..00000000 --- a/agents/modules_meshcore/win-deskutils.js +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2022 Intel Corporation -@author Bryan Roe - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// win-deskutils is a utility module that exposes various desktop related features for Windows -// such as MouseTrails Accessability and Windows Desktop Background -// - -// -// MSDN documention for the system call this module relies on can be found at: -// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa -// - -var SPI_GETDESKWALLPAPER = 0x0073; -var SPI_SETDESKWALLPAPER = 0x0014; -var SPI_GETMOUSETRAILS = 0x005E; -var SPI_SETMOUSETRAILS = 0x005D; - -var GM = require('_GenericMarshal'); -var user32 = GM.CreateNativeProxy('user32.dll'); -user32.CreateMethod('SystemParametersInfoA'); - -// -// This function is a helper method to dispatch method calls to different user sessions -// -function sessionDispatch(tsid, parent, method, args) -{ - // - // Check to see if the process owner of the current processor is root - // - var sid = undefined; - var stype = require('user-sessions').getProcessOwnerName(process.pid).tsid == 0 ? 1 : 0; - /* - The following is the list of possible values for stype. - If the current process owner is root, we set the stype to user, - because we cannot set/get any properties from this user, we - must switch to a user session.. Default behavior for stype(1) - is that it will context switch to the logged in user. If - this is not intended, then an actual user TSID must be specified, using - ILibProcessPipe_SpawnTypes_SPECIFIED_USER and the actual TSID - ------------------------------------------------------------------------ - ILibProcessPipe_SpawnTypes_DEFAULT = 0, - ILibProcessPipe_SpawnTypes_USER = 1, - ILibProcessPipe_SpawnTypes_WINLOGON = 2, - ILibProcessPipe_SpawnTypes_TERM = 3, - ILibProcessPipe_SpawnTypes_DETACHED = 4, - ILibProcessPipe_SpawnTypes_SPECIFIED_USER = 5, - ILibProcessPipe_SpawnTypes_POSIX_DETACHED = 0x8000 - ------------------------------------------------------------------------ - */ - console.log('stype: ' + stype); - if (stype == 1) - { - if (tsid == null && require('MeshAgent')._tsid != null) - { - stype = 5; // ILibProcessPipe_SpawnTypes_SPECIFIED_USER - sid = require('MeshAgent')._tsid; // If this is set, it was set via user selection UI - } - else - { - sid = tsid; // Set the SID to be whatever was passed in - } - } - - // Spawn a child process in the appropriate user session, and relay the response back via stdout - var mod = Buffer.from(getJSModule('win-deskutils')).toString('base64'); - var prog = "try { addModule('win-deskutils', process.env['win_deskutils']);} catch (x) { } var x;try{x=require('win-deskutils').dispatch('" + parent + "', '" + method + "', " + JSON.stringify(args) + ");console.log(x);}catch(z){console.log(z);process.exit(1);}process.exit(0);"; - var child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', Buffer.from(prog).toString('base64')], { type: stype, uid: sid, env: { win_deskutils: getJSModule('win-deskutils') } }); - - child.stdout.str = ''; - child.stdout.on('data', function (c) { this.str += c.toString(); }); - child.stderr.on('data', function (c) { }); - child.on('exit', function (c) { this.exitCode = c; }); - child.waitExit(); - if (child.exitCode == 0) - { - return (child.stdout.str.trim()); // If the return code was 0, then relay the response from stdout - } - else - { - throw (child.stdout.str.trim()); // If the return code was nonzero, then the stdout response is the exception that should be bubbled - } -} - -// -// This function gets the path of the windows desktop background of the specified user desktop session -// -function background_get(tsid) -{ - if (tsid != null || tsid === null) // TSID is not undefined or is explicitly null - { - // Need to disatch to different session first - return (sessionDispatch(tsid, 'background', 'get', [])); - } - var v = GM.CreateVariable(1024); - var ret = user32.SystemParametersInfoA(SPI_GETDESKWALLPAPER, v._size, v, 0); - if (ret.Val == 0) - { - throw ('Error occured trying to fetch wallpaper'); - } - return (v.String); -} - -// -// This function sets the path for the windows desktop background of the specified user desktop session -// -function background_set(path, tsid) -{ - if (tsid != null || tsid === null) // TSID is not undefined or is explicitly null - { - // Need to disatch to different session first - return (sessionDispatch(tsid, 'background', 'set', [path])); - } - var nb = GM.CreateVariable(path); - var ret = user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, nb._size, nb, 0); - if (ret.Val == 0) - { - throw ('Error occured trying to set wallpaper'); - } - return; -} - -// -// This is a helper function that is called by the child process from sessionDispatch() -// -function dispatch(parent, method, args) -{ - try - { - return (this[parent][method].apply(this, args)); - } - catch (e) - { - console.log('ERROR: ' + e); - throw ('Error occured trying to dispatch: ' + method); - } -} - -// -// This function sets the mousetrail accessibility feature, for the specified user desktop session. -// Setting value 0 or one disables this feature -// Otherwise, value is the number of cursors to render for this feature -// -function mousetrails_set(value, tsid) -{ - if (tsid != null || tsid === null) // TSID is not undefined or is explicitly null - { - // Need to disatch to different session first - return (sessionDispatch(tsid, 'mouse', 'setTrails', [value])); - } - var ret = user32.SystemParametersInfoA(SPI_SETMOUSETRAILS, value, 0, 0); - if (ret.Val == 0) - { - throw ('Error occured trying to fetch wallpaper'); - } -} - -// -// This function returns the number of cursors the mousetrail accessibility feature will render -// A value of 0 or 1 means the feature is disabled, otherwise it is the number of cursors that will be rendered -// -function mousetrails_get(tsid) -{ - if (tsid != null || tsid === null) // TSID is not undefined or is explicitly null - { - // Need to disatch to different session first - return (sessionDispatch(tsid, 'mouse', 'getTrails', [])); - } - var v = GM.CreateVariable(4); - var ret = user32.SystemParametersInfoA(SPI_GETMOUSETRAILS, v._size, v, 0); - if (ret.Val == 0) - { - throw ('Error occured trying to fetch wallpaper'); - } - return (v.toBuffer().readUInt32LE()); -} - -module.exports = { background: { get: background_get, set: background_set } }; -module.exports.mouse = { getTrails: mousetrails_get, setTrails: mousetrails_set }; -module.exports.dispatch = dispatch; \ No newline at end of file diff --git a/agents/modules_meshcore/win-info.js b/agents/modules_meshcore/win-info.js index dd60eb12..4b0e8f98 100644 --- a/agents/modules_meshcore/win-info.js +++ b/agents/modules_meshcore/win-info.js @@ -18,21 +18,28 @@ var promise = require('promise'); function qfe() { - try { - var tokens = require('win-wmi').query('ROOT\\CIMV2', 'SELECT * FROM Win32_QuickFixEngineering'); - if (tokens[0]){ - for (var index = 0; index < tokens.length; index++) { - for (var key in tokens[index]) { - if (key.startsWith('__')) delete tokens[index][key]; - } - } - return (tokens); - } else { - return ([]); + var child = require('child_process').execFile(process.env['windir'] + '\\System32\\wbem\\wmic.exe', ['wmic', 'qfe', 'list', 'full', '/FORMAT:CSV']); + child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); + child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); }); + child.waitExit(); + + var lines = child.stdout.str.trim().split('\r\n'); + var keys = lines[0].split(','); + var i, key; + var tokens; + var result = []; + + for (i = 1; i < lines.length; ++i) + { + var obj = {}; + tokens = lines[i].split(','); + for (key = 0; key < keys.length; ++key) + { + if (tokens[key]) { obj[keys[key]] = tokens[key]; } } - } catch (ex) { - return ([]); + result.push(obj); } + return (result); } function av() { @@ -46,23 +53,9 @@ function av() child.stdin.write('[reflection.Assembly]::LoadWithPartialName("system.core")\r\n'); child.stdin.write('Get-WmiObject -Namespace "root/SecurityCenter2" -Class AntiVirusProduct | '); child.stdin.write('ForEach-Object -Process { '); - child.stdin.write('$matches = [regex]::Matches($_.pathToSignedProductExe, "%(.*?)%"); '); - child.stdin.write('$modifiedPath = $_.pathToSignedProductExe; '); - child.stdin.write('foreach ($match in $matches) { '); - child.stdin.write('$modifiedPath = $modifiedPath -replace [regex]::Escape($match.Value), [System.Environment]::GetEnvironmentVariable($match.Groups[1].Value, "Process") '); - child.stdin.write('} '); - child.stdin.write('$flag = $true; '); - child.stdin.write('if ($modifiedPath -ne "windowsdefender://"){ '); - child.stdin.write('if (-not (Test-Path -Path $modifiedPath -PathType Leaf)) { '); - child.stdin.write('$flag = $false; '); - child.stdin.write('} '); - child.stdin.write('} '); - child.stdin.write('if ($flag -eq $true) { ') child.stdin.write('$Bytes = [System.Text.Encoding]::UTF8.GetBytes($_.displayName); '); child.stdin.write('$EncodedText =[Convert]::ToBase64String($Bytes); '); - child.stdin.write('Write-Output ("{0},{1}" -f $_.productState,$EncodedText); '); - child.stdin.write('} '); - child.stdin.write('}\r\n '); + child.stdin.write('Write-Host ("{0},{1}" -f $_.productState,$EncodedText); }\r\n'); child.stdin.write('exit\r\n'); child.waitExit(); @@ -221,14 +214,6 @@ function installedApps() catch(e)\ {\ }\ - try\ - {\ - val.installdate = reg.QueryKey(reg.HKEY.LocalMachine, 'SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\\\\' + items.subkeys[key], 'InstallDate');\ - if (val.installdate == '') { delete val.installdate; }\ - }\ - catch(e)\ - {\ - }\ result.push(val);\ }\ console.log(JSON.stringify(result,'', 1));process.exit();"; @@ -240,33 +225,12 @@ function installedApps() return (ret); } -function defender(){ - var promise = require('promise'); - var ret = new promise(function (a, r) { this._resolve = a; this._reject = r; }); - ret.child = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], {}); - ret.child.promise = ret; - ret.child.stdout.str = ''; ret.child.stdout.on('data', function (c) { this.str += c.toString(); }); - ret.child.stderr.str = ''; ret.child.stderr.on('data', function (c) { this.str += c.toString(); }); - ret.child.stdin.write('Get-MpComputerStatus | Select-Object RealTimeProtectionEnabled,IsTamperProtected | ConvertTo-JSON\r\n'); - ret.child.stdin.write('exit\r\n'); - ret.child.on('exit', function (c) { - if (this.stdout.str == '') { this.promise._resolve({}); return; } - try { - var abc = JSON.parse(this.stdout.str.trim()); - this.promise._resolve({ RealTimeProtection: abc.RealTimeProtectionEnabled, TamperProtected: abc.IsTamperProtected }); - } catch (ex) { - this.promise._resolve({}); return; - } - }); - return (ret); -} - if (process.platform == 'win32') { - module.exports = { qfe: qfe, av: av, defrag: defrag, pendingReboot: pendingReboot, installedApps: installedApps, defender: defender }; + module.exports = { qfe: qfe, av: av, defrag: defrag, pendingReboot: pendingReboot, installedApps: installedApps }; } else { var not_supported = function () { throw (process.platform + ' not supported'); }; - module.exports = { qfe: not_supported, av: not_supported, defrag: not_supported, pendingReboot: not_supported, installedApps: not_supported, defender: not_supported }; + module.exports = { qfe: not_supported, av: not_supported, defrag: not_supported, pendingReboot: not_supported, installedApps: not_supported }; } \ No newline at end of file diff --git a/agents/modules_meshcore/win-terminal.js b/agents/modules_meshcore/win-terminal.js index 1c6e8e20..a0e76864 100644 --- a/agents/modules_meshcore/win-terminal.js +++ b/agents/modules_meshcore/win-terminal.js @@ -1,5 +1,5 @@ /* -Copyright 2018-2022 Intel Corporation +Copyright 2018 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -89,50 +89,21 @@ function windows_terminal() { var newCsbi = GM.CreateVariable(22); if (this._kernel32.GetConsoleScreenBufferInfo(this._stdoutput, newCsbi).Val == 0) { return; } - if (newCsbi.Deref(4, 2).toBuffer().readUInt16LE() != this.currentX || newCsbi.Deref(6, 2).toBuffer().readUInt16LE() != this.currentY) - { - // - // Reference for CONSOLE_SCREEN_BUFFER_INFO can be found at: - // https://learn.microsoft.com/en-us/windows/console/console-screen-buffer-info-str - // - + if (newCsbi.Deref(4, 2).toBuffer().readUInt16LE() != this.currentX || newCsbi.Deref(6, 2).toBuffer().readUInt16LE() != this.currentY) { + //wchar_t mywbuf[512]; + //swprintf(mywbuf, 512, TEXT("csbi.dwCursorPosition.X = %d, csbi.dwCursorPosition.Y = %d, newCsbi.dwCursorPosition.X = %d, newCsbi.dwCursorPosition.Y = %d\r\n"), csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y, newCsbi.dwCursorPosition.X, newCsbi.dwCursorPosition.Y); + //OutputDebugString(mywbuf); + + //m_viewOffset = newCsbi.srWindow.Top; + //WriteMoveCursor((SerialAgent *)this->sa, (char)(newCsbi.dwCursorPosition.Y - m_viewOffset), (char)(newCsbi.dwCursorPosition.X - m_viewOffset)); + //LowStackSendData((SerialAgent *)(this->sa), "", 0); + this.currentX = newCsbi.Deref(4, 2).toBuffer().readUInt16LE(); this.currentY = newCsbi.Deref(6, 2).toBuffer().readUInt16LE(); } } - this.ClearScreen = function () - { - // - // Reference for CONSOLE_SCREEN_BUFFER_INFO can be found at: - // https://learn.microsoft.com/en-us/windows/console/console-screen-buffer-info-str - // - - // - // Reference for GetConsoleScreenBufferInfo can be found at: - // https://learn.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo - // - - // - // Reference for FillConsoleOutputCharacter can be found at: - // https://learn.microsoft.com/en-us/windows/console/fillconsoleoutputcharacter - // - - // - // Reference for FillConsoleOutputAttribute can be found at: - // https://learn.microsoft.com/en-us/windows/console/fillconsoleoutputattribute - // - - // - // Reference for SetConsoleCursorPosition can be found at: - // https://learn.microsoft.com/en-us/windows/console/setconsolecursorposition - // - - // - // Reference for SetConsoleWindowInfo can be fount at: - // https://learn.microsoft.com/en-us/windows/console/setconsolewindowinfo - // - + this.ClearScreen = function () { var CONSOLE_SCREEN_BUFFER_INFO = GM.CreateVariable(22); if (this._kernel32.GetConsoleScreenBufferInfo(this._stdoutput, CONSOLE_SCREEN_BUFFER_INFO).Val == 0) { return; } @@ -161,7 +132,6 @@ function windows_terminal() { this._kernel32.SetConsoleWindowInfo(this._stdoutput, 1, rect); } - // This does a rudimentary check if the platform is capable of PowerShell this.PowerShellCapable = function() { if (require('os').arch() == 'x64') @@ -174,7 +144,6 @@ function windows_terminal() { } } - // Starts a Legacy Windows Terminal Session this.StartEx = function Start(CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT, terminalTarget) { // The older windows terminal does not support @@ -195,9 +164,7 @@ function windows_terminal() { this._stdinput = this._kernel32.GetStdHandle(STD_INPUT_HANDLE); this._stdoutput = this._kernel32.GetStdHandle(STD_OUTPUT_HANDLE); this._connected = false; - - // Coord structure can be found at: https://learn.microsoft.com/en-us/windows/console/coord-str - var coordScreen = GM.CreateVariable(4); + var coordScreen = GM.CreateVariable(4); coordScreen.Deref(0, 2).toBuffer().writeUInt16LE(CONSOLE_SCREEN_WIDTH); coordScreen.Deref(2, 2).toBuffer().writeUInt16LE(CONSOLE_SCREEN_HEIGHT); @@ -205,21 +172,10 @@ function windows_terminal() { rect.Deref(4, 2).toBuffer().writeUInt16LE(CONSOLE_SCREEN_WIDTH - 1); rect.Deref(6, 2).toBuffer().writeUInt16LE(CONSOLE_SCREEN_HEIGHT - 1); - // - // Reference for SetConsoleWindowInfo can be found at: - // https://learn.microsoft.com/en-us/windows/console/setconsolewindowinfo - // - if (this._kernel32.SetConsoleWindowInfo(this._stdoutput, 1, rect).Val == 0) - { + if (this._kernel32.SetConsoleWindowInfo(this._stdoutput, 1, rect).Val == 0) { throw ('Failed to set Console Screen Size'); } - - // - // Reference for SetConsoleScreenBufferSize can be found at: - // https://learn.microsoft.com/en-us/windows/console/setconsolescreenbuffersize - // - if (this._kernel32.SetConsoleScreenBufferSize(this._stdoutput, coordScreen.Deref(0, 4).toBuffer().readUInt32LE()).Val == 0) - { + if (this._kernel32.SetConsoleScreenBufferSize(this._stdoutput, coordScreen.Deref(0, 4).toBuffer().readUInt32LE()).Val == 0) { throw ('Failed to set Console Buffer Size'); } @@ -322,16 +278,8 @@ function windows_terminal() { return (this.stopping); } - // - // This function uses the SetWinEventHook() method, so we can hook - // All events between EVENT_CONSOLE_CARET and EVENT_CONSOLE_END_APPLICATION - // this._hookThread = function () { - // - // Reference for SetWinEventHook() can be found at: - // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwineventhook - // var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; }); ret.userArgs = []; for (var a in arguments) @@ -344,43 +292,24 @@ function windows_terminal() { var p = this._user32.SetWinEventHook.async(EVENT_CONSOLE_CARET, EVENT_CONSOLE_END_APPLICATION, 0, this._ConsoleWinEventProc, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); p.ready = ret; p.terminal = this; - p.then(function (hwinEventHook) - { - if (hwinEventHook.Val == 0) - { + p.then(function (hwinEventHook) { + if (hwinEventHook.Val == 0) { this.ready._rej('Error calling SetWinEventHook'); - } else - { + } else { this.terminal.hwinEventHook = hwinEventHook; this.ready._res(); this.terminal._GetMessage(); } }); - // - // This is the WINEVENTPROC callback for the WinEventHook we set - // - this._ConsoleWinEventProc.on('GlobalCallback', function (hhook, dwEvent, hwnd, idObject, idChild, idEventThread, swmsEventTime) - { - // - // Reference for WINEVENTPROC can be found at: - // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-wineventproc - // + this._ConsoleWinEventProc.on('GlobalCallback', function (hhook, dwEvent, hwnd, idObject, idChild, idEventThread, swmsEventTime) { if (!this.terminal.hwinEventHook || this.terminal.hwinEventHook.Val != hhook.Val) { return; } var buffer = null; - // - // Reference for Console WinEvents can be found at: - // https://learn.microsoft.com/en-us/windows/console/console-winevents - // - - switch (dwEvent.Val) - { + switch (dwEvent.Val) { case EVENT_CONSOLE_CARET: - // The console caret has moved break; case EVENT_CONSOLE_UPDATE_REGION: - // More than one character has changed if (!this.terminal.connected) { this.terminal.connected = true; this.terminal._stream._promise._res(); @@ -392,30 +321,25 @@ function windows_terminal() { } break; case EVENT_CONSOLE_UPDATE_SIMPLE: - // A single character has changed //console.log('UPDATE SIMPLE: [X: ' + LOWORD(idObject.Val) + ' Y: ' + HIWORD(idObject.Val) + ' Char: ' + LOWORD(idChild.Val) + ' Attr: ' + HIWORD(idChild.Val) + ']'); var simplebuffer = { data: [ Buffer.alloc(1, LOWORD(idChild.Val)) ], attributes: [ HIWORD(idChild.Val) ], width: 1, height: 1, x: LOWORD(idObject.Val), y: HIWORD(idObject.Val) }; this.terminal._SendDataBuffer(simplebuffer); break; case EVENT_CONSOLE_UPDATE_SCROLL: - // The console has scrolled //console.log('UPDATE SCROLL: [dx: ' + idObject.Val + ' dy: ' + idChild.Val + ']'); this.terminal._SendScroll(idObject.Val, idChild.Val); break; case EVENT_CONSOLE_LAYOUT: - // The console layout has changed. //console.log('CONSOLE_LAYOUT'); //snprintf( Buf, 512, "Event Console LAYOUT!\r\n"); //SendLayout(); break; case EVENT_CONSOLE_START_APPLICATION: - // A new console process has started //console.log('START APPLICATION: [PID: ' + idObject.Val + ' CID: ' + idChild.Val + ']'); //snprintf( Buf, 512, "Event Console START APPLICATION!\r\nProcess ID: %d - Child ID: %d\r\n\r\n", (int)idObject, (int)idChild); //SendConsoleEvent(dwEvent, idObject, idChild); break; case EVENT_CONSOLE_END_APPLICATION: - // A console process has exited if (idObject.Val == this.terminal._hProcessID) { //console.log('END APPLICATION: [PID: ' + idObject.Val + ' CID: ' + idChild.Val + ']'); @@ -436,44 +360,18 @@ function windows_terminal() { return (ret); } - // Retrieves a message from the calling thread's message queue - this._GetMessage = function () - { - // - // Reference for GetMessage() can be found at: - // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmessage - // - - // - // Reference for TranslateMessage() can be found at: - // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-translatemessage - // - - // - // Reference for DispatchMessage() can be found at: - // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-dispatchmessage - // - + this._GetMessage = function () { if (this._user32.abort) { console.log('aborting loop'); return; } - this._user32.GetMessageA.async(this._user32.SetWinEventHook.async, MSG, 0, 0, 0).then(function (ret) - { + this._user32.GetMessageA.async(this._user32.SetWinEventHook.async, MSG, 0, 0, 0).then(function (ret) { //console.log('GetMessage Response'); - if (ret.Val != 0) - { - if (ret.Val == -1) - { + if (ret.Val != 0) { + if (ret.Val == -1) { // handle the error and possibly exit - } - else - { - // Translates virtual-key messages into character messages + } else { //console.log('TranslateMessage'); - this.nativeProxy._user32.TranslateMessage.async(this.nativeProxy.user32.SetWinEventHook.async, MSG).then(function () - { - // Dispatches a message to a window procedure + this.nativeProxy._user32.TranslateMessage.async(this.nativeProxy.user32.SetWinEventHook.async, MSG).then(function () { //console.log('DispatchMessage'); - this.nativeProxy._user32.DispatchMessageA.async(this.nativeProxy.user32.SetWinEventHook.async, MSG).then(function () - { + this.nativeProxy._user32.DispatchMessageA.async(this.nativeProxy.user32.SetWinEventHook.async, MSG).then(function () { this.nativeProxy.terminal._GetMessage(); }, console.log); }, console.log); @@ -486,8 +384,7 @@ function windows_terminal() { if (this.nativeProxy.terminal._hProcess == null) { return; } this.nativeProxy.terminal.stopping._res(); - if (this.nativeProxy.terminal._kernel32.TerminateProcess(this.nativeProxy.terminal._hProcess, 1067).Val == 0) - { + if (this.nativeProxy.terminal._kernel32.TerminateProcess(this.nativeProxy.terminal._hProcess, 1067).Val == 0) { var e = this.nativeProxy.terminal._kernel32.GetLastError().Val; console.log('Unable to kill Terminal Process, error: ' + e); } @@ -497,38 +394,22 @@ function windows_terminal() { console.log('REJECTED_UnhookWinEvent: ' + err); }); } - }, function (err) - { + }, function (err) { // Get Message Failed console.log('REJECTED_GETMessage: ' + err); }); } - - this._WriteBuffer = function (buf) - { - for (var i = 0; i < buf.length; ++i) - { - if (typeof (buf) == 'string') - { + this._WriteBuffer = function (buf) { + for (var i = 0; i < buf.length; ++i) { + if (typeof (buf) == 'string') { this._WriteCharacter(buf.charCodeAt(i), false); - } else - { + } else { this._WriteCharacter(buf[i], false); } } } this._WriteCharacter = function (key, bControlKey) { - // - // Reference for WriteConsoleInput() can be found at: - // https://learn.microsoft.com/en-us/windows/console/writeconsoleinput - // - - // - // Reference for INPUT_RECORD can be found at: - // https://learn.microsoft.com/en-us/windows/console/input-record-str - // - var rec = GM.CreateVariable(20); rec.Deref(0, 2).toBuffer().writeUInt16LE(KEY_EVENT); // rec.EventType rec.Deref(4, 4).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.bKeyDown @@ -546,78 +427,62 @@ function windows_terminal() { } // Get the current visible screen buffer - this._GetScreenBuffer = function (sx, sy, ex, ey) - { - // - // Reference for GetConsoleScreenBufferInfo() can be found at: - // https://learn.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo - // - - // - // Reference for ReadConsoleOutput() can be found at: - // https://learn.microsoft.com/en-us/windows/console/readconsoleoutput - // - + this._GetScreenBuffer = function (sx, sy, ex, ey) { var info = GM.CreateVariable(22); if (this._kernel32.GetConsoleScreenBufferInfo(this._stdoutput, info).Val == 0) { throw ('Error getting screen buffer info'); } - + var nWidth = info.Deref(14, 2).toBuffer().readUInt16LE() - info.Deref(10, 2).toBuffer().readUInt16LE() + 1; var nHeight = info.Deref(16, 2).toBuffer().readUInt16LE() - info.Deref(12, 2).toBuffer().readUInt16LE() + 1; - - if (arguments[3] == null) - { + + if (arguments[3] == null) { // Use Default Parameters sx = 0; sy = 0; ex = nWidth - 1; ey = nHeight - 1; - } else - { + } else { if (this._scrx != 0) { sx += this._scrx; ex += this._scrx; } if (this._scry != 0) { sy += this._scry; ey += this._scry; } this._scrx = this._scry = 0; } - + var nBuffer = GM.CreateVariable((ex - sx + 1) * (ey - sy + 1) * 4); var size = GM.CreateVariable(4); size.Deref(0, 2).toBuffer().writeUInt16LE(ex - sx + 1, 0); size.Deref(2, 2).toBuffer().writeUInt16LE(ey - sy + 1, 0); - + var startCoord = GM.CreateVariable(4); startCoord.Deref(0, 2).toBuffer().writeUInt16LE(0, 0); startCoord.Deref(2, 2).toBuffer().writeUInt16LE(0, 0); - + var region = GM.CreateVariable(8); region.buffer = region.toBuffer(); region.buffer.writeUInt16LE(sx, 0); region.buffer.writeUInt16LE(sy, 2); region.buffer.writeUInt16LE(ex, 4); region.buffer.writeUInt16LE(ey, 6); - - if (this._kernel32.ReadConsoleOutputA(this._stdoutput, nBuffer, size.Deref(0, 4).toBuffer().readUInt32LE(), startCoord.Deref(0, 4).toBuffer().readUInt32LE(), region).Val == 0) - { + + if (this._kernel32.ReadConsoleOutputA(this._stdoutput, nBuffer, size.Deref(0, 4).toBuffer().readUInt32LE(), startCoord.Deref(0, 4).toBuffer().readUInt32LE(), region).Val == 0) { throw ('Unable to read Console Output'); } - + // Lets convert the buffer into something simpler //var retVal = { data: Buffer.alloc((dw - dx + 1) * (dh - dy + 1)), attributes: Buffer.alloc((dw - dx + 1) * (dh - dy + 1)), width: dw - dx + 1, height: dh - dy + 1, x: dx, y: dy }; - + var retVal = { data: [], attributes: [], width: ex - sx + 1, height: ey - sy + 1, x: sx, y: sy }; var x, y, line, ifo, tmp, lineWidth = ex - sx + 1; - - for (y = 0; y <= (ey - sy) ; ++y) - { + + for (y = 0; y <= (ey - sy) ; ++y) { retVal.data.push(Buffer.alloc(lineWidth)); retVal.attributes.push(Buffer.alloc(lineWidth)); - + line = nBuffer.Deref(y * lineWidth * 4, lineWidth * 4).toBuffer(); - for (x = 0; x < lineWidth; ++x) - { + for (x = 0; x < lineWidth; ++x) { retVal.data.peek()[x] = line[x * 4]; retVal.attributes.peek()[x] = line[2 + (x * 4)]; } } - + return (retVal); } @@ -642,11 +507,6 @@ function windows_terminal() { this._SendScroll = function _SendScroll(dx, dy) { - // - // Reference for GetConsoleScreenBufferInfo() can be found at: - // https://learn.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo - // - if (this._scrollTimer || this._stream == null) { return; } var info = GM.CreateVariable(22); @@ -686,15 +546,12 @@ function LOWORD(val) { return (val & 0xFFFF); } function HIWORD(val) { return ((val >> 16) & 0xFFFF); } function GetEsc(op, args) { return (Buffer.from('\x1B[' + args.join(';') + op)); } function MeshConsole(msg) { require('MeshAgent').SendCommand({ "action": "msg", "type": "console", "value": JSON.stringify(msg) }); } -function TranslateLine(x, y, data, attributes) -{ +function TranslateLine(x, y, data, attributes) { var i, fcolor, bcolor, rcolor, fbright, bbright, lastAttr, fc, bc, rc, fb, bb, esc = [], output = [GetEsc('H', [y, x])]; - if (typeof attributes == 'number') { attributes = [attributes]; } // If we get a single attribute, turn it into an array. + if (typeof attributes == 'number') { attributes = [ attributes ]; } // If we get a single attribute, turn it into an array. - for (i = 0; i < data.length; i++) - { - if (lastAttr != attributes[i]) - { // To boost performance, if the attribute is the same as the last one, skip this entire part. + for (i = 0; i < data.length; i++) { + if (lastAttr != attributes[i]) { // To boost performance, if the attribute is the same as the last one, skip this entire part. fc = (attributes[i] & 0x0007); fc = ((fc & 0x0001) << 2) + (fc & 0x0002) + ((fc & 0x0004) >> 2); // Foreground color bc = (attributes[i] & 0x0070) >> 4; @@ -702,19 +559,19 @@ function TranslateLine(x, y, data, attributes) rc = (attributes[i] & 0x4000); // Reverse color set fb = (attributes[i] & 0x0008) >> 3; // Bright foreground set bb = (attributes[i] & 0x0080); // Bright background set - + if (rc != rcolor) { if (rc != 0) { esc.push(7); } else { esc.push(0); fcolor = 7; bcolor = 0; fbright = 0; bbright = 0; } rcolor = rc; } // Reverse Color if (fc != fcolor) { esc.push(fc + 30); fcolor = fc; } // Set the foreground color if needed if (bc != bcolor) { esc.push(bc + 40); bcolor = bc; } // Set the background color if needed if (fb != fbright) { esc.push(2 - fb); fbright = fb; } // Set the bright foreground color if needed - if (bb != bbright) { if (bb == 0) { esc.push(bcolor + 40); } else { esc.push(bcolor + 100); bbright = bb; } } // Set bright Background color if needed + if (bb != bbright) { if (bb == 0) { esc.push(bcolor + 40); } else { esc.push(bcolor + 100); bbright = bb; } } // Set bright Background color if needed if (esc.length > 0) { output.push(GetEsc('m', esc)); esc = []; } lastAttr = attributes[i]; } output.push(Buffer.from(String.fromCharCode(data[i]))); } - + return Buffer.concat(output); } diff --git a/agents/modules_meshcore/win-virtual-terminal.js b/agents/modules_meshcore/win-virtual-terminal.js index 818ab6a0..8709af71 100644 --- a/agents/modules_meshcore/win-virtual-terminal.js +++ b/agents/modules_meshcore/win-virtual-terminal.js @@ -47,20 +47,20 @@ function vt() var GM = require('_GenericMarshal'); var k32 = GM.CreateNativeProxy('kernel32.dll'); - k32.CreateMethod('CancelIoEx'); // https://learn.microsoft.com/en-us/windows/win32/fileio/cancelioex-func - k32.CreateMethod('CreatePipe'); // https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe - k32.CreateMethod('CreateProcessW'); // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw - k32.CreateMethod('CreatePseudoConsole'); // https://learn.microsoft.com/en-us/windows/console/createpseudoconsole - k32.CreateMethod('CloseHandle'); // https://learn.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle - k32.CreateMethod('ClosePseudoConsole'); // https://learn.microsoft.com/en-us/windows/console/closepseudoconsole - k32.CreateMethod('GetProcessHeap'); // https://learn.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-getprocessheap - k32.CreateMethod('HeapAlloc'); // https://learn.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heapalloc - k32.CreateMethod('InitializeProcThreadAttributeList'); // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-initializeprocthreadattributelist - k32.CreateMethod('ResizePseudoConsole'); // https://learn.microsoft.com/en-us/windows/console/resizepseudoconsole - k32.CreateMethod('UpdateProcThreadAttribute'); // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute - k32.CreateMethod('WriteFile'); // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefile - k32.CreateMethod('ReadFile'); // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile - k32.CreateMethod('TerminateProcess'); // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess + k32.CreateMethod('CancelIoEx'); + k32.CreateMethod('CreatePipe'); + k32.CreateMethod('CreateProcessW'); + k32.CreateMethod('CreatePseudoConsole'); + k32.CreateMethod('CloseHandle'); + k32.CreateMethod('ClosePseudoConsole'); + k32.CreateMethod('GetProcessHeap'); + k32.CreateMethod('HeapAlloc'); + k32.CreateMethod('InitializeProcThreadAttributeList'); + k32.CreateMethod('ResizePseudoConsole'); + k32.CreateMethod('UpdateProcThreadAttribute'); + k32.CreateMethod('WriteFile'); + k32.CreateMethod('ReadFile'); + k32.CreateMethod('TerminateProcess'); var ret = { _h: GM.CreatePointer(), _consoleInput: GM.CreatePointer(), _consoleOutput: GM.CreatePointer(), _input: GM.CreatePointer(), _output: GM.CreatePointer(), k32: k32 }; var attrSize = GM.CreateVariable(8); @@ -77,31 +77,18 @@ function vt() throw ('Error calling CreatePseudoConsole()'); } - // - // Reference for STARTUPINFOEXW - // https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-startupinfoexw - // - - // - // Reference for STARTUPINFOW - // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfow - // - k32.InitializeProcThreadAttributeList(0, 1, 0, attrSize); attrList = GM.CreateVariable(attrSize.toBuffer().readUInt32LE()); - var startupinfoex = GM.CreateVariable(GM.PointerSize == 8 ? 112 : 72); // Create Structure, 64 bits is 112 bytes, 32 bits is 72 bytes - startupinfoex.toBuffer().writeUInt32LE(GM.PointerSize == 8 ? 112 : 72, 0); // Write buffer size - attrList.pointerBuffer().copy(startupinfoex.Deref(GM.PointerSize == 8 ? 104 : 68, GM.PointerSize).toBuffer()); // Write the reference to STARTUPINFOEX + var startupinfoex = GM.CreateVariable(GM.PointerSize == 8 ? 112 : 72); + startupinfoex.toBuffer().writeUInt32LE(GM.PointerSize == 8 ? 112 : 72, 0); + attrList.pointerBuffer().copy(startupinfoex.Deref(GM.PointerSize == 8 ? 104 : 68, GM.PointerSize).toBuffer()); if (k32.InitializeProcThreadAttributeList(attrList, 1, 0, attrSize).Val != 0) { if (k32.UpdateProcThreadAttribute(attrList, 0, PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, ret._h.Deref(), GM.PointerSize, 0, 0).Val != 0) { - if (k32.CreateProcessW(0, GM.CreateVariable(path, { wide: true }), 0, 0, 1, EXTENDED_STARTUPINFO_PRESENT, 0, 0, startupinfoex, pi).Val != 0) // Create the process to run in the pseudoconsole + if (k32.CreateProcessW(0, GM.CreateVariable(path, { wide: true }), 0, 0, 1, EXTENDED_STARTUPINFO_PRESENT, 0, 0, startupinfoex, pi).Val != 0) { - // - // Create a Stream Object, to be able to read/write data to the pseudoconsole - // ret._startupinfoex = startupinfoex; ret._process = pi.Deref(0); ret._pid = pi.Deref(GM.PointerSize == 4 ? 8 : 16, 4).toBuffer().readUInt32LE(); @@ -124,10 +111,6 @@ function vt() flush(); } }); - - // - // The ProcessInfo object is signaled when the process exits - // ds._obj = ret; ret._waiter = require('DescriptorEvents').addDescriptor(pi.Deref(0)); ret._waiter.ds = ds; @@ -168,7 +151,6 @@ function vt() ds._rpbufRead = GM.CreateVariable(4); ds.__read = function __read() { - // Asyncronously read data from the pseudoconsole this._rp = this.terminal.k32.ReadFile.async(this.terminal._output.Deref(), this._rpbuf, this._rpbuf._size, this._rpbufRead, 0); this._rp.then(function () { @@ -191,8 +173,6 @@ function vt() } throw ('Internal Error'); } - - // This evaluates whether or not the powershell binary exists this.PowerShellCapable = function () { if (require('os').arch() == 'x64') @@ -204,14 +184,10 @@ function vt() return (require('fs').existsSync(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe')); } } - - // Start the PseudoConsole with the Command Prompt this.Start = function Start(CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT) { return (this.Create(process.env['windir'] + '\\System32\\cmd.exe', CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT)); } - - // Start the PseduoConsole with PowerShell this.StartPowerShell = function StartPowerShell(CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT) { if (require('os').arch() == 'x64') diff --git a/agents/modules_meshcore/win-volumes.js b/agents/modules_meshcore/win-volumes.js index 59e87c1a..e0e11276 100644 --- a/agents/modules_meshcore/win-volumes.js +++ b/agents/modules_meshcore/win-volumes.js @@ -39,90 +39,17 @@ function getVolumes() { ret[v[i].DeviceID] = trimObject(v[i]); } - try { - v = require('win-wmi').query('ROOT\\CIMV2\\Security\\MicrosoftVolumeEncryption', 'SELECT * FROM Win32_EncryptableVolume'); - for (i in v) + + v = require('win-wmi').query('ROOT\\CIMV2\\Security\\MicrosoftVolumeEncryption', 'SELECT * FROM Win32_EncryptableVolume'); + for (i in v) + { + var tmp = trimObject(v[i]); + for (var k in tmp) { - var tmp = trimObject(v[i]); - for (var k in tmp) - { - ret[tmp.DeviceID][k] = tmp[k]; - } + ret[tmp.DeviceID][k] = tmp[k]; } - } catch (ex) { } + } return (ret); } -function windows_volumes() -{ - var promise = require('promise'); - var p1 = new promise(function (res, rej) { this._res = res; this._rej = rej; }); - var ret = {}; - var values = require('win-wmi').query('ROOT\\CIMV2', 'SELECT * FROM Win32_LogicalDisk', ['DeviceID', 'VolumeName', 'FileSystem', 'Size', 'FreeSpace', 'DriveType']); - if(values[0]){ - for (var i = 0; i < values.length; ++i) { - var drive = values[i]['DeviceID'].slice(0,-1); - ret[drive] = { - name: (values[i]['VolumeName'] ? values[i]['VolumeName'] : ""), - type: (values[i]['FileSystem'] ? values[i]['FileSystem'] : "Unknown"), - size: (values[i]['Size'] ? values[i]['Size'] : 0), - sizeremaining: (values[i]['FreeSpace'] ? values[i]['FreeSpace'] : 0), - removable: (values[i]['DriveType'] == 2), - cdrom: (values[i]['DriveType'] == 5) - }; - } - } - try { - values = require('win-wmi').query('ROOT\\CIMV2\\Security\\MicrosoftVolumeEncryption', 'SELECT * FROM Win32_EncryptableVolume', ['DriveLetter','ConversionStatus','ProtectionStatus']); - if(values[0]){ - for (var i = 0; i < values.length; ++i) { - var drive = values[i]['DriveLetter'].slice(0,-1); - var statuses = { - 0: 'FullyDecrypted', - 1: 'FullyEncrypted', - 2: 'EncryptionInProgress', - 3: 'DecryptionInProgress', - 4: 'EncryptionPaused', - 5: 'DecryptionPaused' - }; - ret[drive].volumeStatus = statuses.hasOwnProperty(values[i].ConversionStatus) ? statuses[values[i].ConversionStatus] : 'FullyDecrypted'; - ret[drive].protectionStatus = (values[i].ProtectionStatus == 0 ? 'Off' : (values[i].ProtectionStatus == 1 ? 'On' : 'Unknown')); - try { - var foundIDMarkedLine = false, foundMarkedLine = false, identifier = '', password = ''; - var keychild = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/c', 'manage-bde -protectors -get ' + drive + ': -Type recoverypassword'], {}); - keychild.stdout.str = ''; keychild.stdout.on('data', function (c) { this.str += c.toString(); }); - keychild.waitExit(); - var lines = keychild.stdout.str.trim().split('\r\n'); - for (var x = 0; x < lines.length; x++) { // Loop each line - var abc = lines[x].trim(); - var englishidpass = (abc !== '' && abc.includes('Numerical Password:')); // English ID - var germanidpass = (abc !== '' && abc.includes('Numerisches Kennwort:')); // German ID - var frenchidpass = (abc !== '' && abc.includes('Mot de passe num')); // French ID - var englishpass = (abc !== '' && abc.includes('Password:') && !abc.includes('Numerical Password:')); // English Password - var germanpass = (abc !== '' && abc.includes('Kennwort:') && !abc.includes('Numerisches Kennwort:')); // German Password - var frenchpass = (abc !== '' && abc.includes('Mot de passe :') && !abc.includes('Mot de passe num')); // French Password - if (englishidpass || germanidpass || frenchidpass|| englishpass || germanpass || frenchpass) { - var nextline = lines[x + 1].trim(); - if (x + 1 < lines.length && (nextline !== '' && (nextline.startsWith('ID:') || nextline.startsWith('ID :')) )) { - identifier = nextline.replace('ID:','').replace('ID :', '').trim(); - foundIDMarkedLine = true; - }else if (x + 1 < lines.length && nextline !== '') { - password = nextline; - foundMarkedLine = true; - } - } - } - ret[drive].identifier = (foundIDMarkedLine ? identifier : ''); // Set Bitlocker Identifier - ret[drive].recoveryPassword = (foundMarkedLine ? password : ''); // Set Bitlocker Password - } catch(ex) { } // just carry on as we cant get bitlocker key - } - } - p1._res(ret); - } catch (ex) { p1._res(ret); } // just return volumes as cant get encryption/bitlocker - return (p1); -} - -module.exports = { - getVolumes: function () { try { return (getVolumes()); } catch (x) { return ({}); } }, - volumes_promise: windows_volumes -}; \ No newline at end of file +module.exports = { getVolumes: function () { try { return (getVolumes()); } catch (x) { return ({}); } } }; \ No newline at end of file diff --git a/agents/recoverycore.js b/agents/recoverycore.js index 5d9f13bc..169b170c 100644 --- a/agents/recoverycore.js +++ b/agents/recoverycore.js @@ -485,8 +485,8 @@ function windows_execve(name, agentfilename, sessionid) { var cmd = require('_GenericMarshal').CreateVariable(process.env['windir'] + '\\system32\\cmd.exe', { wide: true }); var args = require('_GenericMarshal').CreateVariable(3 * require('_GenericMarshal').PointerSize); var arg1 = require('_GenericMarshal').CreateVariable('cmd.exe', { wide: true }); - var arg2 = require('_GenericMarshal').CreateVariable('/C net stop "' + name + '" & "' + cwd + agentfilename + '.update.exe" -b64exec ' + 'dHJ5CnsKICAgIHZhciBzZXJ2aWNlTG9jYXRpb24gPSBwcm9jZXNzLmFyZ3YucG9wKCkudG9Mb3dlckNhc2UoKTsKICAgIHJlcXVpcmUoJ3Byb2Nlc3MtbWFuYWdlcicpLmVudW1lcmF0ZVByb2Nlc3NlcygpLnRoZW4oZnVuY3Rpb24gKHByb2MpCiAgICB7CiAgICAgICAgZm9yICh2YXIgcCBpbiBwcm9jKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKHByb2NbcF0ucGF0aCAmJiAocHJvY1twXS5wYXRoLnRvTG93ZXJDYXNlKCkgPT0gc2VydmljZUxvY2F0aW9uKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcHJvY2Vzcy5raWxsKHByb2NbcF0ucGlkKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcm9jZXNzLmV4aXQoKTsKICAgIH0pOwp9CmNhdGNoIChlKQp7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQ==' + - ' "' + process.execPath + '" & copy "' + cwd + agentfilename + '.update.exe" "' + process.execPath + '" & net start "' + name + '" & erase "' + cwd + agentfilename + '.update.exe"', { wide: true }); + var arg2 = require('_GenericMarshal').CreateVariable('/C wmic service "' + name + '" call stopservice & "' + cwd + agentfilename + '.update.exe" -b64exec ' + 'dHJ5CnsKICAgIHZhciBzZXJ2aWNlTG9jYXRpb24gPSBwcm9jZXNzLmFyZ3YucG9wKCkudG9Mb3dlckNhc2UoKTsKICAgIHJlcXVpcmUoJ3Byb2Nlc3MtbWFuYWdlcicpLmVudW1lcmF0ZVByb2Nlc3NlcygpLnRoZW4oZnVuY3Rpb24gKHByb2MpCiAgICB7CiAgICAgICAgZm9yICh2YXIgcCBpbiBwcm9jKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKHByb2NbcF0ucGF0aCAmJiAocHJvY1twXS5wYXRoLnRvTG93ZXJDYXNlKCkgPT0gc2VydmljZUxvY2F0aW9uKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcHJvY2Vzcy5raWxsKHByb2NbcF0ucGlkKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcm9jZXNzLmV4aXQoKTsKICAgIH0pOwp9CmNhdGNoIChlKQp7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQ==' + + ' "' + process.execPath + '" & copy "' + cwd + agentfilename + '.update.exe" "' + process.execPath + '" & wmic service "' + name + '" call startservice & erase "' + cwd + agentfilename + '.update.exe"', { wide: true }); if (name == null) { diff --git a/amt/amt-ider-module.js b/amt/amt-ider-module.js index 4808482e..b76b6c5d 100644 --- a/amt/amt-ider-module.js +++ b/amt/amt-ider-module.js @@ -30,6 +30,7 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { const fs = require('fs'); var obj = {}; + obj.debug = false; obj.protocol = 3; // IDER obj.bytesToAmt = 0; obj.bytesFromAmt = 0; @@ -37,7 +38,7 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { obj.tx_timeout = 0; // Default 0 obj.heartbeat = 20000; // Default 20000 obj.version = 1; - obj.acc = null; + obj.acc = ""; obj.inSequence = 0; obj.outSequence = 0; obj.iderinfo = null; @@ -45,50 +46,47 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { obj.iderStart = 0; // OnReboot = 0, Graceful = 1, Now = 2 obj.floppy = null; obj.cdrom = null; + obj.floppySize = null; + obj.cdromSize = null; obj.floppyReady = false; obj.cdromReady = false; - //obj.pingTimer = null; obj.sectorStats = null; - obj.debug = false; // Private method function debug() { if (obj.debug) { console.log(...arguments); } } // Mode Sense - var IDE_ModeSence_LS120Disk_Page_Array = Buffer.from([0x00, 0x26, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00]); - var IDE_ModeSence_3F_LS120_Array = Buffer.from([0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31]); - var IDE_ModeSence_FloppyDisk_Page_Array = Buffer.from([0x00, 0x26, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x04, 0xB0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00]); - var IDE_ModeSence_3F_Floppy_Array = Buffer.from([0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1e, 0x04, 0xb0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31]); - var IDE_ModeSence_CD_1A_Array = Buffer.from([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); - //var IDE_ModeSence_CD_1B_Array = Buffer.from([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); - var IDE_ModeSence_CD_1D_Array = Buffer.from([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); - var IDE_ModeSence_CD_2A_Array = Buffer.from([0x00, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); - //var IDE_ModeSence_CD_01_Array = Buffer.from([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00]); - var IDE_ModeSence_3F_CD_Array = Buffer.from([0x00, 0x28, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); + var IDE_ModeSence_LS120Disk_Page_Array = String.fromCharCode(0x00, 0x26, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00); + var IDE_ModeSence_3F_LS120_Array = String.fromCharCode(0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31); + var IDE_ModeSence_FloppyDisk_Page_Array = String.fromCharCode(0x00, 0x26, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x04, 0xB0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00); + var IDE_ModeSence_3F_Floppy_Array = String.fromCharCode(0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1e, 0x04, 0xb0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31); + var IDE_ModeSence_CD_1A_Array = String.fromCharCode(0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + //var IDE_ModeSence_CD_1B_Array = String.fromCharCode(0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + var IDE_ModeSence_CD_1D_Array = String.fromCharCode(0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + var IDE_ModeSence_CD_2A_Array = String.fromCharCode(0x00, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + //var IDE_ModeSence_CD_01_Array = String.fromCharCode(0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00); + var IDE_ModeSence_3F_CD_Array = String.fromCharCode(0x00, 0x28, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); // 0x46 constant data - var IDE_CD_ConfigArrayHeader = Buffer.from([0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x08]); - var IDE_CD_ConfigArrayProfileList = Buffer.from([0x00, 0x00, 0x03, 0x04, 0x00, 0x08, 0x01, 0x00]); - var IDE_CD_ConfigArrayCore = Buffer.from([0x00, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00, 0x02]); - var IDE_CD_Morphing = Buffer.from([0x00, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00]); - var IDE_CD_ConfigArrayRemovable = Buffer.from([0x00, 0x03, 0x03, 0x04, 0x29, 0x00, 0x00, 0x02]); - var IDE_CD_ConfigArrayRandom = Buffer.from([0x00, 0x10, 0x01, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00]); - var IDE_CD_Read = Buffer.from([0x00, 0x1E, 0x03, 0x00]); - var IDE_CD_PowerManagement = Buffer.from([0x01, 0x00, 0x03, 0x00]); - var IDE_CD_Timeout = Buffer.from([0x01, 0x05, 0x03, 0x00]); + var IDE_CD_ConfigArrayHeader = String.fromCharCode(0x00, 0x00,0x00, 0x28, 0x00, 0x00, 0x00, 0x08); + var IDE_CD_ConfigArrayProfileList = String.fromCharCode(0x00, 0x00, 0x03, 0x04, 0x00, 0x08, 0x01, 0x00); + var IDE_CD_ConfigArrayCore = String.fromCharCode(0x00, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00, 0x02); + var IDE_CD_Morphing = String.fromCharCode(0x00, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00); + var IDE_CD_ConfigArrayRemovable = String.fromCharCode(0x00, 0x03, 0x03, 0x04, 0x29, 0x00, 0x00, 0x02); + var IDE_CD_ConfigArrayRandom = String.fromCharCode(0x00, 0x10, 0x01, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00); + var IDE_CD_Read = String.fromCharCode(0x00, 0x1E, 0x03, 0x00); + var IDE_CD_PowerManagement = String.fromCharCode(0x01, 0x00, 0x03, 0x00); + var IDE_CD_Timeout = String.fromCharCode(0x01, 0x05, 0x03, 0x00); // 0x01 constant data - var IDE_ModeSence_FloppyError_Recovery_Array = Buffer.from([0x00, 0x12, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]); - var IDE_ModeSence_Ls120Error_Recovery_Array = Buffer.from([0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]); - var IDE_ModeSence_CDError_Recovery_Array = Buffer.from([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00]); + var IDE_ModeSence_FloppyError_Recovery_Array = String.fromCharCode(0x00, 0x12, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00); + var IDE_ModeSence_Ls120Error_Recovery_Array = String.fromCharCode(0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00); + var IDE_ModeSence_CDError_Recovery_Array = String.fromCharCode(0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00); - // CD info and performance - var RD_CD_DiskInfo = Buffer.from([0x00, 0x20, 0x0e, 0x01, 0x01, 0x01, 0x01, 0x20, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); - var RD_CD_Performance = Buffer.from([0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00]); // Private method, called by parent when it change state obj.xxStateChange = function (newstate) { - if (obj.debug) console.log("IDER-StateChange", newstate); + debug("IDER-StateChange", newstate); if (newstate == 0) { obj.Stop(); } if (newstate == 3) { obj.Start(); } } @@ -102,7 +100,8 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { if (fs.existsSync(floppyPath) == false) { return 1; } // Floppy disk image does not exist var stats = fs.statSync(floppyPath); if ((stats.size % 512) != 0) { return 2; } // Invalid floppy disk image - obj.floppy = { size: stats.size, ptr: fs.openSync(floppyPath, 'r') }; + obj.floppySize = stats.size; + obj.floppy = fs.openSync(floppyPath, 'r'); } catch (ex) { return 3; } // Unable to open floppy disk image } @@ -112,7 +111,8 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { if (fs.existsSync(cdromPath) == false) { return 4; } // CDROM disk image does not exist var stats = fs.statSync(cdromPath); if ((stats.size % 512) != 0) { return 5; } // Invalid CDROM disk image - obj.cdrom = { size: stats.size, ptr: fs.openSync(cdromPath, 'r') }; + obj.cdromSize = stats.size; + obj.cdrom = fs.openSync(cdromPath, 'r'); } catch (ex) { return 6; } // Unable to open CDROM disk image } @@ -122,7 +122,9 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { } obj.Start = function () { - if (obj.debug) { console.log('IDER-Start'); console.log(obj.floppy, obj.cdrom); } + debug("IDER-Start"); + + // Get ready obj.bytesToAmt = 0; obj.bytesFromAmt = 0; obj.inSequence = 0; @@ -130,80 +132,87 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { g_readQueue = []; // Send first command, OPEN_SESSION - obj.SendCommand(0x40, Buffer.concat([ShortToStrX(obj.rx_timeout), ShortToStrX(obj.tx_timeout), ShortToStrX(obj.heartbeat), IntToStrX(obj.version)])); + obj.SendCommand(0x40, webserver.common.ShortToStrX(obj.rx_timeout) + webserver.common.ShortToStrX(obj.tx_timeout) + webserver.common.ShortToStrX(obj.heartbeat) + webserver.common.IntToStrX(obj.version)); // Send sector stats if (obj.sectorStats) { - obj.sectorStats(0, 0, obj.floppy ? (obj.floppy.size >> 9) : 0); - obj.sectorStats(0, 1, obj.cdrom ? (obj.cdrom.size >> 11) : 0); + obj.sectorStats(0, 0, obj.floppy ? (obj.floppySize >> 9) : 0); + obj.sectorStats(0, 1, obj.cdrom ? (obj.cdromSize >> 11) : 0); } - - // Setup the ping timer - //obj.pingTimer = setInterval(function () { obj.SendCommand(0x44); }, 5000); } obj.Stop = function () { - if (obj.debug) console.log('IDER-Stop'); - //if (obj.pingTimer) { clearInterval(obj.pingTimer); obj.pingTimer = null; } + debug("IDER-Stop"); + + // Close the files + if (obj.floppy) { fs.close(obj.floppy); delete obj.floppy; } + if (obj.cdrom) { fs.close(obj.cdrom); delete obj.cdrom; } + + // Clean up + obj.floppySize = 0; + obj.cdromSize = 0; + obj.floppyReady = false; + obj.cdromReady = false; + + // Stop the redirection connection obj.parent.Stop(); } // Private method obj.ProcessData = function (data) { - data = Buffer.from(data, 'binary'); obj.bytesFromAmt += data.length; - if (obj.acc == null) { obj.acc = data; } else { obj.acc = Buffer.concat([obj.acc, data]); } - if (obj.debug) console.log('IDER-ProcessData', obj.acc.length, obj.acc.toString('hex')); + obj.acc += data; + debug('IDER-ProcessData', obj.acc.length, webserver.common.rstr2hex(obj.acc)); // Process as many commands as possible - while (obj.acc != null) { + while (true) { var len = obj.ProcessDataEx(); if (len == 0) return; - if (obj.inSequence != ReadIntX(obj.acc, 4)) { - if (obj.debug) console.log('ERROR: Out of sequence', obj.inSequence, ReadIntX(obj.acc, 4)); + if (obj.inSequence != webserver.common.ReadIntX(obj.acc, 4)) { + debug('ERROR: Out of sequence', obj.inSequence, webserver.common.ReadIntX(obj.acc, 4)); obj.Stop(); return; } obj.inSequence++; - if (len == obj.acc.length) { obj.acc = null; } else { obj.acc = obj.acc.slice(len); } + obj.acc = obj.acc.substring(len); } } // Private method obj.SendCommand = function (cmdid, data, completed, dma) { - if (data == null) { data = Buffer.alloc(0); } + if (data == null) { data = ''; } var attributes = ((cmdid > 50) && (completed == true)) ? 2 : 0; if (dma) { attributes += 1; } - var x = Buffer.concat([Buffer.from([cmdid, 0, 0, attributes]), IntToStrX(obj.outSequence++), data]); + var x = String.fromCharCode(cmdid, 0, 0, attributes) + webserver.common.IntToStrX(obj.outSequence++) + data; obj.parent.xxSend(x); obj.bytesToAmt += x.length; - //if (cmdid != 0x4B) { console.log('IDER-SendData', x.length, x.toString('hex')); } + if (cmdid != 0x4B) { debug('IDER-SendData', x.length, webserver.common.rstr2hex(x)); } } // CommandEndResponse (SCSI_SENSE) obj.SendCommandEndResponse = function (error, sense, device, asc, asq) { - if (error) { obj.SendCommand(0x51, Buffer.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc5, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0]), true); } - else { obj.SendCommand(0x51, Buffer.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x87, (sense << 4), 3, 0, 0, 0, device, 0x51, sense, asc, asq]), true); } + if (error) { obj.SendCommand(0x51, String.fromCharCode(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc5, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0), true); } + else { obj.SendCommand(0x51, String.fromCharCode(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x87, (sense << 4), 3, 0, 0, 0, device, 0x51, sense, asc, asq), true); } } // DataToHost (SCSI_READ) obj.SendDataToHost = function (device, completed, data, dma) { var dmalen = (dma) ? 0 : data.length; if (completed == true) { - obj.SendCommand(0x54, Buffer.concat([Buffer.from([0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0x85, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0, 0, 0, 0]), data]), completed, dma); + obj.SendCommand(0x54, String.fromCharCode(0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0x85, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0, 0, 0, 0) + data, completed, dma); } else { - obj.SendCommand(0x54, Buffer.concat([Buffer.from([0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), data]), completed, dma); + obj.SendCommand(0x54, String.fromCharCode(0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + data, completed, dma); } } // GetDataFromHost (SCSI_CHUNK) obj.SendGetDataFromHost = function (device, chunksize) { - obj.SendCommand(0x52, Buffer.from([0, (chunksize & 0xff), (chunksize >> 8), 0, 0xb5, 0, 0, 0, (chunksize & 0xff), (chunksize >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), false); + obj.SendCommand(0x52, String.fromCharCode(0, (chunksize & 0xff), (chunksize >> 8), 0, 0xb5, 0, 0, 0, (chunksize & 0xff), (chunksize >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), false); } // DisableEnableFeatures (STATUS_DATA) // If type is REGS_TOGGLE (3), 4 bytes of data must be provided. - obj.SendDisableEnableFeatures = function (type, data) { if (data == null) { data = ''; } obj.SendCommand(0x48, Buffer.concat([Buffer.from([type]), data])); } + obj.SendDisableEnableFeatures = function (type, data) { if (data == null) { data = ''; } obj.SendCommand(0x48, String.fromCharCode(type) + data); } // Private method obj.ProcessDataEx = function () { @@ -211,128 +220,130 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { // First 8 bytes are the header // CommandID + 0x000000 + Sequence Number - //console.log('ProcessDataEx', obj.acc[0], obj.acc); - switch (obj.acc[0]) { + switch(obj.acc.charCodeAt(0)) { case 0x41: // OPEN_SESSION if (obj.acc.length < 30) return 0; - var len = obj.acc[29]; + var len = obj.acc.charCodeAt(29); if (obj.acc.length < (30 + len)) return 0; obj.iderinfo = {}; - obj.iderinfo.major = obj.acc[8]; - obj.iderinfo.minor = obj.acc[9]; - obj.iderinfo.fwmajor = obj.acc[10]; - obj.iderinfo.fwminor = obj.acc[11]; - obj.iderinfo.readbfr = ReadShortX(obj.acc, 16); - obj.iderinfo.writebfr = ReadShortX(obj.acc, 18); - obj.iderinfo.proto = obj.acc[21]; - obj.iderinfo.iana = ReadIntX(obj.acc, 25); - if (obj.debug) console.log(obj.iderinfo); + obj.iderinfo.major = obj.acc.charCodeAt(8); + obj.iderinfo.minor = obj.acc.charCodeAt(9); + obj.iderinfo.fwmajor = obj.acc.charCodeAt(10); + obj.iderinfo.fwminor = obj.acc.charCodeAt(11); + obj.iderinfo.readbfr = webserver.common.ReadShortX(obj.acc, 16); + obj.iderinfo.writebfr = webserver.common.ReadShortX(obj.acc, 18); + obj.iderinfo.proto = obj.acc.charCodeAt(21); + obj.iderinfo.iana = webserver.common.ReadIntX(obj.acc, 25); + debug(obj.iderinfo); if (obj.iderinfo.proto != 0) { - if (obj.debug) console.log("Unknown proto", obj.iderinfo.proto); + debug("Unknown proto", obj.iderinfo.proto); obj.Stop(); } if (obj.iderinfo.readbfr > 8192) { - if (obj.debug) console.log("Illegal read buffer size", obj.iderinfo.readbfr); + debug("Illegal read buffer size", obj.iderinfo.readbfr); obj.Stop(); } if (obj.iderinfo.writebfr > 8192) { - if (obj.debug) console.log("Illegal write buffer size", obj.iderinfo.writebfr); + debug("Illegal write buffer size", obj.iderinfo.writebfr); obj.Stop(); } - if (obj.iderStart == 0) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x08)); } // OnReboot - else if (obj.iderStart == 1) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x10)); } // Graceful - else if (obj.iderStart == 2) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x18)); } // Now + if (obj.iderStart == 0) { obj.SendDisableEnableFeatures(3, webserver.common.IntToStrX(0x01 + 0x08)); } // OnReboot + else if (obj.iderStart == 1) { obj.SendDisableEnableFeatures(3, webserver.common.IntToStrX(0x01 + 0x10)); } // Graceful + else if (obj.iderStart == 2) { obj.SendDisableEnableFeatures(3, webserver.common.IntToStrX(0x01 + 0x18)); } // Now //obj.SendDisableEnableFeatures(1); // GetSupportedFeatures return 30 + len; case 0x43: // CLOSE - if (obj.debug) console.log('CLOSE'); + debug('CLOSE'); obj.Stop(); return 8; case 0x44: // KEEPALIVEPING obj.SendCommand(0x45); // Send PONG back return 8; case 0x45: // KEEPALIVEPONG - if (obj.debug) console.log('PONG'); + debug('PONG'); return 8; case 0x46: // RESETOCCURED if (obj.acc.length < 9) return 0; - var resetMask = obj.acc[8]; + var resetMask = obj.acc.charCodeAt(8); if (g_media === null) { // No operations are pending obj.SendCommand(0x47); // Send ResetOccuredResponse - if (obj.debug) console.log('RESETOCCURED1', resetMask); + debug('RESETOCCURED1', resetMask); } else { // Operations are being done, sent the reset once completed. g_reset = true; - if (obj.debug) console.log('RESETOCCURED2', resetMask); + debug('RESETOCCURED2', resetMask); } return 9; case 0x49: // STATUS_DATA - DisableEnableFeaturesReply if (obj.acc.length < 13) return 0; - var type = obj.acc[8]; - var value = ReadIntX(obj.acc, 9); - if (obj.debug) console.log('STATUS_DATA', type, value); - switch (type) { + var type = obj.acc.charCodeAt(8); + var value = webserver.common.ReadIntX(obj.acc, 9); + debug('STATUS_DATA', type, value); + switch (type) + { case 1: // REGS_AVAIL if (value & 1) { - if (obj.iderStart == 0) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x08)); } // OnReboot - else if (obj.iderStart == 1) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x10)); } // Graceful - else if (obj.iderStart == 2) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x18)); } // Now + if (obj.iderStart == 0) { obj.SendDisableEnableFeatures(3, webserver.common.IntToStrX(0x01 + 0x08)); } // OnReboot + else if (obj.iderStart == 1) { obj.SendDisableEnableFeatures(3, webserver.common.IntToStrX(0x01 + 0x10)); } // Graceful + else if (obj.iderStart == 2) { obj.SendDisableEnableFeatures(3, webserver.common.IntToStrX(0x01 + 0x18)); } // Now } break; case 2: // REGS_STATUS obj.enabled = (value & 2) ? true : false; - if (obj.debug) console.log("IDER Status: " + obj.enabled); + debug("IDER Status: " + obj.enabled); break; case 3: // REGS_TOGGLE if (value != 1) { - if (obj.debug) console.log("Register toggle failure"); + debug("Register toggle failure"); } //else { obj.SendDisableEnableFeatures(2); } break; } return 13; case 0x4A: // ERROR OCCURED if (obj.acc.length < 11) return 0; - if (obj.debug) console.log('IDER: ABORT', obj.acc[8]); + debug('IDER: ABORT', obj.acc.charCodeAt(8)); //obj.Stop(); return 11; case 0x4B: // HEARTBEAT - //console.log('HEARTBEAT'); + //debug('HEARTBEAT'); return 8; case 0x50: // COMMAND WRITTEN if (obj.acc.length < 28) return 0; - var device = (obj.acc[14] & 0x10) ? 0xB0 : 0xA0; - var deviceFlags = obj.acc[14]; - var cdb = obj.acc.slice(16, 28); - var featureRegister = obj.acc[9]; - if (obj.debug) console.log('SCSI_CMD', device, cdb.toString('hex'), featureRegister, deviceFlags); + var device = (obj.acc.charCodeAt(14) & 0x10) ? 0xB0 : 0xA0; + var deviceFlags = obj.acc.charCodeAt(14); + var cdb = obj.acc.substring(16, 28); + var featureRegister = obj.acc.charCodeAt(9); + debug('SCSI_CMD', device, webserver.common.rstr2hex(cdb), featureRegister, deviceFlags); handleSCSI(device, cdb, featureRegister, deviceFlags); return 28; case 0x53: // DATA FROM HOST if (obj.acc.length < 14) return 0; - var len = ReadShortX(obj.acc, 9); + var len = webserver.common.ReadShortX(obj.acc, 9); if (obj.acc.length < (14 + len)) return 0; - if (obj.debug) console.log('SCSI_WRITE, len = ' + (14 + len)); - obj.SendCommand(0x51, Buffer.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x70, 0x03, 0x00, 0x00, 0x00, 0xa0, 0x51, 0x07, 0x27, 0x00]), true); + debug('SCSI_WRITE, len = ' + (14 + len)); + obj.SendCommand(0x51, String.fromCharCode(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x70, 0x03, 0x00, 0x00, 0x00, 0xa0, 0x51, 0x07, 0x27, 0x00), true); return 14 + len; default: - if (obj.debug) console.log('Unknown IDER command', obj.acc[0]); + debug('Unknown IDER command', obj.acc[0]); obj.Stop(); break; } return 0; } - function handleSCSI(dev, cdb, featureRegister, deviceFlags) { + function handleSCSI(dev, cdb, featureRegister, deviceFlags) + { var lba; var len; - switch (cdb[0]) { + switch(cdb.charCodeAt(0)) + { case 0x00: // TEST_UNIT_READY: - if (obj.debug) console.log("SCSI: TEST_UNIT_READY", dev); + debug("SCSI: TEST_UNIT_READY", dev); switch (dev) { case 0xA0: // DEV_FLOPPY if (obj.floppy == null) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; } @@ -343,34 +354,34 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { if (obj.cdromReady == false) { obj.cdromReady = true; obj.SendCommandEndResponse(1, 0x06, dev, 0x28, 0x00); return -1; } // Switch to ready break; default: - if (obj.debug) console.log("SCSI Internal error 3", dev); + debug("SCSI Internal error 3", dev); return -1; } obj.SendCommandEndResponse(1, 0x00, dev, 0x00, 0x00); // Indicate ready break; case 0x08: // READ_6 - lba = ((cdb[1] & 0x1f) << 16) + (cdb[2] << 8) + cdb[3]; - len = cdb[4]; + lba = ((cdb.charCodeAt(1) & 0x1f) << 16) + (cdb.charCodeAt(2) << 8) + cdb.charCodeAt(3); + len = cdb.charCodeAt(4); if (len == 0) { len = 256; } - if (obj.debug) console.log("SCSI: READ_6", dev, lba, len); + debug("SCSI: READ_6", dev, lba, len); sendDiskData(dev, lba, len, featureRegister); break; case 0x0a: // WRITE_6 - lba = ((cdb[1] & 0x1f) << 16) + (cdb[2] << 8) + cdb[3]; - len = cdb[4]; + lba = ((cdb.charCodeAt(1) & 0x1f) << 16) + (cdb.charCodeAt(2) << 8) + cdb.charCodeAt(3); + len = cdb.charCodeAt(4); if (len == 0) { len = 256; } - if (obj.debug) console.log("SCSI: WRITE_6", dev, lba, len); + debug("SCSI: WRITE_6", dev, lba, len); obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); // Write is not supported, remote no medium. return -1; - /* - case 0x15: // MODE_SELECT_6: - console.log("SCSI ERROR: MODE_SELECT_6", dev); - obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00); - return -1; - */ + /* + case 0x15: // MODE_SELECT_6: + debug("SCSI ERROR: MODE_SELECT_6", dev); + obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00); + return -1; + */ case 0x1a: // MODE_SENSE_6 - if (obj.debug) console.log("SCSI: MODE_SENSE_6", dev); - if ((cdb[2] == 0x3f) && (cdb[3] == 0x00)) { + debug("SCSI: MODE_SENSE_6", dev); + if ((cdb.charCodeAt(2) == 0x3f) && (cdb.charCodeAt(3) == 0x00)) { var a = 0, b = 0; switch (dev) { case 0xA0: // DEV_FLOPPY @@ -384,89 +395,90 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { b = 0x80; break; default: - if (obj.debug) console.log("SCSI Internal error 6", dev); + debug("SCSI Internal error 6", dev); return -1; } - obj.SendDataToHost(dev, true, Buffer.from([0, a, b, 0]), featureRegister & 1); + obj.SendDataToHost(dev, true, String.fromCharCode(0, a, b, 0), featureRegister & 1); return; } obj.SendCommandEndResponse(1, 0x05, dev, 0x24, 0x00); break; case 0x1b: // START_STOP (Called when you eject the CDROM) - //var immediate = cdb[1] & 0x01; - //var loej = cdb[4] & 0x02; - //var start = cdb[4] & 0x01; + //var immediate = cdb.charCodeAt(1) & 0x01; + //var loej = cdb.charCodeAt(4) & 0x02; + //var start = cdb.charCodeAt(4) & 0x01; obj.SendCommandEndResponse(1, 0, dev); break; case 0x1e: // LOCK_UNLOCK - ALLOW_MEDIUM_REMOVAL - if (obj.debug) console.log("SCSI: ALLOW_MEDIUM_REMOVAL", dev); + debug("SCSI: ALLOW_MEDIUM_REMOVAL", dev); if ((dev == 0xA0) && (obj.floppy == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; } if ((dev == 0xB0) && (obj.cdrom == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; } obj.SendCommandEndResponse(1, 0x00, dev, 0x00, 0x00); break; case 0x23: // READ_FORMAT_CAPACITIES (Floppy only) - if (obj.debug) console.log("SCSI: READ_FORMAT_CAPACITIES", dev); - var buflen = ReadShort(cdb, 7); + debug("SCSI: READ_FORMAT_CAPACITIES", dev); + var buflen = webserver.common.ReadShort(cdb, 7); var mediaStatus = 0, sectors; var mcSize = buflen / 8; // Capacity descriptor size is 8 switch (dev) { case 0xA0: // DEV_FLOPPY - if ((obj.floppy == null) || (obj.floppy.size == 0)) { obj.SendCommandEndResponse(0, 0x05, dev, 0x24, 0x00); return -1; } - sectors = (obj.floppy.size >> 9) - 1; + if ((obj.floppy == null) || (obj.floppySize == 0)) { obj.SendCommandEndResponse(0, 0x05, dev, 0x24, 0x00); return -1; } + sectors = (obj.floppySize >> 9) - 1; break; case 0xB0: // DEV_CDDVD - if ((obj.cdrom == null) || (obj.cdrom.size == 0)) { obj.SendCommandEndResponse(0, 0x05, dev, 0x24, 0x00); return -1; } - sectors = (obj.cdrom.size >> 11) - 1; // Number 2048 byte blocks + if ((obj.cdrom == null) || (obj.cdromSize == 0)) { obj.SendCommandEndResponse(0, 0x05, dev, 0x24, 0x00); return -1; } + sectors = (obj.cdromSize >> 11) - 1; // Number 2048 byte blocks break; default: - if (obj.debug) console.log("SCSI Internal error 4", dev); + debug("SCSI Internal error 4", dev); return -1; } - obj.SendDataToHost(dev, true, Buffer.concat([IntToStr(8), Buffer.from([0x00, 0x00, 0x0b, 0x40, 0x02, 0x00, 0x02, 0x00])]), featureRegister & 1); + obj.SendDataToHost(dev, true, webserver.common.IntToStr(8) + String.fromCharCode(0x00, 0x00, 0x0b, 0x40, 0x02, 0x00, 0x02, 0x00), featureRegister & 1); break; case 0x25: // READ_CAPACITY - if (obj.debug) console.log("SCSI: READ_CAPACITY", dev); + debug("SCSI: READ_CAPACITY", dev); var len = 0; - switch (dev) { + switch(dev) + { case 0xA0: // DEV_FLOPPY - if ((obj.floppy == null) || (obj.floppy.size == 0)) { obj.SendCommandEndResponse(0, 0x02, dev, 0x3a, 0x00); return -1; } - if (obj.floppy != null) { len = (obj.floppy.size >> 9) - 1; } - if (obj.debug) console.log('DEV_FLOPPY', len); // Number 512 byte blocks + if ((obj.floppy == null) || (obj.floppySize == 0)) { obj.SendCommandEndResponse(0, 0x02, dev, 0x3a, 0x00); return -1; } + if (obj.floppy != null) { len = (obj.floppySize >> 9) - 1; } + debug('DEV_FLOPPY', len); // Number 512 byte blocks break; case 0xB0: // DEV_CDDVD - if ((obj.cdrom == null) || (obj.cdrom.size == 0)) { obj.SendCommandEndResponse(0, 0x02, dev, 0x3a, 0x00); return -1; } - if (obj.cdrom != null) { len = (obj.cdrom.size >> 11) - 1; } // Number 2048 byte blocks - if (obj.debug) console.log('DEV_CDDVD', len); + if ((obj.floppy == null) || (obj.floppySize == 0)) { obj.SendCommandEndResponse(0, 0x02, dev, 0x3a, 0x00); return -1; } + if (obj.cdrom != null) { len = (obj.cdromSize >> 11) - 1; } // Number 2048 byte blocks + debug('DEV_CDDVD', len); break; default: - if (obj.debug) console.log("SCSI Internal error 4", dev); + debug("SCSI Internal error 4", dev); return -1; } //if (dev == 0xA0) { dev = 0x00; } else { dev = 0x10; } // Weird but seems to work. - if (obj.debug) console.log("SCSI: READ_CAPACITY2", dev, deviceFlags); - obj.SendDataToHost(deviceFlags, true, Buffer.concat([IntToStr(len), Buffer.from([0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0])]), featureRegister & 1); + debug("SCSI: READ_CAPACITY2", dev, deviceFlags); + obj.SendDataToHost(deviceFlags, true, webserver.common.IntToStr(len) + String.fromCharCode(0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0), featureRegister & 1); break; case 0x28: // READ_10 - lba = ReadInt(cdb, 2); - len = ReadShort(cdb, 7); - if (obj.debug) console.log("SCSI: READ_10", dev, lba, len); + lba = webserver.common.ReadInt(cdb, 2); + len = webserver.common.ReadShort(cdb, 7); + debug("SCSI: READ_10", dev, lba, len); sendDiskData(dev, lba, len, featureRegister); break; case 0x2a: // WRITE_10 (Floppy only) case 0x2e: // WRITE_AND_VERIFY (Floppy only) - lba = ReadInt(cdb, 2); - len = ReadShort(cdb, 7); - if (obj.debug) console.log("SCSI: WRITE_10", dev, lba, len); + lba = webserver.common.ReadInt(cdb, 2); + len = webserver.common.ReadShort(cdb, 7); + debug("SCSI: WRITE_10", dev, lba, len); obj.SendGetDataFromHost(dev, 512 * len); // Floppy writes only, accept sectors of 512 bytes break; case 0x43: // READ_TOC (CD Audio only) - var buflen = ReadShort(cdb, 7); - var msf = cdb[1] & 0x02; - var format = cdb[2] & 0x07; - if (format == 0) { format = cdb[9] >> 6; } - if (obj.debug) console.log("SCSI: READ_TOC, dev=" + dev + ", buflen=" + buflen + ", msf=" + msf + ", format=" + format); + var buflen = webserver.common.ReadShort(cdb, 7); + var msf = cdb.charCodeAt(1) & 0x02; + var format = cdb.charCodeAt(2) & 0x07; + if (format == 0) { format = cdb.charCodeAt(9) >> 6; } + debug("SCSI: READ_TOC, dev=" + dev + ", buflen=" + buflen + ", msf=" + msf + ", format=" + format); switch (dev) { case 0xA0: // DEV_FLOPPY @@ -476,100 +488,96 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { // NOP break; default: - if (obj.debug) console.log("SCSI Internal error 9", dev); + debug("SCSI Internal error 9", dev); return -1; } - if (format == 1) { obj.SendDataToHost(dev, true, Buffer.from([0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), featureRegister & 1); } + if (format == 1) { obj.SendDataToHost(dev, true, String.fromCharCode(0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00), featureRegister & 1); } else if (format == 0) { if (msf) { - obj.SendDataToHost(dev, true, Buffer.from([0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x34, 0x13]), featureRegister & 1); + obj.SendDataToHost(dev, true, String.fromCharCode(0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x34, 0x13), featureRegister & 1); } else { - obj.SendDataToHost(dev, true, Buffer.from([0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00]), featureRegister & 1); + obj.SendDataToHost(dev, true, String.fromCharCode(0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00), featureRegister & 1); } } break; case 0x46: // GET_CONFIGURATION - var sendall = (cdb[1] != 2); - var firstcode = ReadShort(cdb, 2); - var buflen = ReadShort(cdb, 7); + var sendall = (cdb.charCodeAt(1) != 2); + var firstcode = webserver.common.ReadShort(cdb, 2); + var buflen = webserver.common.ReadShort(cdb, 7); - if (obj.debug) console.log("SCSI: GET_CONFIGURATION", dev, sendall, firstcode, buflen); - if (buflen == 0) { obj.SendDataToHost(dev, true, Buffer.concat([IntToStr(0x003c), IntToStr(0x0008)]), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. + debug("SCSI: GET_CONFIGURATION", dev, sendall, firstcode, buflen); + + if (buflen == 0) { obj.SendDataToHost(dev, true, webserver.common.IntToStr(0x003c) + webserver.common.IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. // Set the header - var r = null; + var r = webserver.common.IntToStr(0x0008); // Add the data - if (firstcode == 0) { r = IDE_CD_ConfigArrayProfileList; } - if ((firstcode == 0x1) || (sendall && (firstcode < 0x1))) { r = IDE_CD_ConfigArrayCore; } - if ((firstcode == 0x2) || (sendall && (firstcode < 0x2))) { r = IDE_CD_Morphing; } - if ((firstcode == 0x3) || (sendall && (firstcode < 0x3))) { r = IDE_CD_ConfigArrayRemovable; } - if ((firstcode == 0x10) || (sendall && (firstcode < 0x10))) { r = IDE_CD_ConfigArrayRandom; } - if ((firstcode == 0x1E) || (sendall && (firstcode < 0x1E))) { r = IDE_CD_Read; } - if ((firstcode == 0x100) || (sendall && (firstcode < 0x100))) { r = IDE_CD_PowerManagement; } - if ((firstcode == 0x105) || (sendall && (firstcode < 0x105))) { r = IDE_CD_Timeout; } + if (firstcode == 0) { r += IDE_CD_ConfigArrayProfileList; } + if ((firstcode == 0x1) || (sendall && (firstcode < 0x1))) { r += IDE_CD_ConfigArrayCore; } + if ((firstcode == 0x2) || (sendall && (firstcode < 0x2))) { r += IDE_CD_Morphing; } + if ((firstcode == 0x3) || (sendall && (firstcode < 0x3))) { r += IDE_CD_ConfigArrayRemovable; } + if ((firstcode == 0x10) || (sendall && (firstcode < 0x10))) { r += IDE_CD_ConfigArrayRandom; } + if ((firstcode == 0x1E) || (sendall && (firstcode < 0x1E))) { r += IDE_CD_Read; } + if ((firstcode == 0x100) || (sendall && (firstcode < 0x100))) { r += IDE_CD_PowerManagement; } + if ((firstcode == 0x105) || (sendall && (firstcode < 0x105))) { r += IDE_CD_Timeout; } - if (r == null) { - //console.log('NOT RIGHT', sendall, firstcode, cdb[2], cdb[3]); - //process.exit(0); - r = Buffer.concat([IntToStr(0x0008), IntToStr(4)]); - } else { - r = Buffer.concat([IntToStr(0x0008), IntToStr(r.length + 4), r]); - } + // Set the length + r = webserver.common.IntToStr(r.length) + r; // Cut the length to buflen if needed - if (r.length > buflen) { r = r.slice(0, buflen); } + if (r.length > buflen) { r = r.substring(0, buflen); } obj.SendDataToHost(dev, true, r, featureRegister & 1); return -1; case 0x4a: // GET_EV_STATUS - GET_EVENT_STATUS_NOTIFICATION - //var buflen = (cdb[7] << 8) + cdb[8]; - //if (buflen == 0) { obj.SendDataToHost(dev, true, Buffer.concat([IntToStr(0x003c), IntToStr(0x0008)]), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. - if (obj.debug) console.log("SCSI: GET_EVENT_STATUS_NOTIFICATION", dev, cdb[1], cdb[4], cdb[9]); - if ((cdb[1] != 0x01) && (cdb[4] != 0x10)) { - if (obj.debug) console.log('SCSI ERROR'); + //var buflen = (cdb.charCodeAt(7) << 8) + cdb.charCodeAt(8); + //if (buflen == 0) { obj.SendDataToHost(dev, true, webserver.common.IntToStr(0x003c) + webserver.common.IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. + debug("SCSI: GET_EVENT_STATUS_NOTIFICATION", dev, cdb.charCodeAt(1), cdb.charCodeAt(4), cdb.charCodeAt(9)); + if ((cdb.charCodeAt(1) != 0x01) && (cdb.charCodeAt(4) != 0x10)) { + debug('SCSI ERROR'); obj.SendCommandEndResponse(1, 0x05, dev, 0x26, 0x01); break; } var present = 0x00; if ((dev == 0xA0) && (obj.floppy != null)) { present = 0x02; } else if ((dev == 0xB0) && (obj.cdrom != null)) { present = 0x02; } - obj.SendDataToHost(dev, true, Buffer.from([0x00, present, 0x80, 0x00]), featureRegister & 1); // This is the original version, 4 bytes long + obj.SendDataToHost(dev, true, String.fromCharCode(0x00, present, 0x80, 0x00), featureRegister & 1); // This is the original version, 4 bytes long break; case 0x4c: - obj.SendCommand(0x51, Buffer.concat([IntToStrX(0), IntToStrX(0), IntToStrX(0), Buffer.from([0x87, 0x50, 0x03, 0x00, 0x00, 0x00, 0xb0, 0x51, 0x05, 0x20, 0x00])]), true); + obj.SendCommand(0x51, webserver.common.IntToStrX(0) + webserver.common.IntToStrX(0) + webserver.common.IntToStrX(0) + String.fromCharCode(0x87, 0x50, 0x03, 0x00, 0x00, 0x00, 0xb0, 0x51, 0x05, 0x20, 0x00), true); break; case 0x51: // READ_DISC_INFO - if (obj.debug) console.log("SCSI READ_DISC_INFO", dev); + debug("SCSI READ_DISC_INFO", dev); obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); // Correct return -1; case 0x55: // MODE_SELECT_10: - if (obj.debug) console.log("SCSI ERROR: MODE_SELECT_10", dev); + debug("SCSI ERROR: MODE_SELECT_10", dev); obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00); return -1; case 0x5a: // MODE_SENSE_10 - if (obj.debug) console.log("SCSI: MODE_SENSE_10", dev, cdb[2] & 0x3f); - var buflen = ReadShort(cdb, 7); - //var pc = cdb[2] & 0xc0; + debug("SCSI: MODE_SENSE_10", dev, cdb.charCodeAt(2) & 0x3f); + var buflen = webserver.common.ReadShort(cdb, 7); + //var pc = cdb.charCodeAt(2) & 0xc0; var r = null; - - if (buflen == 0) { obj.SendDataToHost(dev, true, Buffer.concat([IntToStr(0x003c), IntToStr(0x0008)]), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. + + if (buflen == 0) { obj.SendDataToHost(dev, true, webserver.common.IntToStr(0x003c) + webserver.common.IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. // 1.44 mb floppy or LS120 (sectorCount == 0x3c300) var sectorCount = 0; if (dev == 0xA0) { - if (obj.floppy != null) { sectorCount = (obj.floppy.size >> 9); } + if (obj.floppy != null) { sectorCount = (obj.floppySize >> 9); } } else { - if (obj.cdrom != null) { sectorCount = (obj.cdrom.size >> 11); } + if (obj.cdrom != null) { sectorCount = (obj.cdromSize >> 11); } } - switch (cdb[2] & 0x3f) { - case 0x01: if (dev == 0xA0) { r = (sectorCount <= 0xb40) ? IDE_ModeSence_FloppyError_Recovery_Array : IDE_ModeSence_Ls120Error_Recovery_Array; } else { r = IDE_ModeSence_CDError_Recovery_Array; } break; - case 0x05: if (dev == 0xA0) { r = (sectorCount <= 0xb40) ? IDE_ModeSence_FloppyDisk_Page_Array : IDE_ModeSence_LS120Disk_Page_Array; } break; - case 0x3f: if (dev == 0xA0) { r = (sectorCount <= 0xb40) ? IDE_ModeSence_3F_Floppy_Array : IDE_ModeSence_3F_LS120_Array; } else { r = IDE_ModeSence_3F_CD_Array; } break; + switch (cdb.charCodeAt(2) & 0x3f) { + case 0x01: if (dev == 0xA0) { r = (sectorCount <= 0xb40)?IDE_ModeSence_FloppyError_Recovery_Array:IDE_ModeSence_Ls120Error_Recovery_Array; } else { r = IDE_ModeSence_CDError_Recovery_Array; } break; + case 0x05: if (dev == 0xA0) { r = (sectorCount <= 0xb40)?IDE_ModeSence_FloppyDisk_Page_Array:IDE_ModeSence_LS120Disk_Page_Array; } break; + case 0x3f: if (dev == 0xA0) { r = (sectorCount <= 0xb40)?IDE_ModeSence_3F_Floppy_Array:IDE_ModeSence_3F_LS120_Array; } else { r = IDE_ModeSence_3F_CD_Array; } break; case 0x1A: if (dev == 0xB0) { r = IDE_ModeSence_CD_1A_Array; } break; - case 0x1D: if (dev == 0xB0) { r = IDE_ModeSence_CD_1D_Array; } break; + case 0x1D: if (dev == 0xB0) { r = IDE_ModeSence_CD_1D_Array; } break; case 0x2A: if (dev == 0xB0) { r = IDE_ModeSence_CD_2A_Array; } break; } @@ -581,14 +589,8 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { obj.SendDataToHost(dev, true, r, featureRegister & 1); } break; - case 0x51: // READ_DISK_INFORMATION - obj.SendDataToHost(dev, true, RD_CD_DiskInfo, featureRegister & 1); - break; - case 0xAC: // GET_PERFORMANCE - obj.SendDataToHost(dev, true, RD_CD_Performance, featureRegister & 1); - break; default: // UNKNOWN COMMAND - if (obj.debug) console.log("IDER: Unknown SCSI command", cdb[0]); + debug("IDER: Unknown SCSI command", cdb.charCodeAt(0)); obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); return -1; } @@ -598,8 +600,8 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { function sendDiskData(dev, lba, len, featureRegister) { var media = null; var mediaBlocks = 0; - if (dev == 0xA0) { media = obj.floppy; if (obj.floppy != null) { mediaBlocks = (obj.floppy.size >> 9); } } - if (dev == 0xB0) { media = obj.cdrom; if (obj.cdrom != null) { mediaBlocks = (obj.cdrom.size >> 11); } } + if (dev == 0xA0) { media = obj.floppy; if (obj.floppy != null) { mediaBlocks = (obj.floppySize >> 9); } } + if (dev == 0xB0) { media = obj.cdrom; if (obj.cdrom != null) { mediaBlocks = (obj.cdromSize >> 11); } } if ((len < 0) || (lba + len > mediaBlocks)) { obj.SendCommandEndResponse(1, 0x05, dev, 0x21, 0x00); return 0; } if (len == 0) { obj.SendCommandEndResponse(1, 0x00, dev, 0x00, 0x00); return 0; } if (media != null) { @@ -626,10 +628,9 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { if (g_len > obj.iderinfo.readbfr) { len = obj.iderinfo.readbfr; } g_len -= len; g_lba += len; - var buffer = Buffer.alloc(len); - fs.read(g_media.ptr, buffer, 0, len, lba, function (error, bytesRead, buffer) { - obj.SendDataToHost(g_dev, (g_len == 0), buffer, featureRegister & 1); + fs.read(g_media, buffer, 0, len, lba, function (error, bytesRead, buffer) { + obj.SendDataToHost(g_dev, (g_len == 0), buffer.toString('binary'), featureRegister & 1); if ((g_len > 0) && (g_reset == false)) { sendDiskDataEx(featureRegister); } else { @@ -642,13 +643,3 @@ module.exports.CreateAmtRemoteIder = function (webserver, meshcentral) { return obj; } - -function ShortToStr(v) { return Buffer.from([(v >> 8) & 0xFF, v & 0xFF]); } -function ShortToStrX(v) { return Buffer.from([v & 0xFF, (v >> 8) & 0xFF]); } -function IntToStr(v) { return Buffer.from([(v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]); } -function IntToStrX(v) { return Buffer.from([v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF]); } -function ReadShort(v, p) { return (v[p] << 8) + v[p + 1]; } -function ReadShortX(v, p) { return (v[p + 1] << 8) + v[p]; } -function ReadInt(v, p) { return (v[p] * 0x1000000) + (v[p + 1] << 16) + (v[p + 2] << 8) + v[p + 3]; } // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32. -function ReadSInt(v, p) { return (v[p] << 24) + (v[p + 1] << 16) + (v[p + 2] << 8) + v[p + 3]; } -function ReadIntX(v, p) { return (v[p + 3] * 0x1000000) + (v[p + 2] << 16) + (v[p + 1] << 8) + v[p]; } \ No newline at end of file diff --git a/amt/amt-ider.js b/amt/amt-ider.js index 361e70a8..bc39e5ba 100644 --- a/amt/amt-ider.js +++ b/amt/amt-ider.js @@ -127,8 +127,8 @@ module.exports.CreateAmtIderSession = function (parent, db, ws, req, args, domai if ((command.args.floppyPath != null) && (typeof command.args.floppyPath != 'string')) { command.args.floppyPath = null; } else { command.args.floppyPath = decodeURIComponent(command.args.floppyPath); } if ((command.args.cdromPath != null) && (typeof command.args.cdromPath != 'string')) { command.args.cdromPath = null; } else { command.args.cdromPath = decodeURIComponent(command.args.cdromPath); } // TODO: Double check that "." or ".." are not used. - if ((command.args.floppyPath != null) && (command.args.floppyPath.indexOf('..') >= 0)) { delete command.args.floppyPath; } - if ((command.args.cdromPath != null) && (command.args.cdromPath.indexOf('..') >= 0)) { delete command.args.cdromPath; } + if ((command.args.floppyPath != null) && (command.args.floppyPath.indexOf("..") >= 0)) { delete command.args.floppyPath; } + if ((command.args.cdromPath != null) && (command.args.cdromPath.indexOf("..") >= 0)) { delete command.args.cdromPath; } // Get the disk image paths var domainx = 'domain' + ((domain.id == '') ? '' : ('-' + domain.id)); @@ -148,7 +148,7 @@ module.exports.CreateAmtIderSession = function (parent, db, ws, req, args, domai var iderError = obj.ider.m.diskSetup(floppyPath, cdromPath); // Error with the disk images, unable to start IDER - if (iderError != 0) { try { ws.send(JSON.stringify({ action: 'error', code: iderError })); } catch (ex) { } break; } + if (iderError != 0) { try { ws.send(JSON.stringify({ action: "error", code: iderError })); } catch (ex) { } break; } // Start the IDER session obj.ider.Start(req.query.host, req.query.port, req.query.tls); diff --git a/amt/amt-redir-mesh.js b/amt/amt-redir-mesh.js index 1b624349..28f6e481 100644 --- a/amt/amt-redir-mesh.js +++ b/amt/amt-redir-mesh.js @@ -44,10 +44,10 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me obj.redirTrace = false; obj.tls1only = 0; // TODO - obj.amtaccumulator = ''; + obj.amtaccumulator = ""; obj.amtsequence = 1; obj.amtkeepalivetimer = null; - obj.authuri = '/RedirectionService'; + obj.authuri = "/RedirectionService"; obj.onStateChanged = null; obj.forwardclient = null; @@ -71,7 +71,7 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me const SITERIGHT_LOCKED = 32; function Debug(lvl) { - if ((arguments.length < 2) || (meshcentral.debugLevel == null) || (lvl > meshcentral.debugLevel)) return; + if ((arguments.length < 2) || (lvl > meshcentral.debugLevel)) return; var a = []; for (var i = 1; i < arguments.length; i++) { a.push(arguments[i]); } console.log(...a); } @@ -81,7 +81,7 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me var obj = new require('stream').Duplex(options); obj.forwardwrite = null; obj.updateBuffer = function (chunk) { this.push(chunk); }; - obj._write = function (chunk, encoding, callback) { if (obj.forwardwrite != null) { obj.forwardwrite(chunk); } else { console.err('Failed to fwd _write.'); } if (callback) callback(); }; // Pass data written to forward + obj._write = function (chunk, encoding, callback) { if (obj.forwardwrite != null) { obj.forwardwrite(chunk); } else { console.err("Failed to fwd _write."); } if (callback) callback(); }; // Pass data written to forward obj._read = function (size) { }; // Push nothing, anything to read should be pushed from updateBuffer() return obj; } @@ -478,17 +478,10 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me } obj.xxSend = function (x) { - if (typeof x == 'string') { - if (obj.redirTrace) { console.log("REDIR-SEND(" + x.length + "): " + Buffer.from(x, 'binary').toString('hex'), typeof x); } - //obj.Debug("Send(" + x.length + "): " + webserver.common.rstr2hex(x)); - //obj.forwardclient.write(x); // FIXES CIRA - obj.forwardclient.write(Buffer.from(x, 'binary')); - } else { - if (obj.redirTrace) { console.log("REDIR-SEND(" + x.length + "): " + x.toString('hex'), typeof x); } - //obj.Debug("Send(" + x.length + "): " + webserver.common.rstr2hex(x)); - //obj.forwardclient.write(x); // FIXES CIRA - obj.forwardclient.write(x); - } + if (obj.redirTrace) { console.log("REDIR-SEND(" + x.length + "): " + Buffer.from(x, "binary").toString('hex'), typeof x); } + //obj.Debug("Send(" + x.length + "): " + webserver.common.rstr2hex(x)); + //obj.forwardclient.write(x); // FIXES CIRA + obj.forwardclient.write(Buffer.from(x, "binary")); } obj.Send = function (x) { @@ -504,7 +497,7 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me obj.xxRandomValueHex = function(len) { return obj.crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); } obj.xxOnSocketClosed = function () { - if (obj.redirTrace) { console.log('REDIR-CLOSED'); } + if (obj.redirTrace) { console.log("REDIR-CLOSED"); } //obj.Debug("Socket Closed"); obj.Stop(); } @@ -517,12 +510,12 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me } obj.Stop = function () { - if (obj.redirTrace) { console.log('REDIR-CLOSED'); } + if (obj.redirTrace) { console.log("REDIR-CLOSED"); } //obj.Debug("Socket Stopped"); obj.xxStateChange(0); obj.connectstate = -1; - obj.amtaccumulator = ''; - if (obj.forwardclient != null) { try { obj.forwardclient.destroy(); } catch (ex) { } delete obj.forwardclient; } + obj.amtaccumulator = ""; + if (obj.forwardclient != null) { try { obj.forwardclient.close(); } catch (ex) { } delete obj.forwardclient; } if (obj.amtkeepalivetimer != null) { clearInterval(obj.amtkeepalivetimer); delete obj.amtkeepalivetimer; } } diff --git a/amt/amt-wsman-comm.js b/amt/amt-wsman-comm.js index 689250d0..2f46ffb2 100644 --- a/amt/amt-wsman-comm.js +++ b/amt/amt-wsman-comm.js @@ -170,11 +170,13 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn //console.log('SEND: ' + h); // Display send packet } - // Parse the HTTP digest header and return a list of key & values. - obj.parseDigest = function (header) { return correctedQuoteSplit(header.substring(7)).reduce(function (obj, s) { var parts = s.trim().split('='); obj[parts[0]] = parts[1].replace(new RegExp('\"', 'g'), ''); return obj; }, {}) } + // NODE.js specific private method + obj.parseDigest = function (header) { + var t = header.substring(7).split(','); + for (var i in t) t[i] = t[i].trim(); + return t.reduce(function (obj, s) { var parts = s.split('='); obj[parts[0]] = parts[1].replace(new RegExp('\"', 'g'), ''); return obj; }, {}) + } - // Split a string on quotes but do not do it when in quotes - function correctedQuoteSplit(str) { return str.split(',').reduce(function (a, c) { if (a.ic) { a.st[a.st.length - 1] += ',' + c } else { a.st.push(c) } if (c.split('"').length % 2 == 0) { a.ic = !a.ic } return a; }, { st: [], ic: false }).st } function nonceHex(v) { var s = ('00000000' + v.toString(16)); return s.substring(s.length - 8); } // NODE.js specific private method @@ -274,7 +276,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn obj.socket.connect(obj.port, obj.host, obj.xxOnSocketConnected); } else { // Direct connect with TLS - var options = { ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: obj.constants.SSL_OP_NO_SSLv2 | obj.constants.SSL_OP_NO_SSLv3 | obj.constants.SSL_OP_NO_COMPRESSION | obj.constants.SSL_OP_CIPHER_SERVER_PREFERENCE | obj.constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, rejectUnauthorized: false }; + var options = { ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: obj.constants.SSL_OP_NO_SSLv2 | obj.constants.SSL_OP_NO_SSLv3 | obj.constants.SSL_OP_NO_COMPRESSION | obj.constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false }; if (obj.xtlsMethod != 0) { options.secureProtocol = 'TLSv1_method'; } if (obj.xtlsoptions) { if (obj.xtlsoptions.ca) { options.ca = obj.xtlsoptions.ca; } diff --git a/amtmanager.js b/amtmanager.js index 10e19647..23004792 100644 --- a/amtmanager.js +++ b/amtmanager.js @@ -707,15 +707,7 @@ module.exports.CreateAmtManager = function (parent) { dev.aquired.controlMode = responses['IPS_HostBasedSetupService'].response.CurrentControlMode; // 1 = CCM, 2 = ACM if (typeof stack.wsman.comm.amtVersion == 'string') { // Set the Intel AMT version using the HTTP header if present var verSplit = stack.wsman.comm.amtVersion.split('.'); - if (verSplit.length >= 2) { - dev.aquired.version = verSplit[0] + '.' + verSplit[1]; - dev.aquired.majorver = parseInt(verSplit[0]); - dev.aquired.minorver = parseInt(verSplit[1]); - if (verSplit.length >= 3) { - dev.aquired.version = verSplit[0] + '.' + verSplit[1] + '.' + verSplit[2]; - dev.aquired.maintenancever = parseInt(verSplit[2]); - } - } + if (verSplit.length >= 3) { dev.aquired.version = verSplit[0] + '.' + verSplit[1] + '.' + verSplit[2]; dev.aquired.majorver = parseInt(verSplit[0]); dev.aquired.minorver = parseInt(verSplit[1]); } } dev.aquired.realm = stack.wsman.comm.digestRealm; dev.aquired.user = dev.intelamt.user = stack.wsman.comm.user; @@ -758,8 +750,7 @@ module.exports.CreateAmtManager = function (parent) { // Start power polling if not connected to LMS var ppfunc = function powerPoleFunction() { fetchPowerState(powerPoleFunction.dev); } ppfunc.dev = dev; - if(dev.polltimer){ clearInterval(dev.polltimer); delete dev.polltimer; } - dev.polltimer = new setInterval(ppfunc, 290000); // Poll for power state every 4 minutes 50 seconds. + dev.polltimer = new setTimeout(ppfunc, 290000); // Poll for power state every 4 minutes 50 seconds. fetchPowerState(dev); } else { // For LMS connections, close now. @@ -939,8 +930,8 @@ module.exports.CreateAmtManager = function (parent) { if (response.Body.OSPowerSavingState == 2) { meshPowerState = 1; } // Fully powered (S0); else if (response.Body.OSPowerSavingState == 3) { meshPowerState = 2; } // Modern standby (We are going to call this S1); - // Set OS power state - connType: 0 = CIRA, 1 = CIRA-Relay, 2 = CIRA-LMS, 3 = LAN - if (meshPowerState >= 0) { parent.SetConnectivityState(dev.meshid, dev.nodeid, Date.now(), (dev.connType == 3 ? 4 : 2), meshPowerState, null, { name: dev.name }); } + // Set OS power state + if (meshPowerState >= 0) { parent.SetConnectivityState(dev.meshid, dev.nodeid, Date.now(), 4, meshPowerState, null, { name: dev.name }); } }); } else { // Convert the power state @@ -949,83 +940,28 @@ module.exports.CreateAmtManager = function (parent) { var meshPowerState = -1, powerConversionTable = [-1, -1, 1, 2, 3, 6, 6, 5, 6]; if (powerstate < powerConversionTable.length) { meshPowerState = powerConversionTable[powerstate]; } else { powerstate = 6; } - // Set power state - connType: 0 = CIRA, 1 = CIRA-Relay, 2 = CIRA-LMS, 3 = LAN - if (meshPowerState >= 0) { parent.SetConnectivityState(dev.meshid, dev.nodeid, Date.now(), (dev.connType == 3 ? 4 : 2), meshPowerState, null, { name: dev.name }); } + // Set power state + if (meshPowerState >= 0) { parent.SetConnectivityState(dev.meshid, dev.nodeid, Date.now(), 4, meshPowerState, null, { name: dev.name }); } } }); } - // Perform a power action: 2 = Power up, 5 = Power cycle, 8 = Power down, 10 = Reset, 11 = Power on to BIOS, 12 = Reset to BIOS, 13 = Power on to BIOS with SOL, 14 = Reset to BIOS with SOL, 15 = Power on to PXE, 16 = Reset to PXE + // Perform a power action: 2 = Power up, 5 = Power cycle, 8 = Power down, 10 = Reset function performPowerAction(nodeid, action) { - console.log('performPowerAction', nodeid, action); var devices = obj.amtDevices[nodeid]; if (devices == null) return; for (var i in devices) { var dev = devices[i]; // If not LMS, has a AMT stack present and is in connected state, perform power operation. if ((dev.connType != 2) && (dev.state == 1) && (dev.amtstack != null)) { + // Action: 2 = Power on, 8 = Power down, 10 = reset parent.debug('amt', dev.name, "performPowerAction", action); dev.powerAction = action; - if (action <= 10) { - // Action: 2 = Power up, 5 = Power cycle, 8 = Power down, 10 = Reset - try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { } - } else { - // 11 = Power on to BIOS, 12 = Reset to BIOS, 13 = Power on to BIOS with SOL, 14 = Reset to BIOS with SOL, 15 = Power on to PXE, 16 = Reset to PXE - dev.amtstack.BatchEnum(null, ['*AMT_BootSettingData'], performAdvancedPowerActionResponse); - } + try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { } } } } - // Response to Intel AMT advanced power action - function performAdvancedPowerActionResponse(stack, name, responses, status) { - const dev = stack.dev; - const action = dev.powerAction; - delete dev.powerAction; - if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response. - if (status != 200) return; - if ((responses['AMT_BootSettingData'] == null) || (responses['AMT_BootSettingData'].response == null)) return; - var bootSettingData = responses['AMT_BootSettingData'].response; - - // Clean up parameters - bootSettingData['ConfigurationDataReset'] = false; - delete bootSettingData['WinREBootEnabled']; - delete bootSettingData['UEFILocalPBABootEnabled']; - delete bootSettingData['UEFIHTTPSBootEnabled']; - delete bootSettingData['SecureBootControlEnabled']; - delete bootSettingData['BootguardStatus']; - delete bootSettingData['OptionsCleared']; - delete bootSettingData['BIOSLastStatus']; - delete bootSettingData['UefiBootParametersArray']; - delete bootSettingData['RPEEnabled']; - delete bootSettingData['RSEPassword'] - - // Ready boot parameters - bootSettingData['BIOSSetup'] = ((action >= 11) && (action <= 14)); - bootSettingData['UseSOL'] = ((action >= 13) && (action <= 14)); - if ((action == 11) || (action == 13) || (action == 15)) { dev.powerAction = 2; } // Power on - if ((action == 12) || (action == 14) || (action == 16)) { dev.powerAction = 10; } // Reset - - // Set boot parameters - dev.amtstack.Put('AMT_BootSettingData', bootSettingData, function (stack, name, response, status, tag) { - const dev = stack.dev; - if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error - // Set boot config - dev.amtstack.SetBootConfigRole(1, function (stack, name, response, status, tag) { - const dev = stack.dev; - if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error - // Set boot order - var bootDevice = (action === 15 || action === 16) ? '
http://schemas.xmlsoap.org/ws/2004/08/addressing
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSettingIntel(r) AMT: Force PXE Boot' : null; - dev.amtstack.CIM_BootConfigSetting_ChangeBootOrder(bootDevice, function (stack, name, response, status) { - const dev = stack.dev; - if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error - // Perform power action - try { dev.amtstack.RequestPowerStateChange(dev.powerAction, performPowerActionResponse); } catch (ex) { } - }, 0, 1); - }, 0, 1); - }, 0, 1); - } - // Response to Intel AMT power action function performPowerActionResponse(stack, name, responses, status) { const dev = stack.dev; @@ -1069,7 +1005,7 @@ module.exports.CreateAmtManager = function (parent) { if (status != 200) { dev.consoleMsg("Failed to get security information (" + status + ")."); delete dev.ocrfile; return; } // Check if this Intel AMT device supports OCR - if (responses['AMT_BootCapabilities'].response['ForceUEFIHTTPSBoot'] !== true) { + if (responses['AMT_PublicKeyCertificate'].responses['ForceUEFIHTTPSBoot'] !== true) { dev.consoleMsg("This Intel AMT device does not support UEFI HTTPS boot (" + status + ")."); delete dev.ocrfile; return; } @@ -1099,14 +1035,11 @@ module.exports.CreateAmtManager = function (parent) { // Generate the one-time URL. var cookie = obj.parent.encodeCookie({ a: 'f', f: dev.ocrfile }, obj.parent.loginCookieEncryptionKey) - var url = 'https://' + parent.webserver.certificates.AmtMpsName + ':' + ((parent.args.mpsaliasport != null) ? parent.args.mpsaliasport : parent.args.mpsport) + '/c/' + cookie + '.efi'; + var url = 'https://' + parent.webserver.certificates.AmtMpsName + ':' + ((parent.args.mpsaliasport != null) ? parent.args.mpsaliasport : parent.args.mpsport) + '/c/' + cookie + '.iso'; delete dev.ocrfile; // Generate the boot data for OCR with URL var r = response.Body; - r['BIOSPause'] = false; - r['BIOSSetup'] = false; - r['EnforceSecureBoot'] = false; r['UefiBootParametersArray'] = Buffer.from(makeUefiBootParam(1, url) + makeUefiBootParam(20, 1, 1) + makeUefiBootParam(30, 0, 2), 'binary').toString('base64'); r['UefiBootNumberOfParams'] = 3; r['BootMediaIndex'] = 0; // Do not use boot media index for One Click Recovery (OCR) @@ -1127,7 +1060,8 @@ module.exports.CreateAmtManager = function (parent) { dev.amtstack.SetBootConfigRole(1, function (stack, name, response, status) { if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request. if (status != 200) { dev.consoleMsg("Failed to set boot config role (" + status + ")."); return; } - dev.amtstack.CIM_BootConfigSetting_ChangeBootOrder('
http://schemas.xmlsoap.org/ws/2004/08/addressing
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSettingIntel(r) AMT: Force OCR UEFI HTTPS Boot', function (stack, name, response, status) { + var bootSource = 'Force OCR UEFI HTTPS Boot'; + dev.amtstack.CIM_BootConfigSetting_ChangeBootOrder((bootSource == null) ? bootSource : '
http://schemas.xmlsoap.org/ws/2004/08/addressing
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSettingIntel(r) AMT: ' + bootSource + '', function (stack, name, response, status) { if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request. if (status != 200) { dev.consoleMsg("Failed to set boot config (" + status + ")."); return; } dev.amtstack.RequestPowerStateChange(10, function (stack, name, response, status) { // 10 = Reset, 2 = Power Up @@ -1330,7 +1264,7 @@ module.exports.CreateAmtManager = function (parent) { } // Figure out what index is local & remote - var localNdx = ((dev.policy != null) && (dev.policy.tlsSettings != null) && (dev.policy.tlsSettings[0] != null) && (dev.policy.tlsSettings[0]['InstanceID'] == 'Intel(r) AMT LMS TLS Settings')) ? 0 : 1, remoteNdx = (1 - localNdx); + var localNdx = ((dev.policy.tlsSettings[0]['InstanceID'] == 'Intel(r) AMT LMS TLS Settings')) ? 0 : 1, remoteNdx = (1 - localNdx); // Remote TLS settings var xxTlsSettings2 = Clone(dev.policy.tlsSettings); @@ -1443,11 +1377,11 @@ module.exports.CreateAmtManager = function (parent) { const dev = stack.dev; if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request. const domain = parent.config.domains[dev.domainid]; - if ((responses['AMT_PublicKeyCertificate'] == null) || (responses['AMT_PublicKeyCertificate'].status != 200) || (responses['AMT_PublicPrivateKeyPair'] == null) || (responses['AMT_PublicPrivateKeyPair'].status != 200)) { devTaskCompleted(dev); return; } // We can't get the certificate list, fail and carry on. + if ((responses['AMT_PublicKeyCertificate'].status != 200) || (responses['AMT_PublicKeyCertificate'].status != 200)) { devTaskCompleted(dev); return; } // We can't get the certificate list, fail and carry on. // See if we need to perform wired or wireless 802.1x configuration - var wiredConfig = ((parent.config.domains[dev.domainid].amtmanager['802.1x'] != null) && (responses['AMT_8021XProfile'] != null) && (responses['AMT_8021XProfile'].status == 200)); - const wirelessConfig = ((responses['CIM_WiFiEndpointSettings'] != null) && (responses['CIM_WiFiEndpointSettings'].status == 200) && (responses['AMT_WiFiPortConfigurationService'] != null) && (responses['AMT_WiFiPortConfigurationService'].status == 200) && (responses['CIM_WiFiPort'] != null) && (responses['CIM_WiFiPort'].status == 200) && (responses['CIM_IEEE8021xSettings'] != null) && (responses['CIM_IEEE8021xSettings'].status == 200)); + var wiredConfig = ((parent.config.domains[dev.domainid].amtmanager['802.1x'] != null) && (responses['AMT_8021XProfile'].status == 200)); + const wirelessConfig = ((responses['CIM_WiFiEndpointSettings'].status == 200) && (responses['AMT_WiFiPortConfigurationService'].status == 200) && (responses['CIM_WiFiPort'].status == 200) && (responses['CIM_IEEE8021xSettings'].status == 200)); if (!wiredConfig && !wirelessConfig) { devTaskCompleted(dev); return; } // We can't get wired or wireless settings, ignore and carry on. // Sort out the certificates @@ -2250,6 +2184,7 @@ module.exports.CreateAmtManager = function (parent) { dev.amtstack.BatchEnum('', query, attemptSettingsSyncResponse); } + function attemptSettingsSyncResponse(stack, name, responses, status) { const dev = stack.dev; if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request. @@ -2304,7 +2239,7 @@ module.exports.CreateAmtManager = function (parent) { // Check KVM state if ((dev.aquired.majorver != null) && (dev.aquired.majorver > 5) && (responses['CIM_KVMRedirectionSAP'] != null)) { - const kvm = ((responses['CIM_KVMRedirectionSAP'].response['EnabledState'] == 2) || (responses['CIM_KVMRedirectionSAP'].response['EnabledState'] == 6)); + var kvm = (((responses['CIM_KVMRedirectionSAP'].response['EnabledState'] == 6) && (responses['CIM_KVMRedirectionSAP'].response['RequestedState'] == 2)) || (responses['CIM_KVMRedirectionSAP'].response['EnabledState'] == 2) || (responses['CIM_KVMRedirectionSAP'].response['EnabledState'] == 6)); if (kvm == false) { // Enable KVM dev.taskCount++; @@ -2632,14 +2567,7 @@ module.exports.CreateAmtManager = function (parent) { if (domain && domain.amtmanager && (domain.amtmanager.tlsacmactivation == true)) { TlsAcmActivation = true; } // Check Intel AMT version - if (typeof dev.intelamt.ver == 'string') { - var verSplit = dev.intelamt.ver.split('.'); - if (verSplit.length >= 2) { - dev.aquired.majorver = parseInt(verSplit[0]); - dev.aquired.minorver = parseInt(verSplit[1]); - if (verSplit.length >= 3) { dev.aquired.maintenancever = parseInt(verSplit[2]); } - } - } + if (typeof dev.intelamt.ver == 'string') { var verSplit = dev.intelamt.ver.split('.'); if (verSplit.length >= 3) { dev.aquired.majorver = parseInt(verSplit[0]); dev.aquired.minorver = parseInt(verSplit[1]); } } // If this is Intel AMT 14 or better and allowed, we are going to attempt a host-based end-to-end TLS activation. if (TlsAcmActivation && (dev.aquired.majorver >= 14)) { @@ -2695,15 +2623,7 @@ module.exports.CreateAmtManager = function (parent) { dev.aquired.controlMode = 1; // 1 = CCM, 2 = ACM if (typeof dev.amtstack.wsman.comm.amtVersion == 'string') { var verSplit = dev.amtstack.wsman.comm.amtVersion.split('.'); - if (verSplit.length >= 2) { - dev.aquired.version = verSplit[0] + '.' + verSplit[1]; - dev.aquired.majorver = parseInt(verSplit[0]); - dev.aquired.minorver = parseInt(verSplit[1]); - if (verSplit.length >= 3) { - dev.aquired.version = verSplit[0] + '.' + verSplit[1] + '.' + verSplit[2]; - dev.aquired.maintenancever = parseInt(verSplit[2]); - } - } + if (verSplit.length >= 3) { dev.aquired.version = verSplit[0] + '.' + verSplit[1] + '.' + verSplit[2]; dev.aquired.majorver = parseInt(verSplit[0]); dev.aquired.minorver = parseInt(verSplit[1]); } } if ((typeof dev.mpsConnection.tag.meiState.OsHostname == 'string') && (typeof dev.mpsConnection.tag.meiState.OsDnsSuffix == 'string')) { dev.aquired.host = dev.mpsConnection.tag.meiState.OsHostname + '.' + dev.mpsConnection.tag.meiState.OsDnsSuffix; @@ -2838,10 +2758,8 @@ module.exports.CreateAmtManager = function (parent) { var vs = getInstance(amtlogicalelements, 'AMT')['VersionString']; if (vs != null) { dev.aquired.version = vs; - version = dev.aquired.version.split('.') - dev.aquired.versionmajor = parseInt(version[0]); - dev.aquired.versionminor = parseInt(version[1]); - if (version.length > 2) { dev.aquired.versionmaintenance = parseInt(version[2]); } + dev.aquired.versionmajor = parseInt(dev.aquired.version.split('.')[0]); + dev.aquired.versionminor = parseInt(dev.aquired.version.split('.')[1]); } } } @@ -2849,14 +2767,10 @@ module.exports.CreateAmtManager = function (parent) { // Fetch the Intel AMT version from HTTP stack if ((dev.amtversionstr == null) && (stack.wsman.comm.amtVersion != null)) { var s = stack.wsman.comm.amtVersion.split('.'); - if (s.length >= 2) { - dev.aquired.version = s[0] + '.' + s[1] + '.'; + if (s.length >= 3) { + dev.aquired.version = s[0] + '.' + s[1] + '.' + s[2]; dev.aquired.versionmajor = parseInt(s[0]); dev.aquired.versionminor = parseInt(s[1]); - if (s.length >= 3) { - dev.aquired.version = s[0] + '.' + s[1] + '.' + s[2]; - dev.aquired.versionmaintenance = parseInt(s[2]); - } } } diff --git a/amtprovisioningserver.js b/amtprovisioningserver.js index d31b7b83..84a07df9 100644 --- a/amtprovisioningserver.js +++ b/amtprovisioningserver.js @@ -201,10 +201,8 @@ module.exports.CreateAmtProvisioningServer = function (parent, config) { var vs = getInstance(amtlogicalelements, 'AMT')['VersionString']; if (vs != null) { dev.aquired.version = vs; - const versionSplit = parseInt(dev.aquired.version.split('.')); - dev.aquired.versionmajor = parseInt(versionSplit[0]); - dev.aquired.versionminor = parseInt(versionSplit[1]); - if (versionSplit.length >= 3) { dev.aquired.versionmaintenance = parseInt(versionSplit[2]); } + dev.aquired.versionmajor = parseInt(dev.aquired.version.split('.')[0]); + dev.aquired.versionminor = parseInt(dev.aquired.version.split('.')[1]); } } } @@ -212,14 +210,10 @@ module.exports.CreateAmtProvisioningServer = function (parent, config) { // Fetch the Intel AMT version from HTTP stack if ((dev.amtversionstr == null) && (stack.wsman.comm.amtVersion != null)) { var s = stack.wsman.comm.amtVersion.split('.'); - if (s.length >= 2) { - dev.aquired.version = s[0] + '.' + s[1]; + if (s.length >= 3) { + dev.aquired.version = s[0] + '.' + s[1] + '.' + s[2]; dev.aquired.versionmajor = parseInt(s[0]); dev.aquired.versionminor = parseInt(s[1]); - if (s.length >= 3) { - dev.aquired.version = s[0] + '.' + s[1] + '.' + s[2]; - dev.aquired.versionmaintenance = parseInt(s[2]); - } } } diff --git a/amtscanner.js b/amtscanner.js index cdce1f54..941aef7e 100644 --- a/amtscanner.js +++ b/amtscanner.js @@ -362,8 +362,8 @@ module.exports.CreateAmtScanner = function (parent) { if (oldVer == newVer) return false; // Versions are same already, don't update. if (newVer == undefined || newVer == null) return false; // New version is bad, don't update it. if (oldVer == undefined || oldVer == null) return true; // Old version is no good anyway, update it. - var oldVerArr = oldVer.toString().split('.'); - var newVerArr = newVer.toString().split('.'); + var oldVerArr = oldVer.split('.'); + var newVerArr = newVer.split('.'); if ((oldVerArr.length < 2) || (newVerArr.length < 2)) return false; if ((oldVerArr[0] != newVerArr[0]) || (oldVerArr[1] != newVerArr[1])) return true; if (newVerArr.length > oldVerArr.length) return true; diff --git a/apprelays.js b/apprelays.js index cd6bc5fa..aa6e7bb2 100644 --- a/apprelays.js +++ b/apprelays.js @@ -1,4 +1,4 @@ -/** +/** * @description MeshCentral MSTSC & SSH relay * @author Ylian Saint-Hilaire & Bryan Roe * @copyright Intel Corporation 2018-2022 @@ -35,29 +35,28 @@ const PROTOCOL_WEBSFTP = 203; const PROTOCOL_WEBVNC = 204; // Mesh Rights -const MESHRIGHT_EDITMESH = 0x00000001; // 1 -const MESHRIGHT_MANAGEUSERS = 0x00000002; // 2 -const MESHRIGHT_MANAGECOMPUTERS = 0x00000004; // 4 -const MESHRIGHT_REMOTECONTROL = 0x00000008; // 8 -const MESHRIGHT_AGENTCONSOLE = 0x00000010; // 16 -const MESHRIGHT_SERVERFILES = 0x00000020; // 32 -const MESHRIGHT_WAKEDEVICE = 0x00000040; // 64 -const MESHRIGHT_SETNOTES = 0x00000080; // 128 -const MESHRIGHT_REMOTEVIEWONLY = 0x00000100; // 256 -const MESHRIGHT_NOTERMINAL = 0x00000200; // 512 -const MESHRIGHT_NOFILES = 0x00000400; // 1024 -const MESHRIGHT_NOAMT = 0x00000800; // 2048 -const MESHRIGHT_DESKLIMITEDINPUT = 0x00001000; // 4096 -const MESHRIGHT_LIMITEVENTS = 0x00002000; // 8192 -const MESHRIGHT_CHATNOTIFY = 0x00004000; // 16384 -const MESHRIGHT_UNINSTALL = 0x00008000; // 32768 -const MESHRIGHT_NODESKTOP = 0x00010000; // 65536 -const MESHRIGHT_REMOTECOMMAND = 0x00020000; // 131072 -const MESHRIGHT_RESETOFF = 0x00040000; // 262144 -const MESHRIGHT_GUESTSHARING = 0x00080000; // 524288 -const MESHRIGHT_DEVICEDETAILS = 0x00100000; // 1048576 -const MESHRIGHT_RELAY = 0x00200000; // 2097152 -const MESHRIGHT_ADMIN = 0xFFFFFFFF; +const MESHRIGHT_EDITMESH = 0x00000001; // 1 +const MESHRIGHT_MANAGEUSERS = 0x00000002; // 2 +const MESHRIGHT_MANAGECOMPUTERS = 0x00000004; // 4 +const MESHRIGHT_REMOTECONTROL = 0x00000008; // 8 +const MESHRIGHT_AGENTCONSOLE = 0x00000010; // 16 +const MESHRIGHT_SERVERFILES = 0x00000020; // 32 +const MESHRIGHT_WAKEDEVICE = 0x00000040; // 64 +const MESHRIGHT_SETNOTES = 0x00000080; // 128 +const MESHRIGHT_REMOTEVIEWONLY = 0x00000100; // 256 +const MESHRIGHT_NOTERMINAL = 0x00000200; // 512 +const MESHRIGHT_NOFILES = 0x00000400; // 1024 +const MESHRIGHT_NOAMT = 0x00000800; // 2048 +const MESHRIGHT_DESKLIMITEDINPUT = 0x00001000; // 4096 +const MESHRIGHT_LIMITEVENTS = 0x00002000; // 8192 +const MESHRIGHT_CHATNOTIFY = 0x00004000; // 16384 +const MESHRIGHT_UNINSTALL = 0x00008000; // 32768 +const MESHRIGHT_NODESKTOP = 0x00010000; // 65536 +const MESHRIGHT_REMOTECOMMAND = 0x00020000; // 131072 +const MESHRIGHT_RESETOFF = 0x00040000; // 262144 +const MESHRIGHT_GUESTSHARING = 0x00080000; // 524288 +const MESHRIGHT_DEVICEDETAILS = 0x00100000; // 1048576 +const MESHRIGHT_ADMIN = 0xFFFFFFFF; // SerialTunnel object is used to embed TLS within another connection. function SerialTunnel(options) { @@ -70,7 +69,7 @@ function SerialTunnel(options) { } // Construct a Web relay object -module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, userid, nodeid, addr, port, appid, sessionid, expire, mtype) { +module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, userid, nodeid, addr, port, appid) { const obj = {}; obj.parent = parent; obj.lastOperation = Date.now(); @@ -80,27 +79,14 @@ module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, obj.addr = addr; obj.port = port; obj.appid = appid; - obj.sessionid = sessionid; - obj.expireTimer = null; - obj.mtype = mtype; var pendingRequests = []; var nextTunnelId = 1; var tunnels = {}; var errorCount = 0; // If we keep closing tunnels without processing requests, fail the requests - parent.parent.debug('webrelay', 'CreateWebRelaySession, userid:' + userid + ', addr:' + addr + ', port:' + port); - // Any HTTP cookie set by the device is going to be shared between all tunnels to that device. obj.webCookies = {}; - // Setup an expire time if needed - if (expire != null) { - var timeout = (expire - Date.now()); - if (timeout < 10) { timeout = 10; } - parent.parent.debug('webrelay', 'timeout set to ' + Math.floor(timeout / 1000) + ' second(s).'); - obj.expireTimer = setTimeout(function () { parent.parent.debug('webrelay', 'timeout'); close(); }, timeout); - } - // Events obj.closed = false; obj.onclose = null; @@ -124,22 +110,18 @@ module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, // Handle new HTTP request obj.handleRequest = function (req, res) { - parent.parent.debug('webrelay', 'handleRequest, url:' + req.url); pendingRequests.push([req, res, false]); handleNextRequest(); } // Handle new websocket request obj.handleWebSocket = function (ws, req) { - parent.parent.debug('webrelay', 'handleWebSocket, url:' + req.url); pendingRequests.push([req, ws, true]); handleNextRequest(); } // Handle request function handleNextRequest() { - if (obj.closed == true) return; - // if there are not pending requests, do nothing if (pendingRequests.length == 0) return; @@ -149,77 +131,51 @@ module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, // Check to see if any of the tunnels are free var count = 0; for (var i in tunnels) { - count += ((tunnels[i].isWebSocket || tunnels[i].isStreaming) ? 0 : 1); - if ((tunnels[i].relayActive == true) && (tunnels[i].res == null) && (tunnels[i].isWebSocket == false) && (tunnels[i].isStreaming == false)) { + count += (tunnels[i].isWebSocket ? 0 : 1); + if ((tunnels[i].relayActive == true) && (tunnels[i].res == null) && (tunnels[i].isWebSocket == false)) { // Found a free tunnel, use it const x = pendingRequests.shift(); if (x[2] == true) { tunnels[i].processWebSocket(x[0], x[1]); } else { tunnels[i].processRequest(x[0], x[1]); } return; } } - + if (count > 0) return; launchNewTunnel(); } function launchNewTunnel() { // Launch a new tunnel - if (obj.closed == true) return; - parent.parent.debug('webrelay', 'launchNewTunnel'); - const tunnel = module.exports.CreateWebRelay(obj, db, args, domain, obj.mtype); + const tunnel = module.exports.CreateWebRelay(obj, db, args, domain); tunnel.onclose = function (tunnelId, processedCount) { - if (tunnels == null) return; - parent.parent.debug('webrelay', 'tunnel-onclose'); if (processedCount == 0) { errorCount++; } // If this tunnel closed without processing any requests, mark this as an error delete tunnels[tunnelId]; handleNextRequest(); } tunnel.onconnect = function (tunnelId) { - if (tunnels == null) return; - parent.parent.debug('webrelay', 'tunnel-onconnect'); if (pendingRequests.length > 0) { const x = pendingRequests.shift(); if (x[2] == true) { tunnels[tunnelId].processWebSocket(x[0], x[1]); } else { tunnels[tunnelId].processRequest(x[0], x[1]); } } } - tunnel.oncompleted = function (tunnelId, closed) { - if (tunnels == null) return; - if (closed === true) { - parent.parent.debug('webrelay', 'tunnel-oncompleted and closed'); - } else { - parent.parent.debug('webrelay', 'tunnel-oncompleted'); + tunnel.oncompleted = function (tunnelId) { + errorCount = 0; // Something got completed, clear any error count + if (pendingRequests.length > 0) { + const x = pendingRequests.shift(); + if (x[2] == true) { tunnels[tunnelId].processWebSocket(x[0], x[1]); } else { tunnels[tunnelId].processRequest(x[0], x[1]); } } - if (closed !== true) { - errorCount = 0; // Something got completed, clear any error count - if (pendingRequests.length > 0) { - const x = pendingRequests.shift(); - if (x[2] == true) { tunnels[tunnelId].processWebSocket(x[0], x[1]); } else { tunnels[tunnelId].processRequest(x[0], x[1]); } - } - } - } - tunnel.onNextRequest = function () { - if (tunnels == null) return; - parent.parent.debug('webrelay', 'tunnel-onNextRequest'); - handleNextRequest(); } tunnel.connect(userid, nodeid, addr, port, appid); tunnel.tunnelId = nextTunnelId++; tunnels[tunnel.tunnelId] = tunnel; } - // Close all tunnels - obj.close = function () { close(); } - // Close all tunnels function close() { // Set the session as closed if (obj.closed == true) return; - parent.parent.debug('webrelay', 'tunnel-close'); obj.closed = true; - // Clear the time if present - if (obj.expireTimer != null) { clearTimeout(obj.expireTimer); delete obj.expireTimer; } - // Close all tunnels for (var i in tunnels) { tunnels[i].close(); } tunnels = null; @@ -228,7 +184,7 @@ module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, for (var i in pendingRequests) { if (pendingRequests[i][2] == true) { pendingRequests[i][1].close(); } else { pendingRequests[i][1].end(); } } // Notify of session closure - if (obj.onclose) { obj.onclose(obj.sessionid); } + if (obj.onclose) { obj.onclose(obj.userid + '/' + obj.sessionId); } // Cleanup delete obj.userid; @@ -240,7 +196,7 @@ module.exports.CreateWebRelaySession = function (parent, db, req, args, domain, // Construct a Web relay object -module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { +module.exports.CreateWebRelay = function (parent, db, args, domain) { //const Net = require('net'); const WebSocket = require('ws') @@ -248,49 +204,26 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { obj.lastOperation = Date.now(); obj.relayActive = false; obj.closed = false; - obj.isWebSocket = false; // If true, this request will not close and so, it can't be allowed to hold up other requests - obj.isStreaming = false; // If true, this request will not close and so, it can't be allowed to hold up other requests + obj.isWebSocket = false; obj.processedRequestCount = 0; - obj.mtype = mtype; const constants = (require('crypto').constants ? require('crypto').constants : require('constants')); // require('constants') is deprecated in Node 11.10, use require('crypto').constants instead. // Events obj.onclose = null; obj.oncompleted = null; obj.onconnect = null; - obj.onNextRequest = null; - - // Called when we need to close the tunnel because the response stream has closed - function handleResponseClosure() { obj.close(); } - - // Return cookie name and values - function parseRequestCookies(cookiesString) { - var r = {}; - if (typeof cookiesString != 'string') return r; - var cookieString = cookiesString.split('; '); - for (var i in cookieString) { var j = cookieString[i].indexOf('='); if (j > 0) { r[cookieString[i].substring(0, j)] = cookieString[i].substring(j + 1); } } - return r; - } // Process a HTTP request obj.processRequest = function (req, res) { if (obj.relayActive == false) { console.log("ERROR: Attempt to use an unconnected tunnel"); return false; } parent.lastOperation = obj.lastOperation = Date.now(); - // Check if this is a websocket - if (req.headers['upgrade'] == 'websocket') { console.log('Attempt to process a websocket in HTTP tunnel method.'); res.end(); return false; } - - // If the response stream is closed, close this tunnel right away - res.socket.on('end', handleResponseClosure); - // Construct the HTTP request var request = req.method + ' ' + req.url + ' HTTP/' + req.httpVersion + '\r\n'; - const blockedHeaders = ['cookie', 'upgrade-insecure-requests', 'sec-ch-ua', 'sec-ch-ua-mobile', 'dnt', 'sec-fetch-user', 'sec-ch-ua-platform', 'sec-fetch-site', 'sec-fetch-mode', 'sec-fetch-dest']; // These are headers we do not forward + const blockedHeaders = ['origin', 'cookie']; // These are headers we do not forward for (var i in req.headers) { if (blockedHeaders.indexOf(i) == -1) { request += i + ': ' + req.headers[i] + '\r\n'; } } var cookieStr = ''; for (var i in parent.webCookies) { if (cookieStr != '') { cookieStr += '; ' } cookieStr += (i + '=' + parent.webCookies[i].value); } - var reqCookies = parseRequestCookies(req.headers.cookie); - for (var i in reqCookies) { if ((i != 'xid') && (i != 'xid.sig')) { if (cookieStr != '') { cookieStr += '; ' } cookieStr += (i + '=' + reqCookies[i]); } } if (cookieStr.length > 0) { request += 'cookie: ' + cookieStr + '\r\n' } // If we have session cookies, set them in the header here request += '\r\n'; @@ -324,9 +257,6 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { // Pause the websocket until we get a tunnel connected obj.ws._socket.pause(); - // If the response stream is closed, close this tunnel right away - obj.ws._socket.on('end', function () { obj.close(); }); - // Remove the trailing '/.websocket' if needed var baseurl = req.url, i = req.url.indexOf('?'); if (i > 0) { baseurl = req.url.substring(0, i); } @@ -334,7 +264,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { // Construct the HTTP request var request = req.method + ' ' + req.url + ' HTTP/' + req.httpVersion + '\r\n'; - const blockedHeaders = ['cookie', 'sec-websocket-extensions']; // These are headers we do not forward + const blockedHeaders = ['origin', 'cookie', 'sec-websocket-extensions']; // These are headers we do not forward for (var i in req.headers) { if (blockedHeaders.indexOf(i) == -1) { request += i + ': ' + req.headers[i] + '\r\n'; } } var cookieStr = ''; for (var i in parent.webCookies) { if (cookieStr != '') { cookieStr += '; ' } cookieStr += (i + '=' + parent.webCookies[i].value); } @@ -358,7 +288,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { function sendWebSocketFrameToDevice(op, payload) { // Select a random mask - const mask = parent.parent.parent.crypto.randomBytes(4) + const mask = parent.parent.crypto.randomBytes(4) // Setup header and mask var header = null; @@ -394,13 +324,6 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { if (obj.closed == true) return; obj.closed = true; - // If we are processing a http response that terminates when it closes, do this now. - if ((obj.socketParseState == 1) && (obj.socketXHeader['connection'] != null) && (obj.socketXHeader['connection'].toLowerCase() == 'close')) { - processHttpResponse(null, obj.socketAccumulator, true, true); // Indicate this tunnel is done and also closed, do not put a new request on this tunnel. - obj.socketAccumulator = ''; - obj.socketParseState = 0; - } - if (obj.tls) { try { obj.tls.end(); } catch (ex) { console.log(ex); } delete obj.tls; @@ -431,7 +354,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { } // Close any pending request - if (obj.res) { obj.res.socket.removeListener('end', handleResponseClosure); obj.res.end(); delete obj.res; } + if (obj.res) { obj.res.end(); delete obj.res; } if (obj.ws) { obj.ws.close(); delete obj.ws; } // Event disconnection @@ -440,7 +363,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { obj.relayActive = false; }; - // Start the loopback server + // Start the looppback server obj.connect = function (userid, nodeid, addr, port, appid) { if (obj.relayActive || obj.closed) return; obj.addr = addr; @@ -450,7 +373,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { // Encode a cookie for the mesh relay const cookieContent = { userid: userid, domainid: domain.id, nodeid: nodeid, tcpport: port }; if (addr != null) { cookieContent.tcpaddr = addr; } - const cookie = parent.parent.parent.encodeCookie(cookieContent, parent.parent.parent.loginCookieEncryptionKey); + const cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey); try { // Setup the correct URL with domain and use TLS only if needed. @@ -458,11 +381,10 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { const protocol = (args.tlsoffload) ? 'ws' : 'wss'; var domainadd = ''; if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' } - var url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=14&auth=' + cookie; // Protocol 14 is Web-TCP - if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument. - parent.parent.parent.debug('relay', 'TCP: Connection websocket to ' + url); + const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=14&auth=' + cookie; // Protocol 14 is Web-TCP + parent.parent.debug('relay', 'TCP: Connection websocket to ' + url); obj.wsClient = new WebSocket(url, options); - obj.wsClient.on('open', function () { parent.parent.parent.debug('relay', 'TCP: Relay websocket open'); }); + obj.wsClient.on('open', function () { parent.parent.debug('relay', 'TCP: Relay websocket open'); }); obj.wsClient.on('message', function (data) { // Make sure to handle flow control. if (obj.tls) { // WS --> TLS @@ -477,13 +399,13 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { // TLSSocket to encapsulate TLS communication, which then tunneled via SerialTunnel const tlsoptions = { socket: obj.ser, rejectUnauthorized: false }; obj.tls = require('tls').connect(tlsoptions, function () { - parent.parent.parent.debug('relay', "Web Relay Secure TLS Connection"); + parent.parent.debug('relay', "Web Relay Secure TLS Connection"); obj.relayActive = true; parent.lastOperation = obj.lastOperation = Date.now(); // Update time of last opertion performed if (obj.onconnect) { obj.onconnect(obj.tunnelId); } // Event connection }); obj.tls.setEncoding('binary'); - obj.tls.on('error', function (err) { parent.parent.parent.debug('relay', "Web Relay TLS Connection Error", err); obj.close(); }); + obj.tls.on('error', function (err) { parent.parent.debug('relay', "Web Relay TLS Connection Error", err); obj.close(); }); // Decrypted tunnel from TLS communcation to be forwarded to the browser obj.tls.on('data', function (data) { processHttpData(data); }); // TLS ---> Browser @@ -498,8 +420,8 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { processRawHttpData(data); } }); - obj.wsClient.on('close', function () { parent.parent.parent.debug('relay', 'TCP: Relay websocket closed'); obj.close(); }); - obj.wsClient.on('error', function (err) { parent.parent.parent.debug('relay', 'TCP: Relay websocket error: ' + err); obj.close(); }); + obj.wsClient.on('close', function () { parent.parent.debug('relay', 'TCP: Relay websocket closed'); obj.close(); }); + obj.wsClient.on('error', function (err) { parent.parent.debug('relay', 'TCP: Relay websocket error: ' + err); obj.close(); }); } catch (ex) { console.log(ex); } @@ -527,7 +449,6 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { obj.socketParseState = 0; obj.socketContentLengthRemaining = 0; function processHttpData(data) { - //console.log('processHttpData', data.length); obj.socketAccumulator += data; while (true) { //console.log('ACC(' + obj.socketAccumulator + '): ' + obj.socketAccumulator); @@ -551,15 +472,9 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { } } - // Check if this is a streaming response - if ((obj.socketXHeader['content-type'] != null) && (obj.socketXHeader['content-type'].toLowerCase().indexOf('text/event-stream') >= 0)) { - obj.isStreaming = true; // This tunnel is now a streaming tunnel and will not close anytime soon. - if (obj.onNextRequest != null) obj.onNextRequest(); // Call this so that any HTTP requests that are waitting for this one to finish get handled by a new tunnel. - } - // Check if this HTTP request has a body - if (obj.socketXHeader['content-length'] != null) { obj.socketParseState = 1; } if ((obj.socketXHeader['connection'] != null) && (obj.socketXHeader['connection'].toLowerCase() == 'close')) { obj.socketParseState = 1; } + if (obj.socketXHeader['content-length'] != null) { obj.socketParseState = 1; } if ((obj.socketXHeader['transfer-encoding'] != null) && (obj.socketXHeader['transfer-encoding'].toLowerCase() == 'chunked')) { obj.socketParseState = 1; } if (obj.isWebSocket) { if ((obj.socketXHeader['connection'] != null) && (obj.socketXHeader['connection'].toLowerCase() == 'upgrade')) { @@ -576,35 +491,21 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { } if (obj.socketParseState == 1) { var csize = -1; - if (obj.socketXHeader['content-length'] != null) { + if ((obj.socketXHeader['connection'] != null) && (obj.socketXHeader['connection'].toLowerCase() == 'close')) { + // The body ends with a close, in this case, we will only process the header + processHttpResponse(null, null, true); + csize = 0; + } else if (obj.socketXHeader['content-length'] != null) { // The body length is specified by the content-length if (obj.socketContentLengthRemaining == 0) { obj.socketContentLengthRemaining = parseInt(obj.socketXHeader['content-length']); } // Set the remaining content-length if not set var data = obj.socketAccumulator.substring(0, obj.socketContentLengthRemaining); // Grab the available data, not passed the expected content-length obj.socketAccumulator = obj.socketAccumulator.substring(data.length); // Remove the data from the accumulator obj.socketContentLengthRemaining -= data.length; // Substract the obtained data from the expected size - if (obj.socketContentLengthRemaining > 0) { - // Send any data we have, if we are done, signal the end of the response - processHttpResponse(null, data, false); - return; // More data is needed, return now so we exit the while() loop. - } else { - // We are done with this request - const closing = (obj.socketXHeader['connection'] != null) && (obj.socketXHeader['connection'].toLowerCase() == 'close'); - if (closing) { - // We need to close this tunnel. - processHttpResponse(null, data, false); - obj.close(); - } else { - // Proceed with the next request. - processHttpResponse(null, data, true); - } - } + processHttpResponse(null, data, (obj.socketContentLengthRemaining == 0)); // Send any data we have, if we are done, signal the end of the response + if (obj.socketContentLengthRemaining > 0) return; // If more data is needed, return now so we exit the while() loop. csize = 0; // We are done - } else if ((obj.socketXHeader['connection'] != null) && (obj.socketXHeader['connection'].toLowerCase() == 'close')) { - // The body ends with a close, in this case, we will only process the header - processHttpResponse(null, obj.socketAccumulator, false); - obj.socketAccumulator = ''; - return; - } else if ((obj.socketXHeader['transfer-encoding'] != null) && (obj.socketXHeader['transfer-encoding'].toLowerCase() == 'chunked')) { + } + else if ((obj.socketXHeader['transfer-encoding'] != null) && (obj.socketXHeader['transfer-encoding'].toLowerCase() == 'chunked')) { // The body is chunked var clen = obj.socketAccumulator.indexOf('\r\n'); if (clen < 0) { return; } // Chunk length not found, exit now and get more data. @@ -682,17 +583,16 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { } // This is a fully parsed HTTP response from the remote device - function processHttpResponse(header, data, done, closed) { - //console.log('processHttpResponse', header, data ? data.length : 0, done, closed); + function processHttpResponse(header, data, done) { + //console.log('processHttpResponse'); if (obj.isWebSocket == false) { if (obj.res == null) return; parent.lastOperation = obj.lastOperation = Date.now(); // Update time of last opertion performed // If there is a header, send it if (header != null) { - const statusCode = parseInt(header.Directive[1]); - if ((!isNaN(statusCode)) && (statusCode > 0) && (statusCode <= 999)) { obj.res.status(statusCode); } // Set the status - const blockHeaders = ['Directive', 'sec-websocket-extensions', 'connection', 'transfer-encoding', 'last-modified', 'content-security-policy', 'cache-control']; // We do not forward these headers + obj.res.status(parseInt(header.Directive[1])); // Set the status + const blockHeaders = ['Directive', 'sec-websocket-extensions']; // We do not forward these headers for (var i in header) { if (i == 'set-cookie') { for (var ii in header[i]) { @@ -717,38 +617,33 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { } } } - else if (blockHeaders.indexOf(i) == -1) { obj.res.set(i.trim(), header[i]); } // Set the headers if not blocked + else if (blockHeaders.indexOf(i) == -1) { obj.res.set(i, header[i]); } // Set the headers if not blocked } - // Dont set any Content-Security-Policy at all because some applications like Node-Red, access external websites from there javascript which would be forbidden by the below CSP - //obj.res.set('Content-Security-Policy', "default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:;"); // Set an "allow all" policy, see if the can restrict this in the future - //obj.res.set('Content-Security-Policy', "default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';"); // Set an "allow all" policy, see if the can restrict this in the future - obj.res.set('Cache-Control', 'no-store'); // Tell the browser not to cache the responses since since the relay port can be used for many relays + obj.res.set('Content-Security-Policy', "default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:;"); // Set an "allow all" policy, see if the can restrict this in the future + obj.res.set('Cache-Control', 'no-cache'); // Tell the browser not to cache the responses since since the relay port can be used for many relays } // If there is data, send it - if (data != null) { try { obj.res.write(data, 'binary'); } catch (ex) { } } + if (data != null) { obj.res.write(data, 'binary'); } // If we are done, close the response if (done == true) { // Close the response - obj.res.socket.removeListener('end', handleResponseClosure); obj.res.end(); delete obj.res; // Event completion obj.processedRequestCount++; - if (obj.oncompleted) { obj.oncompleted(obj.tunnelId, closed); } + if (obj.oncompleted) { obj.oncompleted(obj.tunnelId); } } } else { // Tunnel is now in web socket pass-thru mode - if (header != null) { - if ((typeof header.connection == 'string') && (header.connection.toLowerCase() == 'upgrade')) { - // Websocket upgrade succesful - obj.socketParseState = 2; - } else { - // Unable to upgrade to web socket - obj.close(); - } + if ((typeof header.connection == 'string') && (header.connection.toLowerCase() == 'upgrade')) { + // Websocket upgrade succesful + obj.socketParseState = 2; + } else { + // Unable to upgrade to web socket + obj.close(); } } } @@ -756,7 +651,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain, mtype) { // Send data thru the relay tunnel. Written to use TLS if needed. function send(data) { try { if (obj.tls) { obj.tls.write(data); } else { obj.wsClient.send(data); } } catch (ex) { } } - parent.parent.parent.debug('relay', 'TCP: Request for web relay'); + parent.parent.debug('relay', 'TCP: Request for web relay'); return obj; }; @@ -821,7 +716,7 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { obj.relaySocket = socket; obj.relaySocket.pause(); obj.relaySocket.on('data', function (chunk) { // Make sure to handle flow control. - if (obj.relayActive == true) { obj.relaySocket.pause(); if (obj.wsClient != null) { obj.wsClient.send(chunk, function () { obj.relaySocket.resume(); }); } } + if (obj.relayActive == true) { obj.relaySocket.pause(); obj.wsClient.send(chunk, function () { obj.relaySocket.resume(); }); } }); obj.relaySocket.on('end', function () { obj.close(); }); obj.relaySocket.on('error', function (err) { obj.close(); }); @@ -831,8 +726,7 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { const protocol = (args.tlsoffload) ? 'ws' : 'wss'; var domainadd = ''; if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' } - var url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=10&auth=' + obj.infos.ip; // Protocol 10 is Web-RDP - if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument. + const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=10&auth=' + obj.infos.ip; // Protocol 10 is Web-RDP parent.parent.debug('relay', 'RDP: Connection websocket to ' + url); obj.wsClient = new WebSocket(url, options); obj.wsClient.on('open', function () { parent.parent.debug('relay', 'RDP: Relay websocket open'); }); @@ -843,21 +737,22 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { obj.relaySocket.resume(); } } else { - try { // Forward any ping/pong commands to the browser - var cmd = JSON.parse(data); + if (typeof data == 'string') { + // Forward any ping/pong commands to the browser + var cmd = null; + try { cmd = JSON.parse(data); } catch (ex) { } if ((cmd != null) && (cmd.ctrlChannel == '102938')) { if (cmd.type == 'ping') { send(['ping']); } else if (cmd.type == 'pong') { send(['pong']); } } return; - } catch (ex) { // You are not JSON data so just send over relaySocket - obj.wsClient._socket.pause(); - try { - obj.relaySocket.write(data, function () { - if (obj.wsClient && obj.wsClient._socket) { try { obj.wsClient._socket.resume(); } catch (ex) { console.log(ex); } } - }); - } catch (ex) { console.log(ex); obj.close(); } } + obj.wsClient._socket.pause(); + try { + obj.relaySocket.write(data, function () { + if (obj.wsClient && obj.wsClient._socket) { try { obj.wsClient._socket.resume(); } catch (ex) { console.log(ex); } } + }); + } catch (ex) { console.log(ex); obj.close(); } } }); obj.wsClient.on('close', function () { parent.parent.debug('relay', 'RDP: Relay websocket closed'); obj.close(); }); @@ -890,7 +785,7 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { rdpClient = require('./rdp').createClient(args).on('connect', function () { send(['rdp-connect']); if ((typeof obj.infos.options == 'object') && (obj.infos.options.savepass == true)) { saveRdpCredentials(); } // Save the credentials if needed - obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64'); obj.startTime = Date.now(); // Event session start @@ -984,7 +879,6 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { if ((node == null) || (visible == false) || ((rights & MESHRIGHT_REMOTECONTROL) == 0)) { obj.close(); return; } if ((rights != MESHRIGHT_ADMIN) && ((rights & MESHRIGHT_REMOTEVIEWONLY) != 0)) { obj.viewonly = true; } if ((rights != MESHRIGHT_ADMIN) && ((rights & MESHRIGHT_DESKLIMITEDINPUT) != 0)) { obj.limitedinput = true; } - node = parent.common.unEscapeLinksFieldName(node); // unEscape node data for rdp/ssh credentials obj.mtype = node.mtype; // Store the device group type obj.meshid = node.meshid; // Store the MeshID @@ -1047,11 +941,7 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { if ((k == 14) || (k == 28)) { ok = true; } // Enter and backspace if (ok == false) return; } - var extended = false; - var extendedkeys = [57419,57421,57416,57424,57426,57427,57417,57425,57372,57397,57415,57423,57373,57400,57399]; - // left,right,up,down,insert,delete,pageup,pagedown,numpadenter,numpaddivide,home,end,controlright,altright,printscreen - if (extendedkeys.includes(msg[1])) extended=true; - if (rdpClient && (obj.viewonly != true)) { rdpClient.sendKeyEventScancode(msg[1], msg[2], extended); } break; + if (rdpClient && (obj.viewonly != true)) { rdpClient.sendKeyEventScancode(msg[1], msg[2]); } break; } case 'unicode': { if (rdpClient && (obj.viewonly != true)) { rdpClient.sendKeyEventUnicode(msg[1], msg[2]); } break; } case 'utype': { @@ -1215,8 +1105,7 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { const protocol = (args.tlsoffload) ? 'ws' : 'wss'; var domainadd = ''; if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' } - var url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=11&auth=' + obj.xcookie; // Protocol 11 is Web-SSH - if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument. + const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=11&auth=' + obj.xcookie; // Protocol 11 is Web-SSH parent.parent.debug('relay', 'SSH: Connection websocket to ' + url); obj.wsClient = new WebSocket(url, options); obj.wsClient.on('open', function () { parent.parent.debug('relay', 'SSH: Relay websocket open'); }); @@ -1232,7 +1121,7 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { obj.sshClient.on('ready', function () { // Authentication was successful. // If requested, save the credentials saveSshCredentials(obj.keep); - obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64'); obj.startTime = Date.now(); // Event start of session @@ -1282,14 +1171,16 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { ws._socket.resume(); } } else { - try { // Forward any ping/pong commands to the browser + if (typeof data == 'string') { + // Forward any ping/pong commands to the browser var cmd = null; - cmd = JSON.parse(data); + try { cmd = JSON.parse(data); } catch (ex) { } if ((cmd != null) && (cmd.ctrlChannel == '102938') && ((cmd.type == 'ping') || (cmd.type == 'pong'))) { obj.ws.send(data); } return; - } catch(ex) { // Relay WS --> SSH instead - if ((data.length > 0) && (obj.ser != null)) { try { obj.ser.updateBuffer(data); } catch (ex) { console.log(ex); } } } + + // Relay WS --> SSH + if ((data.length > 0) && (obj.ser != null)) { try { obj.ser.updateBuffer(data); } catch (ex) { console.log(ex); } } } }); obj.wsClient.on('close', function () { parent.parent.debug('relay', 'SSH: Relay websocket closed'); obj.close(); }); @@ -1317,7 +1208,7 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { // Check if we have SSH credentials for this device parent.parent.db.Get(obj.cookie.nodeid, function (err, nodes) { if ((err != null) || (nodes == null) || (nodes.length != 1)) return; - const node = parent.common.unEscapeLinksFieldName(nodes[0]); // unEscape node data for rdp/ssh credentials + const node = nodes[0]; if ((domain.allowsavingdevicecredentials === false) || (node.ssh == null) || (typeof node.ssh != 'object') || (node.ssh[obj.userid] == null) || (typeof node.ssh[obj.userid].u != 'string') || ((typeof node.ssh[obj.userid].p != 'string') && (typeof node.ssh[obj.userid].k != 'string'))) { // Send a request for SSH authentication try { ws.send(JSON.stringify({ action: 'sshauth' })) } catch (ex) { } @@ -1365,7 +1256,7 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { obj.termSize = msg; parent.parent.db.Get(obj.cookie.nodeid, function (err, nodes) { if ((err != null) || (nodes == null) || (nodes.length != 1)) return; - const node = parent.common.unEscapeLinksFieldName(nodes[0]); // unEscape node data for rdp/ssh credentials + const node = nodes[0]; if (node.ssh != null) { obj.username = node.ssh.u; obj.privateKey = node.ssh.k; @@ -1407,7 +1298,7 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { parent.parent.db.Get(obj.cookie.nodeid, function (err, nodes) { if (obj.cookie == null) return; // obj has been cleaned up, just exit. if ((err != null) || (nodes == null) || (nodes.length != 1)) { parent.parent.debug('relay', 'SSH: Invalid device'); obj.close(); } - const node = parent.common.unEscapeLinksFieldName(nodes[0]); // unEscape node data for rdp/ssh credentials + const node = nodes[0]; obj.nodeid = node._id; // Store the NodeID obj.meshid = node.meshid; // Store the MeshID obj.mtype = node.mtype; // Store the device group type @@ -1552,8 +1443,7 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u const protocol = (args.tlsoffload) ? 'ws' : 'wss'; var domainadd = ''; if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' } - var url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=11&auth=' + authCookie // Protocol 11 is Web-SSH - if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument. + const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=11&auth=' + authCookie // Protocol 11 is Web-SSH parent.parent.debug('relay', 'SSH: Connection websocket to ' + url); obj.wsClient = new WebSocket(url, options); obj.wsClient.on('open', function () { parent.parent.debug('relay', 'SSH: Relay websocket open'); }); @@ -1569,7 +1459,7 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u obj.sshClient.on('ready', function () { // Authentication was successful. // If requested, save the credentials saveSshCredentials(obj.keep); - obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64'); obj.startTime = Date.now(); try { @@ -1620,14 +1510,16 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u ws._socket.resume(); } } else { - try { // Forward any ping/pong commands to the browser + if (typeof data == 'string') { + // Forward any ping/pong commands to the browser var cmd = null; - cmd = JSON.parse(data); + try { cmd = JSON.parse(data); } catch (ex) { } if ((cmd != null) && (cmd.ctrlChannel == '102938') && ((cmd.type == 'ping') || (cmd.type == 'pong'))) { try { obj.ws.send(data); } catch (ex) { console.log(ex); } } return; - } catch (ex) { // Relay WS --> SSH - if ((data.length > 0) && (obj.ser != null)) { try { obj.ser.updateBuffer(data); } catch (ex) { console.log(ex); } } } + + // Relay WS --> SSH + if ((data.length > 0) && (obj.ser != null)) { try { obj.ser.updateBuffer(data); } catch (ex) { console.log(ex); } } } }); obj.wsClient.on('close', function () { @@ -1740,7 +1632,6 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u if ((user == null) || (req.query.nodeid == null)) { obj.close(); return; } // Invalid nodeid parent.GetNodeWithRights(domain, user, req.query.nodeid, function (node, rights, visible) { if (obj.ws == null) return; // obj has been cleaned up, just exit. - node = parent.common.unEscapeLinksFieldName(node); // unEscape node data for rdp/ssh credentials // Check permissions if ((rights & 8) == 0) { obj.close(); return; } // No MESHRIGHT_REMOTECONTROL rights @@ -1905,8 +1796,7 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user const protocol = (args.tlsoffload) ? 'ws' : 'wss'; var domainadd = ''; if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' } - var url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=13&auth=' + authCookie // Protocol 13 is Web-SSH-Files - if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument. + const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=13&auth=' + authCookie // Protocol 13 is Web-SSH-Files parent.parent.debug('relay', 'SSH: Connection websocket to ' + url); obj.wsClient = new WebSocket(url, options); obj.wsClient.on('open', function () { parent.parent.debug('relay', 'SSH: Relay websocket open'); }); @@ -1922,7 +1812,7 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user obj.sshClient.on('ready', function () { // Authentication was successful. // If requested, save the credentials saveSshCredentials(obj.keep); - obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + obj.sessionid = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64'); obj.startTime = Date.now(); // Event start of session @@ -1967,15 +1857,16 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user ws._socket.resume(); } } else { - try { + if (typeof data == 'string') { // Forward any ping/pong commands to the browser var cmd = null; - cmd = JSON.parse(data); + try { cmd = JSON.parse(data); } catch (ex) { } if ((cmd != null) && (cmd.ctrlChannel == '102938') && ((cmd.type == 'ping') || (cmd.type == 'pong'))) { obj.ws.send(data); } return; - } catch (ex) { // Relay WS --> SSH - if ((data.length > 0) && (obj.ser != null)) { try { obj.ser.updateBuffer(data); } catch (ex) { console.log(ex); } } } + + // Relay WS --> SSH + if ((data.length > 0) && (obj.ser != null)) { try { obj.ser.updateBuffer(data); } catch (ex) { console.log(ex); } } } }); obj.wsClient.on('close', function () { @@ -2270,7 +2161,6 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user if ((user == null) || (req.query.nodeid == null)) { obj.close(); return; } // Invalid nodeid parent.GetNodeWithRights(domain, user, req.query.nodeid, function (node, rights, visible) { if (obj.ws == null) return; // obj has been cleaned up, just exit. - node = parent.common.unEscapeLinksFieldName(node); // unEscape node data for rdp/ssh credentials // Check permissions if ((rights & 8) == 0) { obj.close(); return; } // No MESHRIGHT_REMOTECONTROL rights @@ -2335,6 +2225,6 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user function checkRelayRights(parent, domain, user, relayNodeId, func) { if (relayNodeId == null) { func(true); return; } // No relay, do nothing. parent.GetNodeWithRights(domain, user, relayNodeId, function (node, rights, visible) { - func((node != null) && ((rights & 0x00200008) != 0)); // MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY rights + func((node != null) && (rights == 0xFFFFFFFF)); }); } diff --git a/authenticode.js b/authenticode.js index 5f0bd441..213d3d4d 100644 --- a/authenticode.js +++ b/authenticode.js @@ -50,47 +50,6 @@ function createOutFile(args, filename) { args.out = outputFileName.join('.'); } -// Hash an object -function hashObject(obj) { - if (obj == null) { return null; } - const hash = crypto.createHash('sha384'); - if (Buffer.isBuffer(obj)) { hash.update(obj); } else { hash.update(JSON.stringify(obj)); } - return hash.digest().toString('hex'); -} - -// Load a .bmp file. -function loadBitmap(bitmapFile) { - var bitmapData = null; - try { bitmapData = fs.readFileSync(bitmapFile); } catch (ex) { } - if ((bitmapData == null) || (bitmapData.length < 14) || (bitmapData[0] != 0x42) || (bitmapData[1] != 0x4D)) return null; - return bitmapData.slice(14); -} - -// Load a .ico file. This will load all icons in the file into a icon group object -function loadIcon(iconFile) { - var iconData = null; - try { iconData = fs.readFileSync(iconFile); } catch (ex) { } - if ((iconData == null) || (iconData.length < 6) || (iconData[0] != 0) || (iconData[1] != 0)) return null; - const r = { resType: iconData.readUInt16LE(2), resCount: iconData.readUInt16LE(4), icons: {} }; - if (r.resType != 1) return null; - var ptr = 6; - for (var i = 1; i <= r.resCount; i++) { - var icon = {}; - icon.width = iconData[ptr + 0]; - icon.height = iconData[ptr + 1]; - icon.colorCount = iconData[ptr + 2]; - icon.planes = iconData.readUInt16LE(ptr + 4); - icon.bitCount = iconData.readUInt16LE(ptr + 6); - icon.bytesInRes = iconData.readUInt32LE(ptr + 8); - icon.iconCursorId = i; - const offset = iconData.readUInt32LE(ptr + 12); - icon.icon = iconData.slice(offset, offset + icon.bytesInRes); - r.icons[i] = icon; - ptr += 16; - } - return r; -} - // Load certificates and private key from PEM files function loadCertificates(pemFileNames) { var certs = [], keys = []; @@ -298,7 +257,7 @@ function createAuthenticodeHandler(path) { for (var i = 0; i < obj.header.coff.numberOfSections; i++) { var section = {}; buf = readFileSlice(obj.header.SectionHeadersPtr + (i * 40), 40); - if ((buf[0] != 46) && (buf[0] != 95)) { obj.close(); return false; }; // Name of the section must start with a dot or underscore. If not, something is wrong. + if (buf[0] != 46) { obj.close(); return false; }; // Name of the section must start with a dot. If not, something is wrong. var sectionName = buf.slice(0, 8).toString().trim('\0'); var j = sectionName.indexOf('\0'); if (j >= 0) { sectionName = sectionName.substring(0, j); } // Trim any trailing zeroes @@ -609,17 +568,16 @@ function createAuthenticodeHandler(path) { // Pad the resource section & allocate the buffer const fileAlign = obj.header.peWindows.fileAlignment var resSizeTotal = resSizes.tables + resSizes.items + resSizes.names + resSizes.data; - var resNoPadding = resSizeTotal + 4; // TODO: Not sure why this is off by 4 if ((resSizeTotal % fileAlign) != 0) { resSizeTotal += (fileAlign - (resSizeTotal % fileAlign)); } const resSectionBuffer = Buffer.alloc(resSizeTotal); - // Write the resource section, calling a recursive method + // Write the resource section, calling a recusrize method const resPointers = { tables: 0, items: resSizes.tables, names: resSizes.tables + resSizes.items, data: resSizes.tables + resSizes.items + resSizes.names }; createResourceSection(resources, resSectionBuffer, resPointers); //console.log('generateResourceSection', resPointers); // Done, return the result - return { size: resNoPadding, data: resSectionBuffer }; + return resSectionBuffer; } // Return the total size of a resource header, this is a recursive method @@ -762,28 +720,6 @@ function createAuthenticodeHandler(path) { return pkcs7raw; } - - // Get bitmaps information from resource - obj.getBitmapInfo = function () { - const r = {}, ptr = obj.header.sections['.rsrc'].rawAddr; - - // Find and parse each icon - const bitmaps = {} - for (var i = 0; i < obj.resources.entries.length; i++) { - if (obj.resources.entries[i].name == resourceDefaultNames.bitmaps) { - for (var j = 0; j < obj.resources.entries[i].table.entries.length; j++) { - const bitmapName = obj.resources.entries[i].table.entries[j].name; - const offsetToData = obj.resources.entries[i].table.entries[j].table.entries[0].item.offsetToData; - const size = obj.resources.entries[i].table.entries[j].table.entries[0].item.size; - const actualPtr = (offsetToData - obj.header.sections['.rsrc'].virtualAddr) + ptr; - bitmaps[bitmapName] = readFileSlice(actualPtr, size); - } - } - } - - return bitmaps; - } - // Get icon information from resource obj.getIconInfo = function () { const r = {}, ptr = obj.header.sections['.rsrc'].rawAddr; @@ -841,126 +777,9 @@ function createAuthenticodeHandler(path) { return r; } - // Set bitmap information - obj.setBitmapInfo = function (bitmapInfo) { - // Delete all bitmaps resources - var resourcesEntries = []; - for (var i = 0; i < obj.resources.entries.length; i++) { - if (obj.resources.entries[i].name != resourceDefaultNames.bitmaps) { - resourcesEntries.push(obj.resources.entries[i]); - } - } - obj.resources.entries = resourcesEntries; - - // Add all bitmap entries - const bitmapEntry = { name: resourceDefaultNames.bitmaps, table: { characteristics: 0, timeDateStamp: 0, majorVersion: 0, minorVersion: 0, entries: [] } }; - for (var i in bitmapInfo) { - var name = i; - if (parseInt(i) == name) { name = parseInt(i); } - const bitmapItemEntry = { name: name, table: { characteristics: 0, timeDateStamp: 0, majorVersion: 0, minorVersion: 0, entries: [{ name: 1033, item: { buffer: bitmapInfo[i], codePage: 0 } }] } } - bitmapEntry.table.entries.push(bitmapItemEntry); - } - obj.resources.entries.push(bitmapEntry); - - // Sort the resources by name. This is required. - function resSort(a, b) { - if ((typeof a == 'string') && (typeof b == 'string')) { if (a < b) return -1; if (a > b) return 1; return 0; } - if ((typeof a == 'number') && (typeof b == 'number')) { return a - b; } - if ((typeof a == 'string') && (typeof b == 'number')) { return -1; } - return 1; - } - const names = []; - for (var i = 0; i < obj.resources.entries.length; i++) { names.push(obj.resources.entries[i].name); } - names.sort(resSort); - var newEntryOrder = []; - for (var i in names) { - for (var j = 0; j < obj.resources.entries.length; j++) { - if (obj.resources.entries[j].name == names[i]) { newEntryOrder.push(obj.resources.entries[j]); } - } - } - obj.resources.entries = newEntryOrder; - } - - // Set icon information - obj.setIconInfo = function (iconInfo) { - // Delete all icon and icon groups resources - var resourcesEntries = []; - for (var i = 0; i < obj.resources.entries.length; i++) { - if ((obj.resources.entries[i].name != resourceDefaultNames.icon) && (obj.resources.entries[i].name != resourceDefaultNames.iconGroups)) { - resourcesEntries.push(obj.resources.entries[i]); - } - } - obj.resources.entries = resourcesEntries; - - // Count the icon groups and re-number all icons - var iconGroupCount = 0, nextIconNumber = 1; - for (var i in iconInfo) { - iconGroupCount++; - var xicons = {}; - for (var j in iconInfo[i].icons) { xicons[nextIconNumber++] = iconInfo[i].icons[j]; } - iconInfo[i].icons = xicons; - } - if (iconGroupCount == 0) return; // If there are no icon groups, we are done - - // Add the new icons entry - const iconsEntry = { name: resourceDefaultNames.icon, table: { characteristics: 0, timeDateStamp: 0, majorVersion: 0, minorVersion: 0, entries: [] } }; - for (var i in iconInfo) { - for (var j in iconInfo[i].icons) { - var name = j; - if (parseInt(j) == name) { name = parseInt(j); } - const iconItemEntry = { name: name, table: { characteristics: 0, timeDateStamp: 0, majorVersion: 0, minorVersion: 0, entries: [{ name: 1033, item: { buffer: iconInfo[i].icons[j].icon, codePage: 0 } }] } } - iconsEntry.table.entries.push(iconItemEntry); - } - } - obj.resources.entries.push(iconsEntry); - - // Add the new icon group entry - const groupEntry = { name: resourceDefaultNames.iconGroups, table: { characteristics: 0, timeDateStamp: 0, majorVersion: 0, minorVersion: 0, entries: [] } }; - for (var i in iconInfo) { - // Build icon group struct - var iconCount = 0, p = 6; - for (var j in iconInfo[i].icons) { iconCount++; } - const buf = Buffer.alloc(6 + (iconCount * 14)); - buf.writeUInt16LE(iconInfo[i].resType, 2); - buf.writeUInt16LE(iconCount, 4); - for (var j in iconInfo[i].icons) { - buf[p] = iconInfo[i].icons[j].width; - buf[p + 1] = iconInfo[i].icons[j].height; - buf[p + 2] = iconInfo[i].icons[j].colorCount; - buf.writeUInt16LE(iconInfo[i].icons[j].planes, p + 4); - buf.writeUInt16LE(iconInfo[i].icons[j].bitCount, p + 6); - buf.writeUInt32LE(iconInfo[i].icons[j].bytesInRes, p + 8); - buf.writeUInt16LE(j, p + 12); - p += 14; - } - var name = i; - if (parseInt(i) == name) { name = parseInt(i); } - const groupItemEntry = { name: name, table: { characteristics: 0, timeDateStamp: 0, majorVersion: 0, minorVersion: 0, entries: [{ name: 1033, item: { buffer: buf, codePage: 0 } }] } } - groupEntry.table.entries.push(groupItemEntry); - } - obj.resources.entries.push(groupEntry); - - // Sort the resources by name. This is required. - function resSort(a, b) { - if ((typeof a == 'string') && (typeof b == 'string')) { if (a < b) return -1; if (a > b) return 1; return 0; } - if ((typeof a == 'number') && (typeof b == 'number')) { return a - b; } - if ((typeof a == 'string') && (typeof b == 'number')) { return -1; } - return 1; - } - const names = []; - for (var i = 0; i < obj.resources.entries.length; i++) { names.push(obj.resources.entries[i].name); } - names.sort(resSort); - var newEntryOrder = []; - for (var i in names) { - for (var j = 0; j < obj.resources.entries.length; j++) { - if (obj.resources.entries[j].name == names[i]) { newEntryOrder.push(obj.resources.entries[j]); } - } - } - obj.resources.entries = newEntryOrder; - } - // Decode the version information from the resource obj.getVersionInfo = function () { + //console.log('READ', getVersionInfoData().toString('hex')); var r = {}, info = readVersionInfo(getVersionInfoData(), 0); if ((info == null) || (info.stringFiles == null)) return null; var StringFileInfo = null; @@ -968,8 +787,6 @@ function createAuthenticodeHandler(path) { if ((StringFileInfo == null) || (StringFileInfo.stringTable == null) || (StringFileInfo.stringTable.strings == null)) return null; const strings = StringFileInfo.stringTable.strings; for (var i in strings) { r[strings[i].key] = strings[i].value; } - r['~FileVersion'] = (info.fixedFileInfo.dwFileVersionMS >> 16) + '.' + (info.fixedFileInfo.dwFileVersionMS & 0xFFFF) + '.' + (info.fixedFileInfo.dwFileVersionLS >> 16) + '.' + (info.fixedFileInfo.dwFileVersionLS & 0xFFFF); - r['~ProductVersion'] = (info.fixedFileInfo.dwProductVersionMS >> 16) + '.' + (info.fixedFileInfo.dwProductVersionMS & 0xFFFF) + '.' + (info.fixedFileInfo.dwProductVersionLS >> 16) + '.' + (info.fixedFileInfo.dwProductVersionLS & 0xFFFF); return r; } @@ -977,7 +794,7 @@ function createAuthenticodeHandler(path) { obj.setVersionInfo = function (versions) { // Convert the version information into a string array const stringArray = []; - for (var i in versions) { if (!i.startsWith('~')) { stringArray.push({ key: i, value: versions[i] }); } } + for (var i in versions) { stringArray.push({ key: i, value: versions[i] }); } // Get the existing version data and switch the strings to the new strings var r = {}, info = readVersionInfo(getVersionInfoData(), 0); @@ -987,20 +804,6 @@ function createAuthenticodeHandler(path) { if ((StringFileInfo == null) || (StringFileInfo.stringTable == null) || (StringFileInfo.stringTable.strings == null)) return; StringFileInfo.stringTable.strings = stringArray; - // Set the file version - if (versions['~FileVersion'] != null) { - const FileVersionSplit = versions['~FileVersion'].split('.'); - info.fixedFileInfo.dwFileVersionMS = (parseInt(FileVersionSplit[0]) << 16) + parseInt(FileVersionSplit[1]); - info.fixedFileInfo.dwFileVersionLS = (parseInt(FileVersionSplit[2]) << 16) + parseInt(FileVersionSplit[3]); - } - - // Set the product version - if (versions['~ProductVersion'] != null) { - const ProductVersionSplit = versions['~ProductVersion'].split('.'); - info.fixedFileInfo.dwProductVersionMS = (parseInt(ProductVersionSplit[0]) << 16) + parseInt(ProductVersionSplit[1]); - info.fixedFileInfo.dwProductVersionLS = (parseInt(ProductVersionSplit[2]) << 16) + parseInt(ProductVersionSplit[3]); - } - // Re-encode the version information into a buffer var verInfoResBufArray = []; writeVersionInfo(verInfoResBufArray, info); @@ -1339,21 +1142,6 @@ function createAuthenticodeHandler(path) { return hash.digest(); } - // Hash the file using the selected hashing system skipping resource section - // This hash skips the executables CRC, sections table, resource section, code signing data and signing block - obj.getHashOfSection = function (algo, sectionName) { - if (obj.header.sections[sectionName] == null) return null; - - // Get the section start and size - const sectionPtr = obj.header.sections[sectionName].rawAddr; - const sectionSize = obj.header.sections[sectionName].rawSize; - - // Hash the remaining data - const hash = crypto.createHash(algo); - runHash(hash, sectionPtr, sectionPtr + sectionSize); - return hash.digest(); - } - // Hash the file from start to end loading 64k chunks function runHash(hash, start, end) { var ptr = start; @@ -1447,7 +1235,7 @@ function createAuthenticodeHandler(path) { if (args.hash == 'sha512') { hashOid = forge.pki.oids.sha512; fileHash = obj.getHash('sha512'); } if (args.hash == 'sha224') { hashOid = forge.pki.oids.sha224; fileHash = obj.getHash('sha224'); } if (args.hash == 'md5') { hashOid = forge.pki.oids.md5; fileHash = obj.getHash('md5'); } - if (hashOid == null) { func('Invalid signing hash: ' + args.hash); return; }; + if (hashOid == null) { func(false); return; }; // Create the signature block var xp7 = forge.pkcs7.createSignedData(); @@ -1566,11 +1354,7 @@ function createAuthenticodeHandler(path) { options.protocol = timeServerUrl.protocol; options.hostname = timeServerUrl.hostname; options.path = timeServerUrl.pathname; - let http = require("http") - if (options.protocol === "https:"){ - http = require("https") - } - options.port = ((timeServerUrl.port == '') ? (options.protocol === "https:" ? 443 : 80) : parseInt(timeServerUrl.port)); + options.port = ((timeServerUrl.port == '') ? 80 : parseInt(timeServerUrl.port)); if (options.proxy == null) { // No proxy needed @@ -1588,7 +1372,7 @@ function createAuthenticodeHandler(path) { // Set up the request var responseAccumulator = ''; - var req = http.request(options, function (res) { + var req = require('http').request(options, function (res) { res.setEncoding('utf8'); res.on('data', function (chunk) { responseAccumulator += chunk; }); res.on('end', function () { func(null, responseAccumulator); }); @@ -1609,12 +1393,12 @@ function createAuthenticodeHandler(path) { proxyOptions.protocol = proxyUrl.protocol; proxyOptions.hostname = proxyUrl.hostname; proxyOptions.path = options.hostname + ':' + options.port; - proxyOptions.port = ((proxyUrl.port == '') ? (options.protocol === "https:" ? 443 : 80) : parseInt(proxyUrl.port)); + proxyOptions.port = ((proxyUrl.port == '') ? 80 : parseInt(proxyUrl.port)); } // Set up the proxy request var responseAccumulator = ''; - var req = http.request(proxyOptions); + var req = require('http').request(proxyOptions); req.on('error', function (err) { func('' + err); }); req.on('connect', function (res, socket, head) { // Make a request over the HTTP tunnel @@ -1669,7 +1453,7 @@ function createAuthenticodeHandler(path) { // Open the output file var output = null; try { output = fs.openSync(args.out, 'w+'); } catch (ex) { } - if (output == null) { func('Unable to open output file: ' + args.out); return; } + if (output == null) { func(false); return; } var tmp, written = 0, executableSize = obj.header.sigpos ? obj.header.sigpos : filesize; // Compute pre-header length and copy that to the new file @@ -1747,16 +1531,6 @@ function createAuthenticodeHandler(path) { fs.closeSync(output); } - // Find where a directory value is in the old sections and map it to the new sections - function correctDirectoryValue(oldSections, newSections, value) { - for (var i in oldSections) { - if ((value >= oldSections[i].virtualAddr) && (value < (oldSections[i].virtualAddr + oldSections[i].virtualSize))) { - return newSections[i].virtualAddr + (value - oldSections[i].virtualAddr); - } - } - return 0; - } - // Save the executable obj.writeExecutable = function (args, cert, func) { // Open the file @@ -1767,90 +1541,51 @@ function createAuthenticodeHandler(path) { var fullHeaderLen = obj.header.SectionHeadersPtr + (obj.header.coff.numberOfSections * 40); var fullHeader = readFileSlice(written, fullHeaderLen); - // Create the resource section - const rsrcSectionX = generateResourceSection(obj.resources); // This section is created with padding already included - var rsrcSection = rsrcSectionX.data; - var rsrcSectionVirtualSize = rsrcSectionX.size; - var rsrcSectionRawSize = rsrcSection.length; - // Calculate the location and original and new size of the resource segment var fileAlign = obj.header.peWindows.fileAlignment var resPtr = obj.header.sections['.rsrc'].rawAddr; var oldResSize = obj.header.sections['.rsrc'].rawSize; - var newResSize = rsrcSection.length; + var newResSize = obj.header.sections['.rsrc'].rawSize; // Testing 102400 var resDeltaSize = newResSize - oldResSize; - // Compute the sizeOfInitializedData - var sizeOfInitializedData = 0; - for (var i in obj.header.sections) { - if (i != '.text') { - if (i == '.rsrc') { - sizeOfInitializedData += rsrcSectionRawSize; - } else { - sizeOfInitializedData += obj.header.sections[i].rawSize; - } - } - } - // Change PE optional header sizeOfInitializedData standard field - fullHeader.writeUInt32LE(sizeOfInitializedData, obj.header.peOptionalHeaderLocation + 8); + fullHeader.writeUInt32LE(obj.header.peStandard.sizeOfInitializedData + resDeltaSize, obj.header.peOptionalHeaderLocation + 8); + fullHeader.writeUInt32LE(obj.header.peWindows.sizeOfImage, obj.header.peOptionalHeaderLocation + 56); // TODO: resDeltaSize // Update the checksum to zero fullHeader.writeUInt32LE(0, obj.header.peOptionalHeaderLocation + 64); - // We are going to setup the old a new sections here, we need this to correct directory values - var oldSections = obj.header.sections; - var newSections = {}; - - // Make changes to the segments table - var virtualAddress = 4096; - for (var i in obj.header.sections) { - const section = obj.header.sections[i]; - newSections[i] = { virtualSize: section.virtualSize }; - if (i == '.rsrc') { - // Change the size of the resource section - fullHeader.writeUInt32LE(rsrcSectionVirtualSize, section.ptr + 8); // virtualSize - fullHeader.writeUInt32LE(rsrcSectionRawSize, section.ptr + 16); // rawSize - - // Set the virtual address of the section - fullHeader.writeUInt32LE(virtualAddress, section.ptr + 12); // Virtual address - newSections[i].virtualAddr = virtualAddress; - var virtualAddressPadding = (rsrcSectionVirtualSize % 4096); - virtualAddress += rsrcSectionVirtualSize; - if (virtualAddressPadding != 0) { virtualAddress += (4096 - virtualAddressPadding); } - } else { - // Change the location of any other section if located after the resource section - if (section.rawAddr > resPtr) { fullHeader.writeUInt32LE(section.rawAddr + resDeltaSize, section.ptr + 20); } - - // Set the virtual address of the section - fullHeader.writeUInt32LE(virtualAddress, section.ptr + 12); // Virtual address - newSections[i].virtualAddr = virtualAddress; - var virtualAddressPadding = (section.virtualSize % 4096); - virtualAddress += section.virtualSize; - if (virtualAddressPadding != 0) { virtualAddress += (4096 - virtualAddressPadding); } - } - } - // Make change to the data directories header to fix resource segment size and add/remove signature const pePlusOffset = (obj.header.pe32plus == 0) ? 0 : 16; // This header is the same for 32 and 64 bit, but 64bit is offset by 16 bytes. - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.exportTable.addr), obj.header.peOptionalHeaderLocation + 96 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.importTable.addr), obj.header.peOptionalHeaderLocation + 104 + pePlusOffset); - fullHeader.writeUInt32LE(rsrcSectionVirtualSize, obj.header.peOptionalHeaderLocation + 116 + pePlusOffset); // Change the resource segment size - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.exceptionTableAddr.addr), obj.header.peOptionalHeaderLocation + 120 + pePlusOffset); + if (obj.header.dataDirectories.exportTable.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.exportTable.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 96 + pePlusOffset); } + if (obj.header.dataDirectories.importTable.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.importTable.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 104 + pePlusOffset); } + //fullHeader.writeUInt32LE(obj.header.dataDirectories.resourceTable.size + resDeltaSize, obj.header.peOptionalHeaderLocation + 116 + pePlusOffset); // Change the resource segment size + if (obj.header.dataDirectories.exceptionTableAddr.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.exceptionTableAddr.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 120 + pePlusOffset); } fullHeader.writeUInt32LE(0, obj.header.peOptionalHeaderLocation + 128 + pePlusOffset); // certificate table addr (TODO) fullHeader.writeUInt32LE(0, obj.header.peOptionalHeaderLocation + 132 + pePlusOffset); // certificate table size (TODO) - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.baseRelocationTable.addr), obj.header.peOptionalHeaderLocation + 136 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.debug.addr), obj.header.peOptionalHeaderLocation + 144 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.globalPtr.addr), obj.header.peOptionalHeaderLocation + 160 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.tLSTable.addr), obj.header.peOptionalHeaderLocation + 168 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.loadConfigTable.addr), obj.header.peOptionalHeaderLocation + 176 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.boundImport.addr), obj.header.peOptionalHeaderLocation + 184 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.iAT.addr), obj.header.peOptionalHeaderLocation + 192 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.delayImportDescriptor.addr), obj.header.peOptionalHeaderLocation + 200 + pePlusOffset); - fullHeader.writeUInt32LE(correctDirectoryValue(oldSections, newSections, obj.header.dataDirectories.clrRuntimeHeader.addr), obj.header.peOptionalHeaderLocation + 208 + pePlusOffset); + if (obj.header.dataDirectories.baseRelocationTable.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.baseRelocationTable.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 136 + pePlusOffset); } + if (obj.header.dataDirectories.debug.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.debug.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 144 + pePlusOffset); } + if (obj.header.dataDirectories.globalPtr.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.globalPtr.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 160 + pePlusOffset); } + if (obj.header.dataDirectories.tLSTable.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.tLSTable.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 168 + pePlusOffset); } + if (obj.header.dataDirectories.loadConfigTable.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.loadConfigTable.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 176 + pePlusOffset); } + if (obj.header.dataDirectories.boundImport.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.boundImport.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 184 + pePlusOffset); } + if (obj.header.dataDirectories.iAT.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.iAT.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 192 + pePlusOffset); } + if (obj.header.dataDirectories.delayImportDescriptor.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.delayImportDescriptor.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 200 + pePlusOffset); } + if (obj.header.dataDirectories.clrRuntimeHeader.addr > resPtr) { fullHeader.writeUInt32LE(obj.header.dataDirectories.clrRuntimeHeader.addr + resDeltaSize, obj.header.peOptionalHeaderLocation + 208 + pePlusOffset); } - // Write size of image. We put the next virtual address. - fullHeader.writeUInt32LE(virtualAddress, obj.header.peOptionalHeaderLocation + 56); // sizeOfImage + // Make changes to the segments table + for (var i in obj.header.sections) { + const section = obj.header.sections[i]; + if (i == '.rsrc') { + // Change the size of the resource section + fullHeader.writeUInt32LE(section.rawSize + resDeltaSize, section.ptr + 8); // virtualSize (TODO) + fullHeader.writeUInt32LE(section.rawSize + resDeltaSize, section.ptr + 16); // rawSize + } else { + // Change the location of any other section if located after the resource section + if (section.virtualAddr > resPtr) { fullHeader.writeUInt32LE(section.virtualAddr + resDeltaSize, section.ptr + 12); } + if (section.rawAddr > resPtr) { fullHeader.writeUInt32LE(section.rawAddr + resDeltaSize, section.ptr + 20); } + } + } // Write the entire header to the destination file //console.log('Write header', fullHeader.length, written); @@ -1867,6 +1602,7 @@ function createAuthenticodeHandler(path) { } // Write the new resource section + var rsrcSection = generateResourceSection(obj.resources); fs.writeSync(output, rsrcSection); written += rsrcSection.length; //console.log('Write res', rsrcSection.length, written); @@ -2070,58 +1806,40 @@ function start() { console.log(" node authenticode.js [command] [options]"); console.log("Commands:"); console.log(" info: Show information about an executable."); - console.log(" --exe [file] Required executable to view information."); - console.log(" --json Show information in JSON format."); + console.log(" --exe [file] Required executable to view information."); + console.log(" --json Show information in JSON format."); console.log(" sign: Sign an executable."); - console.log(" --exe [file] Required executable to sign."); - console.log(" --out [file] Resulting signed executable."); - console.log(" --pem [pemfile] Certificate & private key to sign the executable with."); - console.log(" --desc [description] Description string to embbed into signature."); - console.log(" --url [url] URL to embbed into signature."); - console.log(" --hash [method] Default is SHA384, possible value: MD5, SHA224, SHA256, SHA384 or SHA512."); - console.log(" --time [url] The time signing server URL."); - console.log(" --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http://"); + console.log(" --exe [file] Required executable to sign."); + console.log(" --out [file] Resulting signed executable."); + console.log(" --pem [pemfile] Certificate & private key to sign the executable with."); + console.log(" --desc [description] Description string to embbed into signature."); + console.log(" --url [url] URL to embbed into signature."); + console.log(" --hash [method] Default is SHA384, possible value: MD5, SHA224, SHA256, SHA384 or SHA512."); + console.log(" --time [url] The time signing server URL."); + console.log(" --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http://"); console.log(" unsign: Remove the signature from the executable."); - console.log(" --exe [file] Required executable to un-sign."); - console.log(" --out [file] Resulting executable with signature removed."); + console.log(" --exe [file] Required executable to un-sign."); + console.log(" --out [file] Resulting executable with signature removed."); console.log(" createcert: Create a code signging self-signed certificate and key."); - console.log(" --out [pemfile] Required certificate file to create."); - console.log(" --cn [value] Required certificate common name."); - console.log(" --country [value] Certificate country name."); - console.log(" --state [value] Certificate state name."); - console.log(" --locality [value] Certificate locality name."); - console.log(" --org [value] Certificate organization name."); - console.log(" --ou [value] Certificate organization unit name."); - console.log(" --serial [value] Certificate serial number."); + console.log(" --out [pemfile] Required certificate file to create."); + console.log(" --cn [value] Required certificate common name."); + console.log(" --country [value] Certificate country name."); + console.log(" --state [value] Certificate state name."); + console.log(" --locality [value] Certificate locality name."); + console.log(" --org [value] Certificate organization name."); + console.log(" --ou [value] Certificate organization unit name."); + console.log(" --serial [value] Certificate serial number."); console.log(" timestamp: Add a signed timestamp to an already signed executable."); - console.log(" --exe [file] Required executable to timestamp."); - console.log(" --out [file] Resulting signed executable."); - console.log(" --time [url] The time signing server URL."); - console.log(" --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http://"); - console.log(" bitmaps: Show bitmap resources in the executable."); - console.log(" --exe [file] Input executable."); - console.log(" savebitmap: Save a single bitmap to a .bmp file."); - console.log(" --exe [file] Input executable."); - console.log(" --out [file] Resulting .ico file."); - console.log(" --bitmap [number] Bitmap number to save to file."); - console.log(" icons: Show the icon resources in the executable."); - console.log(" --exe [file] Input executable."); - console.log(" saveicon: Save a single icon bitmap to a .ico file."); - console.log(" --exe [file] Input executable."); - console.log(" --out [file] Resulting .ico file."); - console.log(" --icon [number] Icon number to save to file."); - console.log(" saveicons: Save an icon group to a .ico file."); - console.log(" --exe [file] Input executable."); - console.log(" --out [file] Resulting .ico file."); - console.log(" --icongroup [groupNumber] Icon groupnumber to save to file."); + console.log(" --exe [file] Required executable to sign."); + console.log(" --out [file] Resulting signed executable."); + console.log(" --time [url] The time signing server URL."); + console.log(" --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http://"); console.log(""); console.log("Note that certificate PEM files must first have the signing certificate,"); console.log("followed by all certificates that form the trust chain."); console.log(""); console.log("When doing sign/unsign, you can also change resource properties of the generated file."); console.log(""); - console.log(" --fileversionnumber n.n.n.n"); - console.log(" --productversionnumber n.n.n.n"); console.log(" --filedescription [value]"); console.log(" --fileversion [value]"); console.log(" --internalname [value]"); @@ -2129,15 +1847,11 @@ function start() { console.log(" --originalfilename [value]"); console.log(" --productname [value]"); console.log(" --productversion [value]"); - console.log(" --removeicongroup [number]"); - console.log(" --removebitmap [number]"); - console.log(" --icon [groupNumber],[filename.ico]"); - console.log(" --bitmap [number],[filename.bmp]"); return; } // Check that a valid command is passed in - if (['info', 'sign', 'unsign', 'createcert', 'icons', 'bitmaps', 'saveicon', 'saveicons', 'savebitmap', 'header', 'sections', 'timestamp', 'signblock'].indexOf(process.argv[2].toLowerCase()) == -1) { + if (['info', 'sign', 'unsign', 'createcert', 'icons', 'saveicon', 'header', 'timestamp', 'signblock'].indexOf(process.argv[2].toLowerCase()) == -1) { console.log("Invalid command: " + process.argv[2]); console.log("Valid commands are: info, sign, unsign, createcert, timestamp"); return; @@ -2153,7 +1867,7 @@ function start() { if (exe == null) { console.log("Unable to parse executable file: " + args.exe); return; } } - // Parse the string resources and make any required changes + // Parse the resources and make any required changes var resChanges = false, versionStrings = null; if (exe != null) { versionStrings = exe.getVersionInfo(); @@ -2162,88 +1876,16 @@ function start() { const prop = versionProperties[i], propl = prop.toLowerCase(); if (args[propl] && (args[propl] != versionStrings[prop])) { versionStrings[prop] = args[propl]; resChanges = true; } } - if (args['fileversionnumber'] != null) { - const fileVerSplit = args['fileversionnumber'].split('.'); - if (fileVerSplit.length != 4) { console.log("--fileversionnumber must be of format n.n.n.n, for example: 1.2.3.4"); return; } - for (var i in fileVerSplit) { var n = parseInt(fileVerSplit[i]); if ((n < 0) || (n > 65535)) { console.log("--fileversionnumber numbers must be between 0 and 65535."); return; } } - if (args['fileversionnumber'] != versionStrings['~FileVersion']) { versionStrings['~FileVersion'] = args['fileversionnumber']; resChanges = true; } - } - if (args['productversionnumber'] != null) { - const productVerSplit = args['productversionnumber'].split('.'); - if (productVerSplit.length != 4) { console.log("--productversionnumber must be of format n.n.n.n, for example: 1.2.3.4"); return; } - for (var i in productVerSplit) { var n = parseInt(productVerSplit[i]); if ((n < 0) || (n > 65535)) { console.log("--productversionnumber numbers must be between 0 and 65535."); return; } } - if (args['productversionnumber'] != versionStrings['~ProductVersion']) { versionStrings['~ProductVersion'] = args['productversionnumber']; resChanges = true; } - } if (resChanges == true) { exe.setVersionInfo(versionStrings); } } - // Parse the icon changes - resChanges = false; - var icons = null, bitmaps = null; - if (exe != null) { - icons = exe.getIconInfo(); - bitmaps = exe.getBitmapInfo(); - if (typeof args['removeicongroup'] == 'string') { // If --removeicongroup is used, it's to remove an existing icon group - const groupsToRemove = args['removeicongroup'].split(','); - for (var i in groupsToRemove) { if (icons[groupsToRemove[i]] != null) { delete icons[groupsToRemove[i]]; resChanges = true; } } - } else if (typeof args['removeicongroup'] == 'number') { - if (icons[args['removeicongroup']] != null) { delete icons[args['removeicongroup']]; resChanges = true; } - } - if (typeof args['removebitmap'] == 'string') { // If --removebitmap is used - const bitmapsToRemove = args['removebitmap'].split(','); - for (var i in bitmapsToRemove) { if (bitmaps[bitmapsToRemove[i]] != null) { delete bitmaps[bitmapsToRemove[i]]; resChanges = true; } } - } else if (typeof args['removebitmap'] == 'number') { - if (bitmaps[args['removebitmap']] != null) { delete bitmaps[args['removebitmap']]; resChanges = true; } - } - if (typeof args['icon'] == 'string') { // If --icon is used, it's to add or replace an existing icon group - const iconToAddSplit = args['icon'].split(','); - if (iconToAddSplit.length != 2) { console.log("The --icon format is: --icon [number],[file]."); return; } - const iconName = parseInt(iconToAddSplit[0]); - const iconFile = iconToAddSplit[1]; - const icon = loadIcon(iconFile); - if (icon == null) { console.log("Unable to load icon: " + iconFile); return; } - if (icons[iconName] != null) { - const iconHash = hashObject(icon); // Compute the new icon group hash - const iconHash2 = hashObject(icons[iconName]); // Computer the old icon group hash - if (iconHash != iconHash2) { icons[iconName] = icon; resChanges = true; } // If different, replace the icon group - } else { - icons[iconName] = icon; // We are adding an icon group - resChanges = true; - } - } - if (typeof args['bitmap'] == 'string') { // If --bitmap is used, it's to add or replace an existing bitmap - const bitmapToAddSplit = args['bitmap'].split(','); - if (bitmapToAddSplit.length != 2) { console.log("The --bitmap format is: --bitmap [number],[file]."); return; } - const bitmapName = parseInt(bitmapToAddSplit[0]); - const bitmapFile = bitmapToAddSplit[1]; - const bitmap = loadBitmap(bitmapFile); - if (bitmap == null) { console.log("Unable to load bitmap: " + bitmapFile); return; } - if (bitmaps[bitmapName] != null) { - const bitmapHash = hashObject(bitmap); // Compute the new bitmap hash - const bitmapHash2 = hashObject(bitmaps[bitmapName]); // Computer the old bitmap hash - if (bitmapHash != bitmapHash2) { bitmaps[bitmapName] = bitmap; resChanges = true; } // If different, replace the new bitmap - } else { - bitmaps[bitmapName] = bitmap; // We are adding an new bitmap - resChanges = true; - } - } - if (resChanges == true) { - exe.setIconInfo(icons); - exe.setBitmapInfo(bitmaps); - } - } - // Execute the command var command = process.argv[2].toLowerCase(); if (command == 'info') { // Get signature information about an executable if (exe == null) { console.log("Missing --exe [filename]"); return; } if (args.json) { - var r = {}, stringInfo = exe.getVersionInfo(); - if (stringInfo != null) { - r.versionInfo = {}; - r.stringInfo = {}; - for (var i in stringInfo) { if (i.startsWith('~')) { r.versionInfo[i.substring(1)] = stringInfo[i]; } else { r.stringInfo[i] = stringInfo[i]; } } - } + var r = {}, versionInfo = exe.getVersionInfo(); + if (versionInfo != null) { r.versionInfo = versionInfo; } if (exe.fileHashAlgo != null) { r.signture = {}; if (exe.fileHashAlgo != null) { r.signture.hashMethod = exe.fileHashAlgo; } @@ -2254,12 +1896,7 @@ function start() { console.log(JSON.stringify(r, null, 2)); } else { var versionInfo = exe.getVersionInfo(); - if (versionInfo != null) { - console.log("Version Information:"); - for (var i in versionInfo) { if (i.startsWith('~') == true) { console.log(' ' + i.substring(1) + ': ' + versionInfo[i] + ''); } } - console.log("String Information:"); - for (var i in versionInfo) { if (i.startsWith('~') == false) { if (versionInfo[i] == null) { console.log(' ' + i + ': (Empty)'); } else { console.log(' ' + i + ': \"' + versionInfo[i] + '\"'); } } } - } + if (versionInfo != null) { console.log("Version Information:"); for (var i in versionInfo) { if (versionInfo[i] == null) { console.log(' ' + i + ': (Empty)'); } else { console.log(' ' + i + ': \"' + versionInfo[i] + '\"'); } } } console.log("Checksum Information:"); console.log(" Header CheckSum: 0x" + exe.header.peWindows.checkSum.toString(16)); console.log(" Actual CheckSum: 0x" + exe.header.peWindows.checkSumActual.toString(16)); @@ -2277,26 +1914,6 @@ function start() { if (command == 'header') { // Display the full executable header in JSON format if (exe == null) { console.log("Missing --exe [filename]"); return; } console.log(exe.header); - // Check that the header is valid - var ptr = 1024, sizeOfCode = 0, sizeOfInitializedData = 0; - for (var i in exe.header.sections) { - if (i == '.text') { sizeOfCode += exe.header.sections[i].rawSize; } else { sizeOfInitializedData += exe.header.sections[i].rawSize; } - if (exe.header.sections[i].rawAddr != ptr) { console.log('WARNING: ' + i + ' section should have a rawAddr or ' + ptr + ', but has ' + exe.header.sections[i].rawAddr + ' instead.'); } - ptr += exe.header.sections[i].rawSize; - } - if (exe.header.peStandard.sizeOfCode != sizeOfCode) { console.log('WARNING: Size of code is ' + exe.header.peStandard.sizeOfCode + ', should be ' + sizeOfCode + '.'); } - if (exe.header.peStandard.sizeOfInitializedData != sizeOfInitializedData) { console.log('WARNING: Size of initialized data is ' + exe.header.peStandard.sizeOfInitializedData + ', should be ' + sizeOfInitializedData + '.'); } - } - if (command == 'sections') { // Display sections in CSV format - if (exe == null) { console.log("Missing --exe [filename]"); return; } - var csvHeader = 'section'; - for (var i in exe.header.sections['.text']) { csvHeader += ',' + i; } - console.log(csvHeader); - for (var i in exe.header.sections) { - var csvData = i; - for (var j in exe.header.sections[i]) { csvData += ',' + exe.header.sections[i][j]; } - console.log(csvData); - } } if (command == 'sign') { // Sign an executable if (typeof args.exe != 'string') { console.log("Missing --exe [filename]"); return; } @@ -2327,7 +1944,7 @@ function start() { if (resChanges == false) { if (exe.header.signed) { console.log("Unsigning to " + args.out); - exe.unsign(args); // Simple unsign, copy most of the original file. + exe.unsign(args); // Simple unsign, copy most of the original file. console.log("Done."); } else { console.log("Executable is not signed."); @@ -2350,32 +1967,6 @@ function start() { fs.writeFileSync(args.out, pki.certificateToPem(cert.cert) + '\r\n' + pki.privateKeyToPem(cert.key)); console.log("Done."); } - if (command == 'bitmaps') { // Show bitmaps in the executable - if (exe == null) { console.log("Missing --exe [filename]"); return; } - if (args.json) { - var bitmapInfo = exe.getBitmapInfo(); - console.log(JSON.stringify(bitmapInfo, null, 2)); - } else { - var bitmapInfo = exe.getBitmapInfo(); - if (bitmapInfo != null) { - console.log("Bitmap Information:"); - for (var i in bitmapInfo) { console.log(' ' + i + ': ' + bitmapInfo[i].length + ' byte' + ((bitmapInfo[i].length > 1) ? 's' : '') + '.'); } - } - } - } - if (command == 'savebitmap') { // Save an bitmap to file - if (exe == null) { console.log("Missing --exe [filename]"); return; } - if (typeof args.out != 'string') { console.log("Missing --out [filename]"); return; } - if (typeof args.bitmap != 'number') { console.log("Missing or incorrect --bitmap [number]"); return; } - const bitmapInfo = exe.getBitmapInfo(); - if (bitmapInfo[args.bitmap] == null) { console.log("Unknown bitmap: " + args.bitmap); return; } - - console.log("Writing to " + args.out); - var bitmapHeader = Buffer.from('424D000000000000000036000000', 'hex'); - bitmapHeader.writeUInt32LE(14 + bitmapInfo[args.bitmap].length, 2); // Write the full size of the bitmap file - fs.writeFileSync(args.out, Buffer.concat([bitmapHeader, bitmapInfo[args.bitmap]])); - console.log("Done."); - } if (command == 'icons') { // Show icons in the executable if (exe == null) { console.log("Missing --exe [filename]"); return; } if (args.json) { @@ -2415,48 +2006,6 @@ function start() { fs.writeFileSync(args.out, Buffer.concat([buf, icon.icon])); console.log("Done."); } - if (command == 'saveicons') { // Save an icon group to file - if (exe == null) { console.log("Missing --exe [filename]"); return; } - if (typeof args.out != 'string') { console.log("Missing --out [filename]"); return; } - if (typeof args.icongroup != 'number') { console.log("Missing or incorrect --icongroup [number]"); return; } - const iconInfo = exe.getIconInfo(); - const iconGroup = iconInfo[args.icongroup]; - if (iconGroup == null) { console.log("Invalid or incorrect --icongroup [number]"); return; } - - // Count the number of icons in the group - var iconCount = 0; - for (var i in iconGroup.icons) { iconCount++; } - - // .ico header: https://en.wikipedia.org/wiki/ICO_(file_format) - const iconFileData = []; - const header = Buffer.alloc(6); - header.writeUInt16LE(1, 2); // 1 = Icon, 2 = Cursor - header.writeUInt16LE(iconCount, 4); // Icon Count, always 1 in our case - iconFileData.push(header); - - // Store each icon header - var offsetPtr = 6 + (16 * iconCount); - for (var i in iconGroup.icons) { - const buf = Buffer.alloc(16); - buf[0] = iconGroup.icons[i].width; // Width (0 = 256) - buf[1] = iconGroup.icons[i].height; // Height (0 = 256) - buf[2] = iconGroup.icons[i].colorCount; // Colors - buf.writeUInt16LE(iconGroup.icons[i].planes, 4); // Color planes - buf.writeUInt16LE(iconGroup.icons[i].bitCount, 6); // Bits per pixel - buf.writeUInt32LE(iconGroup.icons[i].icon.length, 8); // Size - buf.writeUInt32LE(offsetPtr, 12); // Offset - offsetPtr += iconGroup.icons[i].icon.length; - iconFileData.push(buf); - } - - // Store each icon - for (var i in iconGroup.icons) { iconFileData.push(iconGroup.icons[i].icon); } - - // Write the .ico file - console.log("Writing to " + args.out); - fs.writeFileSync(args.out, Buffer.concat(iconFileData)); - console.log("Done."); - } if (command == 'signblock') { // Display the raw signature block of the executable in hex if (exe == null) { console.log("Missing --exe [filename]"); return; } var buf = exe.getRawSignatureBlock(); @@ -2485,6 +2034,4 @@ if (require.main === module) { start(); } // Exports module.exports.createAuthenticodeHandler = createAuthenticodeHandler; module.exports.loadCertificates = loadCertificates; -module.exports.loadIcon = loadIcon; -module.exports.loadBitmap = loadBitmap; -module.exports.hashObject = hashObject; \ No newline at end of file + diff --git a/bin/Microsoft.NodejsTools.WebRole.dll b/bin/Microsoft.NodejsTools.WebRole.dll deleted file mode 100644 index 3d131c95..00000000 Binary files a/bin/Microsoft.NodejsTools.WebRole.dll and /dev/null differ diff --git a/bin/meshcentral b/bin/meshcentral deleted file mode 100644 index bebde613..00000000 --- a/bin/meshcentral +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env node -require("../meshcentral.js"); \ No newline at end of file diff --git a/certoperations.js b/certoperations.js index 50c92f2a..dd441e50 100644 --- a/certoperations.js +++ b/certoperations.js @@ -247,25 +247,16 @@ module.exports.CertificateOperations = function (parent) { // Get the certificate common name var certCommonName = r.certs[0].subject.getField('CN'); if (certCommonName == null) { amtacmactivation.acmCertErrors.push("Unable to get Intel AMT activation certificate common name."); continue; } - if (amtacmactivation.strictcommonname == true) { - // Use the certificate common name exactly - acmconfig.cn = certCommonName.value; + var certCommonNameSplit = certCommonName.value.split('.'); + var topLevel = certCommonNameSplit[certCommonNameSplit.length - 1].toLowerCase(); + var topLevelNum = TopLevelDomainExtendedSupport[topLevel]; + if (topLevelNum != null) { + while (certCommonNameSplit.length > topLevelNum) { certCommonNameSplit.shift(); } + acmconfig.cn = certCommonNameSplit.join('.'); } else { - // Check if Intel AMT will allow some flexibility in the certificate common name - var certCommonNameSplit = certCommonName.value.split('.'); - var topLevel = certCommonNameSplit[certCommonNameSplit.length - 1].toLowerCase(); - var topLevelNum = TopLevelDomainExtendedSupport[topLevel]; - if (topLevelNum != null) { - while (certCommonNameSplit.length > topLevelNum) { certCommonNameSplit.shift(); } - acmconfig.cn = certCommonNameSplit.join('.'); - } else { - acmconfig.cn = certCommonName.value; - } + acmconfig.cn = certCommonName.value; } - if(r.certs[0].md){ - acmconfig.hashAlgorithm = r.certs[0].md.algorithm; - } - + delete acmconfig.cert; delete acmconfig.certpass; acmconfig.certs = orderedCerts; @@ -636,16 +627,9 @@ module.exports.CertificateOperations = function (parent) { }; // Return the SHA384 hash of the certificate public key - obj.getPublicKeyHashBinary = function (pem) { - const { X509Certificate } = require('crypto'); - if (X509Certificate == null) { - // This version of NodeJS (= 0) return true; - for (var i in xcertNames) { - if ((xcertNames[i].startsWith('*.') == true) && (name.endsWith(xcertNames[i].substring(1)) == true)) { return true; } - if (xcertNames[i].startsWith('http://*.') == true) { - if (name.endsWith(xcertNames[i].substring(8)) == true) { return true; } - if ((xcertNames[i].endsWith('/') == true) && (name.endsWith(xcertNames[i].substring(8, xcertNames[i].length - 1)) == true)) { return true; } + if (certNames.indexOf(name.toLowerCase()) >= 0) return true; + for (var i in certNames) { + if ((certNames[i].startsWith('*.') == true) && (name.endsWith(certNames[i].substring(1)) == true)) { return true; } + if (certNames[i].startsWith('http://*.') == true) { + if (name.endsWith(certNames[i].substring(8)) == true) { return true; } + if ((certNames[i].endsWith('/') == true) && (name.endsWith(certNames[i].substring(8, certNames[i].length - 1)) == true)) { return true; } } } return false; @@ -768,102 +749,12 @@ module.exports.CertificateOperations = function (parent) { // Return true if the certificate is valid obj.checkCertificate = function (pem, key) { - const { X509Certificate } = require('crypto'); - if (X509Certificate == null) { - // This version of NodeJS (Settings->Cert when using a wildcard certificate."); process.exit(0); return; } - commonName = r.CommonName; + r.AmtMpsName = obj.pki.certificateFromPem(r.mps.cert).subject.getField('CN').value; + var webCertificate = obj.pki.certificateFromPem(r.web.cert); + r.WebIssuer = webCertificate.issuer.getField('CN').value; + if (commonName == 'un-configured') { // If the "cert" name is not set, try to use the certificate CN instead (ok if the certificate is not wildcard). + commonName = webCertificate.subject.getField('CN').value; + if (commonName.startsWith('*.')) { console.log("ERROR: Must specify a server full domain name in Config.json->Settings->Cert when using a wildcard certificate."); process.exit(0); return; } } + r.CommonName = commonName; + r.CommonNames = [commonName.toLowerCase()]; + var altNames = webCertificate.getExtension('subjectAltName'); + if (altNames) { + for (i = 0; i < altNames.altNames.length; i++) { + if ((altNames.altNames[i] != null) && (altNames.altNames[i].type === 2) && (typeof altNames.altNames[i].value === 'string')) { + var acn = altNames.altNames[i].value.toLowerCase(); + if (r.CommonNames.indexOf(acn) == -1) { r.CommonNames.push(acn); } + } + } + } + var rootCertificate = obj.pki.certificateFromPem(r.root.cert); + r.RootName = rootCertificate.subject.getField('CN').value; } // Look for domains that have DNS names and load their certificates r.dns = {}; for (i in config.domains) { - if ((i != '') && (config.domains[i] != null) && (config.domains[i].dns != null)) { + if ((i != "") && (config.domains[i] != null) && (config.domains[i].dns != null)) { dnsname = config.domains[i].dns; // Check if this domain matches a parent wildcard cert, if so, use the parent cert. if (obj.compareCertificateNames(r.CommonNames, dnsname) == true) { @@ -1049,7 +944,6 @@ module.exports.CertificateOperations = function (parent) { config.domains[i].certs = r.dns[i]; } else { console.log("WARNING: File \"webserver-" + i + "-cert-public.crt\" missing, domain \"" + i + "\" will not work correctly."); - rcountmax++; } } else { // If the web certificate already exist, load it. Load both certificate and private key @@ -1075,35 +969,25 @@ module.exports.CertificateOperations = function (parent) { } } - // If we have all the certificates we need, stop here. if (rcount === rcountmax) { if ((certargs == null) && (mpscertargs == null)) { if (func != undefined) { func(r); } return r; } // If no certificate arguments are given, keep the certificate - const xcountry = obj.getCertificateCommonName(r.web.cert, 'C'); - const xorganization = obj.getCertificateCommonName(r.web.cert, 'O'); + var xcountry, xcountryField = webCertificate.subject.getField('C'); + if (xcountryField != null) { xcountry = xcountryField.value; } + var xorganization, xorganizationField = webCertificate.subject.getField('O'); + if (xorganizationField != null) { xorganization = xorganizationField.value; } if (certargs == null) { commonName = r.CommonName; country = xcountry; organization = xorganization; } - // Check if we have correct certificates. - if (obj.compareCertificateNames(r.CommonNames, commonName) == false) { console.log("Error: " + commonName + " does not match name in TLS certificate: " + r.CommonNames.join(', ')); forceWebCertGen = 1; } else { r.CommonName = commonName; } + // Check if we have correct certificates + if (obj.compareCertificateNames(r.CommonNames, commonName) == false) { forceWebCertGen = 1; } if (r.AmtMpsName != mpsCommonName) { forceMpsCertGen = 1; } - if (args.keepcerts == true) { forceWebCertGen = 0; forceMpsCertGen = 0; r.CommonName = commonName; } // If the certificates matches what we want, use them. if ((forceWebCertGen == 0) && (forceMpsCertGen == 0)) { - if (func !== null) { func(r); } + if (func !== undefined) { func(r); } return r; } } - - if (parent.configurationFiles != null) { - console.log("Error: Vault/Database missing some certificates."); - if (r.root == null) { console.log(' Code signing certificate is missing.'); } - if (r.web == null) { console.log(' HTTPS web certificate is missing.'); } - if (r.mps == null) { console.log(' Intel AMT MPS certificate is missing.'); } - if (r.agent == null) { console.log(' Server agent authentication certificate is missing.'); } - if (r.codesign == null) { console.log(' Agent code signing certificate is missing.'); } - process.exit(0); - return null; - } + if (parent.configurationFiles != null) { console.log("Error: Vault/Database missing some certificates."); process.exit(0); return null; } console.log("Generating certificates, may take a few minutes..."); parent.updateServerState('state', 'generatingcertificates'); @@ -1122,16 +1006,9 @@ module.exports.CertificateOperations = function (parent) { if (r.root == null) { // If the root certificate does not exist, create one console.log("Generating root certificate..."); - if (typeof args.rootcertcommonname == 'string') { - // If a root certificate common name is specified, use it. - rootCertAndKey = obj.GenerateRootCertificate(false, args.rootcertcommonname, null, null, strongCertificate); - } else { - // A root certificate common name is not specified, use the default one. - rootCertAndKey = obj.GenerateRootCertificate(true, 'MeshCentralRoot', null, null, strongCertificate); - } + rootCertAndKey = obj.GenerateRootCertificate(true, 'MeshCentralRoot', null, null, strongCertificate); rootCertificate = obj.pki.certificateToPem(rootCertAndKey.cert); rootPrivateKey = obj.pki.privateKeyToPem(rootCertAndKey.key); - parent.common.moveOldFiles([parent.getConfigFilePath('root-cert-public.crt'), parent.getConfigFilePath('root-cert-private.key')]); obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-public.crt'), rootCertificate); obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-private.key'), rootPrivateKey); } else { @@ -1144,12 +1021,11 @@ module.exports.CertificateOperations = function (parent) { // If the web certificate does not exist, create one var webCertAndKey, webCertificate, webPrivateKey; - if ((r.web == null) || (forceWebCertGen === 1)) { + if ((r.web == null) || (forceWebCertGen == 1)) { console.log("Generating HTTPS certificate..."); webCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, commonName, country, organization, null, strongCertificate); webCertificate = obj.pki.certificateToPem(webCertAndKey.cert); webPrivateKey = obj.pki.privateKeyToPem(webCertAndKey.key); - parent.common.moveOldFiles([parent.getConfigFilePath('webserver-cert-public.crt'), parent.getConfigFilePath('webserver-cert-private.key')]); obj.fs.writeFileSync(parent.getConfigFilePath('webserver-cert-public.crt'), webCertificate); obj.fs.writeFileSync(parent.getConfigFilePath('webserver-cert-private.key'), webPrivateKey); } else { @@ -1163,8 +1039,7 @@ module.exports.CertificateOperations = function (parent) { webPrivateKey = r.web.key; } } - var webIssuer = null; - if (webCertAndKey.cert.issuer.getField('CN') != null) { webIssuer = webCertAndKey.cert.issuer.getField('CN').value; } + var webIssuer = webCertAndKey.cert.issuer.getField('CN').value; // If the mesh agent server certificate does not exist, create one var agentCertAndKey, agentCertificate, agentPrivateKey; @@ -1173,7 +1048,6 @@ module.exports.CertificateOperations = function (parent) { agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, 'MeshCentralAgentServer', country, organization, { }, strongCertificate); agentCertificate = obj.pki.certificateToPem(agentCertAndKey.cert); agentPrivateKey = obj.pki.privateKeyToPem(agentCertAndKey.key); - parent.common.moveOldFiles([parent.getConfigFilePath('agentserver-cert-public.crt'), parent.getConfigFilePath('agentserver-cert-private.key')]); obj.fs.writeFileSync(parent.getConfigFilePath('agentserver-cert-public.crt'), agentCertificate); obj.fs.writeFileSync(parent.getConfigFilePath('agentserver-cert-private.key'), agentPrivateKey); } else { @@ -1190,7 +1064,6 @@ module.exports.CertificateOperations = function (parent) { codesignCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, commonName, country, organization, { codeSign: true }, strongCertificate); codesignCertificate = obj.pki.certificateToPem(codesignCertAndKey.cert); codesignPrivateKey = obj.pki.privateKeyToPem(codesignCertAndKey.key); - parent.common.moveOldFiles([parent.getConfigFilePath('codesign-cert-public.crt'), parent.getConfigFilePath('codesign-cert-private.key')]); obj.fs.writeFileSync(parent.getConfigFilePath('codesign-cert-public.crt'), codesignCertificate); obj.fs.writeFileSync(parent.getConfigFilePath('codesign-cert-private.key'), codesignPrivateKey); } else { @@ -1202,12 +1075,11 @@ module.exports.CertificateOperations = function (parent) { // If the Intel AMT MPS certificate does not exist, create one var mpsCertAndKey, mpsCertificate, mpsPrivateKey; - if ((r.mps == null) || (forceMpsCertGen === 1)) { + if ((r.mps == null) || (forceMpsCertGen == 1)) { console.log("Generating Intel AMT MPS certificate..."); mpsCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, mpsCommonName, mpsCountry, mpsOrganization, null, false); mpsCertificate = obj.pki.certificateToPem(mpsCertAndKey.cert); mpsPrivateKey = obj.pki.privateKeyToPem(mpsCertAndKey.key); - parent.common.moveOldFiles([parent.getConfigFilePath('mpsserver-cert-public.crt'), parent.getConfigFilePath('mpsserver-cert-private.key')]); obj.fs.writeFileSync(parent.getConfigFilePath('mpsserver-cert-public.crt'), mpsCertificate); obj.fs.writeFileSync(parent.getConfigFilePath('mpsserver-cert-private.key'), mpsPrivateKey); } else { @@ -1221,7 +1093,7 @@ module.exports.CertificateOperations = function (parent) { // Fetch the certificates names for the main certificate var webCertificate = obj.pki.certificateFromPem(r.web.cert); - if (webCertificate.issuer.getField('CN') != null) { r.WebIssuer = webCertificate.issuer.getField('CN').value; } else { r.WebIssuer = null; } + r.WebIssuer = webCertificate.issuer.getField('CN').value; r.CommonName = webCertificate.subject.getField('CN').value; if (r.CommonName.startsWith('*.')) { if (commonName.indexOf('.') == -1) { console.log("ERROR: Must specify a server full domain name in Config.json->Settings->Cert when using a wildcard certificate."); process.exit(0); return; } @@ -1243,7 +1115,7 @@ module.exports.CertificateOperations = function (parent) { // Look for domains with DNS names that have no certificates and generated them. for (i in config.domains) { - if ((i != '') && (config.domains[i] != null) && (config.domains[i].dns != null)) { + if ((i != "") && (config.domains[i] != null) && (config.domains[i].dns != null)) { dnsname = config.domains[i].dns; // Check if this domain matches a parent wildcard cert, if so, use the parent cert. if (obj.compareCertificateNames(r.CommonNames, dnsname) == true) { @@ -1256,7 +1128,6 @@ module.exports.CertificateOperations = function (parent) { var xwebCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, dnsname, country, organization, null, strongCertificate); var xwebCertificate = obj.pki.certificateToPem(xwebCertAndKey.cert); var xwebPrivateKey = obj.pki.privateKeyToPem(xwebCertAndKey.key); - parent.common.moveOldFiles([ parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'), parent.getConfigFilePath('webserver-' + i + '-cert-private.key') ]); obj.fs.writeFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'), xwebCertificate); obj.fs.writeFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-private.key'), xwebPrivateKey); r.dns[i] = { cert: xwebCertificate, key: xwebPrivateKey }; @@ -1408,15 +1279,20 @@ module.exports.CertificateOperations = function (parent) { // Perform any general operation obj.acceleratorPerformOperation = function (operation, data, tag, func) { - var acc = obj.getAccelerator(); - if (acc == null) { - // Add to pending accelerator workload - acceleratorPerformSignaturePushFuncCall++; - pendingAccelerator.push({ action: operation, data: data, tag: tag, func: func }); + if (acceleratorTotalCount <= 1) { + // No accelerators available + require(program).processMessage({ action: operation, data: data, tag: tag, func: func }); } else { - // Send to accelerator now - acceleratorPerformSignatureRunFuncCall++; - acc.send(acc.x = { action: operation, data: data, tag: tag, func: func }); + var acc = obj.getAccelerator(); + if (acc == null) { + // Add to pending accelerator workload + acceleratorPerformSignaturePushFuncCall++; + pendingAccelerator.push({ action: operation, data: data, tag: tag, func: func }); + } else { + // Send to accelerator now + acceleratorPerformSignatureRunFuncCall++; + acc.send(acc.x = { action: operation, data: data, tag: tag, func: func }); + } } }; diff --git a/common.js b/common.js index f1fdf105..307d2ce7 100644 --- a/common.js +++ b/common.js @@ -106,7 +106,7 @@ module.exports.random = function (max) { return r; }; -// Split a comma separated string, ignoring commas in quotes. +// Split a comma seperated string, ignoring commas in quotes. module.exports.quoteSplit = function (str) { var tmp = '', quote = 0, result = []; for (var i in str) { if (str[i] == '"') { quote = (quote + 1) % 2; } if ((str[i] == ',') && (quote == 0)) { tmp = tmp.trim(); result.push(tmp); tmp = ''; } else { tmp += str[i]; } } @@ -142,48 +142,25 @@ module.exports.zeroPad = function(num, c) { if (c == null) { c = 2; } var s = '0 // Lowercase all the names in a object recursively // Allow for exception keys, child of exceptions will not get lower-cased. -// Exceptions is an array of "keyname" or "parent\keyname" -module.exports.objKeysToLower = function (obj, exceptions, parent) { +module.exports.objKeysToLower = function (obj, exceptions) { for (var i in obj) { - if ((typeof obj[i] == 'object') && - ((exceptions == null) || (exceptions.indexOf(i.toLowerCase()) == -1) && ((parent == null) || (exceptions.indexOf(parent.toLowerCase() + '/' + i.toLowerCase()) == -1))) - ) { - module.exports.objKeysToLower(obj[i], exceptions, i); // LowerCase all key names in the child object - } + if ((typeof obj[i] == 'object') && ((exceptions == null) || (exceptions.indexOf(i.toLowerCase()) == -1))) { module.exports.objKeysToLower(obj[i], exceptions); } // LowerCase all key names in the child object if (i.toLowerCase() !== i) { obj[i.toLowerCase()] = obj[i]; delete obj[i]; } // LowerCase all key names } return obj; }; -// Escape and unescape field names so there are no invalid characters for MongoDB/NeDB ("$", ",", ".", see https://github.com/seald/nedb/tree/master?tab=readme-ov-file#inserting-documents) -module.exports.escapeFieldName = function (name) { if ((name.indexOf(',') == -1) && (name.indexOf('%') == -1) && (name.indexOf('.') == -1) && (name.indexOf('$') == -1)) return name; return name.split('%').join('%25').split('.').join('%2E').split('$').join('%24').split(',').join('%2C'); }; -module.exports.unEscapeFieldName = function (name) { if (name.indexOf('%') == -1) return name; return name.split('%2C').join(',').split('%2E').join('.').split('%24').join('$').split('%25').join('%'); }; +// Escape and unexcape feild names so there are no invalid characters for MongoDB +module.exports.escapeFieldName = function (name) { if ((name.indexOf('%') == -1) && (name.indexOf('.') == -1) && (name.indexOf('$') == -1)) return name; return name.split('%').join('%25').split('.').join('%2E').split('$').join('%24'); }; +module.exports.unEscapeFieldName = function (name) { if (name.indexOf('%') == -1) return name; return name.split('%2E').join('.').split('%24').join('$').split('%25').join('%'); }; -// Escape all links, SSH and RDP usernames -// This is required for databases like NeDB that don't accept "." or "," as part of a field name. -module.exports.escapeLinksFieldNameEx = function (docx) { if ((docx.links == null) && (docx.ssh == null) && (docx.rdp == null)) { return docx; } return module.exports.escapeLinksFieldName(docx); }; -module.exports.escapeLinksFieldName = function (docx) { - var doc = Object.assign({}, docx); - if (doc.links != null) { doc.links = Object.assign({}, doc.links); for (var i in doc.links) { var ue = module.exports.escapeFieldName(i); if (ue !== i) { doc.links[ue] = doc.links[i]; delete doc.links[i]; } } } - if (doc.ssh != null) { doc.ssh = Object.assign({}, doc.ssh); for (var i in doc.ssh) { var ue = module.exports.escapeFieldName(i); if (ue !== i) { doc.ssh[ue] = doc.ssh[i]; delete doc.ssh[i]; } } } - if (doc.rdp != null) { doc.rdp = Object.assign({}, doc.rdp); for (var i in doc.rdp) { var ue = module.exports.escapeFieldName(i); if (ue !== i) { doc.rdp[ue] = doc.rdp[i]; delete doc.rdp[i]; } } } - return doc; -}; -module.exports.unEscapeLinksFieldName = function (doc) { - if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } - if (doc.ssh != null) { for (var j in doc.ssh) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.ssh[ue] = doc.ssh[j]; delete doc.ssh[j]; } } } - if (doc.rdp != null) { for (var j in doc.rdp) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.rdp[ue] = doc.rdp[j]; delete doc.rdp[j]; } } } - return doc; -}; +// Escape all links +module.exports.escapeLinksFieldNameEx = function (docx) { if (docx.links == null) { return docx; } var doc = Object.assign({}, docx); doc.links = Object.assign({}, doc.links); for (var i in doc.links) { var ue = module.exports.escapeFieldName(i); if (ue !== i) { doc.links[ue] = doc.links[i]; delete doc.links[i]; } } return doc; }; +module.exports.escapeLinksFieldName = function (docx) { var doc = Object.assign({}, docx); if (doc.links != null) { doc.links = Object.assign({}, doc.links); for (var i in doc.links) { var ue = module.exports.escapeFieldName(i); if (ue !== i) { doc.links[ue] = doc.links[i]; delete doc.links[i]; } } } return doc; }; +module.exports.unEscapeLinksFieldName = function (doc) { if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } return doc; }; //module.exports.escapeAllLinksFieldName = function (docs) { for (var i in docs) { module.exports.escapeLinksFieldName(docs[i]); } return docs; }; module.exports.unEscapeAllLinksFieldName = function (docs) { for (var i in docs) { docs[i] = module.exports.unEscapeLinksFieldName(docs[i]); } return docs; }; -// Escape field names for aceBase -var aceEscFields = ['links', 'ssh', 'rdp', 'notify']; -module.exports.aceEscapeFieldNames = function (docx) { var doc = Object.assign({}, docx); for (var k in aceEscFields) { if (typeof doc[aceEscFields[k]] == 'object') { doc[aceEscFields[k]] = Object.assign({}, doc[aceEscFields[k]]); for (var i in doc[aceEscFields[k]]) { var ue = encodeURIComponent(i); if (ue !== i) { doc[aceEscFields[k]][ue] = doc[aceEscFields[k]][i]; delete doc[aceEscFields[k]][i]; } } } } return doc; }; -module.exports.aceUnEscapeFieldNames = function (doc) { for (var k in aceEscFields) { if (typeof doc[aceEscFields[k]] == 'object') { for (var j in doc[aceEscFields[k]]) { var ue = decodeURIComponent(j); if (ue !== j) { doc[aceEscFields[k]][ue] = doc[aceEscFields[k]][j]; delete doc[aceEscFields[k]][j]; } } } } return doc; }; -module.exports.aceUnEscapeAllFieldNames = function (docs) { for (var i in docs) { docs[i] = module.exports.aceUnEscapeFieldNames(docs[i]); } return docs; }; - // Validation methods module.exports.validateString = function (str, minlen, maxlen) { return ((str != null) && (typeof str == 'string') && ((minlen == null) || (str.length >= minlen)) && ((maxlen == null) || (str.length <= maxlen))); }; module.exports.validateInt = function (int, minval, maxval) { return ((int != null) && (typeof int == 'number') && ((minval == null) || (int >= minval)) && ((maxval == null) || (int <= maxval))); }; @@ -334,11 +311,6 @@ module.exports.meshServerRightsArrayToNumber = function (val) { if (r == 'locked') { newAccRights |= 32; } if (r == 'nonewgroups') { newAccRights |= 64; } if (r == 'notools') { newAccRights |= 128; } - if (r == 'usergroups') { newAccRights |= 256; } - if (r == 'recordings') { newAccRights |= 512; } - if (r == 'locksettings') { newAccRights |= 1024; } - if (r == 'allevents') { newAccRights |= 2048; } - if (r == 'nonewdevices') { newAccRights |= 4096; } } return newAccRights; } @@ -367,56 +339,3 @@ function validateObjectForMongoRec(obj, maxStrLen) { } return true; } - -// Parse a version string of the type n.n.n.n -module.exports.parseVersion = function (verstr) { - if (typeof verstr != 'string') return null; - const r = [], verstrsplit = verstr.split('.'); - if (verstrsplit.length != 4) return null; - for (var i in verstrsplit) { - var n = parseInt(verstrsplit[i]); - if (isNaN(n) || (n < 0) || (n > 65535)) return null; - r.push(n); - } - return r; -} - -// Move old files. If we are about to overwrite a file, we can move if first just in case the change needs to be reverted -module.exports.moveOldFiles = function (filelist) { - // Fine an old extension that works for all files in the file list - var oldFileExt, oldFileExtCount = 0, extOk; - do { - extOk = true; - if (++oldFileExtCount == 1) { oldFileExt = '-old'; } else { oldFileExt = '-old' + oldFileExtCount; } - for (var i in filelist) { if (fs.existsSync(filelist[i] + oldFileExt) == true) { extOk = false; } } - } while (extOk == false); - for (var i in filelist) { try { fs.renameSync(filelist[i], filelist[i] + oldFileExt); } catch (ex) { } } -} - -// Convert strArray to Array, returns array if strArray or null if any other type -module.exports.convertStrArray = function (object, split) { - if (split && typeof object === 'string') { - return object.split(split) - } else if (typeof object === 'string') { - return Array(object); - } else if (Array.isArray(object)) { - return object - } else { - return [] - } -} - -module.exports.uniqueArray = function (a) { - var seen = {}; - var out = []; - var len = a.length; - var j = 0; - for(var i = 0; i < len; i++) { - var item = a[i]; - if(seen[item] !== 1) { - seen[item] = 1; - out[j++] = item; - } - } - return out; -} \ No newline at end of file diff --git a/crowdsec.js b/crowdsec.js deleted file mode 100644 index 04e506db..00000000 --- a/crowdsec.js +++ /dev/null @@ -1,141 +0,0 @@ -module.exports.CreateCrowdSecBouncer = function (parent, config) { - const obj = {}; - - // Setup constants - const { getLogger } = require('@crowdsec/express-bouncer/src/nodejs-bouncer/lib/logger'); - const { configure, renderBanWall, testConnectionToCrowdSec, getRemediationForIp } = require('@crowdsec/express-bouncer/src/nodejs-bouncer'); - const applyCaptcha = require('@crowdsec/express-bouncer/src/express-crowdsec-middleware/lib/captcha'); - const { BYPASS_REMEDIATION, CAPTCHA_REMEDIATION, BAN_REMEDIATION } = require('@crowdsec/express-bouncer/src/nodejs-bouncer/lib/constants'); // "bypass", "captcha", "ban"; - const svgCaptcha = require('svg-captcha'); - const { renderCaptchaWall } = require('@crowdsec/express-bouncer/src/nodejs-bouncer'); - - // Current captcha state - const currentCaptchaIpList = {}; - - // Set the default values. "config" will come in with lowercase names with everything, so we need to correct some value names. - if (typeof config.useragent != 'string') { config.useragent = 'CrowdSec Express-NodeJS bouncer/v0.0.1'; } - if (typeof config.timeout != 'number') { config.timeout = 2000; } - if ((typeof config.fallbackremediation != 'string') || (['bypass', 'captcha', 'ban'].indexOf(config.fallbackremediation) == -1)) { config.fallbackremediation = BAN_REMEDIATION; } - if (typeof config.maxremediation != 'number') { config.maxremediation = BAN_REMEDIATION; } - if (typeof config.captchagenerationcacheduration != 'number') { config.captchagenerationcacheduration = 60 * 1000; } // 60 seconds - if (typeof config.captcharesolutioncacheduration != 'number') { config.captcharesolutioncacheduration = 30 * 60 * 1000; } // 30 minutes - if (typeof config.captchatexts != 'object') { config.captchatexts = {}; } else { - if (typeof config.captchatexts.tabtitle == 'string') { config.captchatexts.tabTitle = config.captchatexts.tabtitle; delete config.captchatexts.tabtitle; } // Fix "tabTitle" capitalization - } - if (typeof config.bantexts != 'object') { config.bantexts = {}; } else { - if (typeof config.bantexts.tabtitle == 'string') { config.bantexts.tabTitle = config.bantexts.tabtitle; delete config.bantexts.tabtitle; } // Fix "tabTitle" capitalization - } - if (typeof config.colors != 'object') { config.colors = {}; } else { - var colors = {}; - // All of the values in "text" and "background" sections happen to be lowercase, so, we can use the values as-is. - if (typeof config.colors.text == 'object') { colors.text = config.colors.text; } - if (typeof config.colors.background == 'object') { colors.background = config.colors.background; } - config.colors = colors; - } - if (typeof config.hidecrowdsecmentions != 'boolean') { config.hidecrowdsecmentions = false; } - if (typeof config.customcss != 'string') { delete config.customcss; } - if (typeof config.bypass != 'boolean') { config.bypass = false; } - if (typeof config.customlogger != 'object') { delete config.customlogger; } - if (typeof config.bypassconnectiontest != 'boolean') { config.bypassconnectiontest = false; } - - // Setup the logger - var logger = config.customLogger ? config.customLogger : getLogger(); - - // Configure the bouncer - configure({ - url: config.url, - apiKey: config.apikey, - userAgent: config.useragent, - timeout: config.timeout, - fallbackRemediation: config.fallbackremediation, - maxRemediation: config.maxremediation, - captchaTexts: config.captchatexts, - banTexts: config.bantexts, - colors: config.colors, - hideCrowdsecMentions: config.hidecrowdsecmentions, - customCss: config.customcss - }); - - // Test connectivity - obj.testConnectivity = async function() { return (await testConnectionToCrowdSec())['success']; } - - // Process a web request - obj.process = async function (domain, req, res, next) { - try { - var remediation = config.fallbackremediation; - try { remediation = await getRemediationForIp(req.clientIp); } catch (ex) { } - //console.log('CrowdSec', req.clientIp, remediation, req.url); - switch (remediation) { - case BAN_REMEDIATION: - const banWallTemplate = await renderBanWall(); - res.status(403); - res.send(banWallTemplate); - return true; - case CAPTCHA_REMEDIATION: - if ((currentCaptchaIpList[req.clientIp] == null) || (currentCaptchaIpList[req.clientIp].resolved !== true)) { - var domainCaptchaUrl = ((domain != null) && (domain.id != '') && (domain.dns == null)) ? ('/' + domain.id + '/captcha.ashx') : '/captcha.ashx'; - if (req.url != domainCaptchaUrl) { res.redirect(domainCaptchaUrl); return true; } - } - break; - } - } catch (ex) { } - return false; - } - - // Process a captcha request - obj.applyCaptcha = async function (req, res, next) { - await applyCaptchaEx(req.clientIp, req, res, next, config.captchagenerationcacheduration, config.captcharesolutioncacheduration, logger); - } - - // Process a captcha request - async function applyCaptchaEx(ip, req, res, next, captchaGenerationCacheDuration, captchaResolutionCacheDuration, loggerInstance) { - logger = loggerInstance; - let error = false; - - if (currentCaptchaIpList[ip] == null) { - generateCaptcha(ip, captchaGenerationCacheDuration); - } else { - if (currentCaptchaIpList[ip] && currentCaptchaIpList[ip].resolved) { - logger.debug({ type: 'CAPTCHA_ALREADY_SOLVED', ip }); - next(); - return; - } else { - if (req.body && req.body.crowdsec_captcha) { - if (req.body.refresh === '1') { generateCaptcha(ip, captchaGenerationCacheDuration); } - if (req.body.phrase !== '') { - if (currentCaptchaIpList[ip].text === req.body.phrase) { - currentCaptchaIpList[ip].resolved = true; - setTimeout(function() { if (currentCaptchaIpList[ip]) { delete currentCaptchaIpList[ip]; } }, captchaResolutionCacheDuration); - res.redirect(req.originalUrl); - logger.info({ type: 'CAPTCHA_RESOLUTION', ip, result: true }); - return; - } else { - logger.info({ type: 'CAPTCHA_RESOLUTION', ip, result: false }); - error = true; - } - } - } - } - } - - const captchaWallTemplate = await renderCaptchaWall({ captchaImageTag: currentCaptchaIpList[ip].data, captchaResolutionFormUrl: '', error }); - res.status(401); - res.send(captchaWallTemplate); - }; - - // Generate a CAPTCHA - function generateCaptcha(ip, captchaGenerationCacheDuration) { - const captcha = svgCaptcha.create(); - currentCaptchaIpList[ip] = { - data: captcha.data, - text: captcha.text, - resolved: false, - }; - setTimeout(() => { - if (currentCaptchaIpList[ip]) { delete currentCaptchaIpList[ip]; } - }, captchaGenerationCacheDuration); - logger.debug({ type: "GENERATE_CAPTCHA", ip }); - }; - - return obj; -} diff --git a/db.js b/db.js index 81ea222c..899d1e38 100644 --- a/db.js +++ b/db.js @@ -30,33 +30,8 @@ module.exports.CreateDB = function (parent, func) { var Datastore = null; var expireEventsSeconds = (60 * 60 * 24 * 20); // By default, expire events after 20 days (1728000). (Seconds * Minutes * Hours * Days) var expirePowerEventsSeconds = (60 * 60 * 24 * 10); // By default, expire power events after 10 days (864000). (Seconds * Minutes * Hours * Days) - var expireServerStatsSeconds = (60 * 60 * 24 * 30); // By default, expire server stats after 30 days (2592000). (Seconds * Minutes * Hours * Days) + var expireServerStatsSeconds = (60 * 60 * 24 * 30); // By default, expire power events after 30 days (2592000). (Seconds * Minutes * Hours * Days) const common = require('./common.js'); - const path = require('path'); - const fs = require('fs'); - const DB_NEDB = 1, DB_MONGOJS = 2, DB_MONGODB = 3,DB_MARIADB = 4, DB_MYSQL = 5, DB_POSTGRESQL = 6, DB_ACEBASE = 7, DB_SQLITE = 8; - const DB_LIST = ['None', 'NeDB', 'MongoJS', 'MongoDB', 'MariaDB', 'MySQL', 'PostgreSQL', 'AceBase', 'SQLite']; //for the info command - let databaseName = 'meshcentral'; - let datapathParentPath = path.dirname(parent.datapath); - let datapathFoldername = path.basename(parent.datapath); - const SQLITE_AUTOVACUUM = ['none', 'full', 'incremental']; - const SQLITE_SYNCHRONOUS = ['off', 'normal', 'full', 'extra']; - obj.sqliteConfig = { - maintenance: '', - startupVacuum: false, - autoVacuum: 'full', - incrementalVacuum: 100, - journalMode: 'delete', - journalSize: 4096000, - synchronous: 'full', - }; - obj.performingBackup = false; - const BACKUPFAIL_ZIPCREATE = 0x0001; - const BACKUPFAIL_ZIPMODULE = 0x0010; - const BACKUPFAIL_DBDUMP = 0x0100; - obj.backupStatus = 0x0; - obj.newAutoBackupFile = null; - obj.newDBDumpFile = null; obj.identifier = null; obj.dbKey = null; obj.dbRecordsEncryptKey = null; @@ -130,42 +105,17 @@ module.exports.CreateDB = function (parent, func) { // Perform database maintenance obj.maintenance = function () { - parent.debug('db', 'Entering database maintenance'); - if (obj.databaseType == DB_NEDB) { // NeDB will not remove expired records unless we try to access them. This will force the removal. + if (obj.databaseType == 1) { // NeDB will not remove expired records unless we try to access them. This will force the removal. obj.eventsfile.remove({ time: { '$lt': new Date(Date.now() - (expireEventsSeconds * 1000)) } }, { multi: true }); // Force delete older events obj.powerfile.remove({ time: { '$lt': new Date(Date.now() - (expirePowerEventsSeconds * 1000)) } }, { multi: true }); // Force delete older events obj.serverstatsfile.remove({ time: { '$lt': new Date(Date.now() - (expireServerStatsSeconds * 1000)) } }, { multi: true }); // Force delete older events - } else if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL)) { // MariaDB or MySQL + } else if ((obj.databaseType == 4) || (obj.databaseType == 5)) { // MariaDB or MySQL sqlDbQuery('DELETE FROM events WHERE time < ?', [new Date(Date.now() - (expireEventsSeconds * 1000))], function (doc, err) { }); // Delete events older than expireEventsSeconds sqlDbQuery('DELETE FROM power WHERE time < ?', [new Date(Date.now() - (expirePowerEventsSeconds * 1000))], function (doc, err) { }); // Delete events older than expirePowerSeconds sqlDbQuery('DELETE FROM serverstats WHERE expire < ?', [new Date()], function (doc, err) { }); // Delete events where expiration date is in the past sqlDbQuery('DELETE FROM smbios WHERE expire < ?', [new Date()], function (doc, err) { }); // Delete events where expiration date is in the past - } else if (obj.databaseType == DB_ACEBASE) { // AceBase - //console.log('Performing AceBase maintenance'); - obj.file.query('events').filter('time', '<', new Date(Date.now() - (expireEventsSeconds * 1000))).remove().then(function () { - obj.file.query('stats').filter('time', '<', new Date(Date.now() - (expireServerStatsSeconds * 1000))).remove().then(function () { - obj.file.query('power').filter('time', '<', new Date(Date.now() - (expirePowerEventsSeconds * 1000))).remove().then(function () { - //console.log('AceBase maintenance done'); - }); - }); - }); - } else if (obj.databaseType == DB_SQLITE) { // SQLite3 - //sqlite does not return rows affected for INSERT, UPDATE or DELETE statements, see https://www.sqlite.org/pragma.html#pragma_count_changes - obj.file.serialize(function () { - obj.file.run('DELETE FROM events WHERE time < ?', [new Date(Date.now() - (expireEventsSeconds * 1000))]); - obj.file.run('DELETE FROM power WHERE time < ?', [new Date(Date.now() - (expirePowerEventsSeconds * 1000))]); - obj.file.run('DELETE FROM serverstats WHERE expire < ?', [new Date()]); - obj.file.run('DELETE FROM smbios WHERE expire < ?', [new Date()]); - obj.file.exec(obj.sqliteConfig.maintenance, function (err) { - if (err) {console.log('Maintenance error: ' + err.message)}; - if (parent.config.settings.debug) { - sqliteGetPragmas(['freelist_count', 'page_size', 'page_count', 'cache_size' ], function (pragma, pragmaValue) { - parent.debug('db', 'SQLite Maintenance: ' + pragma + '=' + pragmaValue); - }); - }; - }); - }); } + obj.removeInactiveDevices(); } @@ -176,7 +126,7 @@ module.exports.CreateDB = function (parent, func) { for (var i in parent.config.domains) { if (typeof parent.config.domains[i].autoremoveinactivedevices == 'number') { var v = parent.config.domains[i].autoremoveinactivedevices; - if ((v >= 1) && (v <= 2000)) { + if ((v > 1) && (v <= 2000)) { if (v < minRemoveInactiveDevice) { minRemoveInactiveDevice = v; } removeInactiveDevicesPerDomain[i] = v; minRemoveInactiveDevicesPerDomain[i] = v; @@ -188,7 +138,7 @@ module.exports.CreateDB = function (parent, func) { for (var i in parent.webserver.meshes) { if (typeof parent.webserver.meshes[i].expireDevs == 'number') { var v = parent.webserver.meshes[i].expireDevs; - if ((v >= 1) && (v <= 2000)) { + if ((v > 1) && (v <= 2000)) { if (v < minRemoveInactiveDevice) { minRemoveInactiveDevice = v; } if ((minRemoveInactiveDevicesPerDomain[parent.webserver.meshes[i].domain] == null) || (minRemoveInactiveDevicesPerDomain[parent.webserver.meshes[i].domain] > v)) { minRemoveInactiveDevicesPerDomain[parent.webserver.meshes[i].domain] = v; @@ -285,18 +235,12 @@ module.exports.CreateDB = function (parent, func) { obj.removeDomain = function (domainName, func) { var pendingCalls; // Remove all events, power events and SMBIOS data from the main collection. They are all in seperate collections now. - if (obj.databaseType == DB_ACEBASE) { - // AceBase - pendingCalls = 3; - obj.file.query('meshcentral').filter('domain', '==', domainName).remove().then(function () { if (--pendingCalls == 0) { func(); } }); - obj.file.query('events').filter('domain', '==', domainName).remove().then(function () { if (--pendingCalls == 0) { func(); } }); - obj.file.query('power').filter('domain', '==', domainName).remove().then(function () { if (--pendingCalls == 0) { func(); } }); - } else if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL) || (obj.databaseType == DB_POSTGRESQL)) { + if ((obj.databaseType == 4) || (obj.databaseType == 5) || (obj.databaseType == 6)) { // MariaDB, MySQL or PostgreSQL pendingCalls = 2; sqlDbQuery('DELETE FROM main WHERE domain = $1', [domainName], function () { if (--pendingCalls == 0) { func(); } }); sqlDbQuery('DELETE FROM events WHERE domain = $1', [domainName], function () { if (--pendingCalls == 0) { func(); } }); - } else if (obj.databaseType == DB_MONGODB) { + } else if (obj.databaseType == 3) { // MongoDB pendingCalls = 3; obj.file.deleteMany({ domain: domainName }, { multi: true }, function () { if (--pendingCalls == 0) { func(); } }); @@ -316,17 +260,17 @@ module.exports.CreateDB = function (parent, func) { // TODO: Remove all meshes that dont have any links // Remove all events, power events and SMBIOS data from the main collection. They are all in seperate collections now. - if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL) || (obj.databaseType == DB_POSTGRESQL)) { + if ((obj.databaseType == 4) || (obj.databaseType == 5) || (obj.databaseType == 6)) { // MariaDB, MySQL or PostgreSQL obj.RemoveAllOfType('event', function () { }); obj.RemoveAllOfType('power', function () { }); obj.RemoveAllOfType('smbios', function () { }); - } else if (obj.databaseType == DB_MONGODB) { + } else if (obj.databaseType == 3) { // MongoDB obj.file.deleteMany({ type: 'event' }, { multi: true }); obj.file.deleteMany({ type: 'power' }, { multi: true }); obj.file.deleteMany({ type: 'smbios' }, { multi: true }); - } else if ((obj.databaseType == DB_NEDB) || (obj.databaseType == DB_MONGOJS)) { + } else { // NeDB or MongoJS obj.file.remove({ type: 'event' }, { multi: true }); obj.file.remove({ type: 'power' }, { multi: true }); @@ -345,7 +289,7 @@ module.exports.CreateDB = function (parent, func) { validIdentifiers[docs[i]._id] = 1; } } - + // Fix all of the creating & login to ticks by seconds, not milliseconds. obj.GetAllType('user', function (err, docs) { if (err != null) { parent.debug('db', 'ERROR (GetAll user): ' + err); } @@ -427,19 +371,13 @@ module.exports.CreateDB = function (parent, func) { if (meshChange) { obj.Set(docs[i]); } } } - if (obj.databaseType == DB_SQLITE) { - // SQLite - - } else if (obj.databaseType == DB_ACEBASE) { - // AceBase - - } else if (obj.databaseType == DB_POSTGRESQL) { + if (obj.databaseType == 6) { // Postgres sqlDbQuery('DELETE FROM Main WHERE ((extra != NULL) AND (extra LIKE (\'mesh/%\')) AND (extra != ANY ($1)))', [meshlist], function (err, response) { }); - } else if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL)) { + } else if ((obj.databaseType == 4) || (obj.databaseType == 5)) { // MariaDB sqlDbQuery('DELETE FROM Main WHERE (extra LIKE ("mesh/%") AND (extra NOT IN ?)', [meshlist], function (err, response) { }); - } else if (obj.databaseType == DB_MONGODB) { + } else if (obj.databaseType == 3) { // MongoDB obj.file.deleteMany({ meshid: { $exists: true, $nin: meshlist } }, { multi: true }); } else { @@ -457,66 +395,14 @@ module.exports.CreateDB = function (parent, func) { }; // Get encryption key - obj.getEncryptDataKey = function (password, salt, iterations) { + obj.getEncryptDataKey = function (password) { if (typeof password != 'string') return null; - let key; - try { - key = parent.crypto.pbkdf2Sync(password, salt, iterations, 32, 'sha384'); - } catch (ex) { - // If this previous call fails, it's probably because older pbkdf2 did not specify the hashing function, just use the default. - key = parent.crypto.pbkdf2Sync(password, salt, iterations, 32); - } - return key + return parent.crypto.createHash('sha384').update(password).digest("raw").slice(0, 32); } // Encrypt data obj.encryptData = function (password, plaintext) { - let encryptionVersion = 0x01; - let iterations = 100000 - const iv = parent.crypto.randomBytes(16); - var key = obj.getEncryptDataKey(password, iv, iterations); - if (key == null) return null; - const aes = parent.crypto.createCipheriv('aes-256-gcm', key, iv); - var ciphertext = aes.update(plaintext); - let versionbuf = Buffer.allocUnsafe(2); - versionbuf.writeUInt16BE(encryptionVersion); - let iterbuf = Buffer.allocUnsafe(4); - iterbuf.writeUInt32BE(iterations); - let encryptedBuf = aes.final(); - ciphertext = Buffer.concat([versionbuf, iterbuf, aes.getAuthTag(), iv, ciphertext, encryptedBuf]); - return ciphertext.toString('base64'); - } - - // Decrypt data - obj.decryptData = function (password, ciphertext) { - // Adding an encryption version lets us avoid try catching in the future - let ciphertextBytes = Buffer.from(ciphertext, 'base64'); - let encryptionVersion = ciphertextBytes.readUInt16BE(0); - try { - switch (encryptionVersion) { - case 0x01: - let iterations = ciphertextBytes.readUInt32BE(2); - let authTag = ciphertextBytes.slice(6, 22); - const iv = ciphertextBytes.slice(22, 38); - const data = ciphertextBytes.slice(38); - let key = obj.getEncryptDataKey(password, iv, iterations); - if (key == null) return null; - const aes = parent.crypto.createDecipheriv('aes-256-gcm', key, iv); - aes.setAuthTag(authTag); - let plaintextBytes = Buffer.from(aes.update(data)); - plaintextBytes = Buffer.concat([plaintextBytes, aes.final()]); - return plaintextBytes; - default: - return obj.oldDecryptData(password, ciphertextBytes); - } - } catch (ex) { return obj.oldDecryptData(password, ciphertextBytes); } - } - - // Encrypt data - // The older encryption system uses CBC without integraty checking. - // This method is kept only for testing - obj.oldEncryptData = function (password, plaintext) { - let key = parent.crypto.createHash('sha384').update(password).digest('raw').slice(0, 32); + var key = obj.getEncryptDataKey(password); if (key == null) return null; const iv = parent.crypto.randomBytes(16); const aes = parent.crypto.createCipheriv('aes-256-cbc', key, iv); @@ -525,17 +411,16 @@ module.exports.CreateDB = function (parent, func) { return ciphertext.toString('base64'); } - // Decrypt data - // The older encryption system uses CBC without integraty checking. - // This method is kept only to convert the old encryption to the new one. - obj.oldDecryptData = function (password, ciphertextBytes) { - if (typeof password != 'string') return null; + // Decrypt data + obj.decryptData = function (password, ciphertext) { try { + var key = obj.getEncryptDataKey(password); + if (key == null) return null; + const ciphertextBytes = Buffer.from(ciphertext, 'base64'); const iv = ciphertextBytes.slice(0, 16); const data = ciphertextBytes.slice(16); - let key = parent.crypto.createHash('sha384').update(password).digest('raw').slice(0, 32); const aes = parent.crypto.createDecipheriv('aes-256-cbc', key, iv); - let plaintextBytes = Buffer.from(aes.update(data)); + var plaintextBytes = Buffer.from(aes.update(data)); plaintextBytes = Buffer.concat([plaintextBytes, aes.final()]); return plaintextBytes; } catch (ex) { return null; } @@ -544,33 +429,30 @@ module.exports.CreateDB = function (parent, func) { // Get the number of records in the database for various types, this is the slow NeDB way. // WARNING: This is a terrible query for database performance. Only do this when needed. This query will look at almost every document in the database. obj.getStats = function (func) { - if (obj.databaseType == DB_ACEBASE) { - // AceBase - // TODO - } else if (obj.databaseType == DB_POSTGRESQL) { + if (obj.databaseType == 6) { // PostgreSQL // TODO - } else if (obj.databaseType == DB_MYSQL) { + } else if (obj.databaseType == 5) { // MySQL // TODO - } else if (obj.databaseType == DB_MARIADB) { + } else if (obj.databaseType == 4) { // MariaDB // TODO - } else if (obj.databaseType == DB_MONGODB) { + } else if (obj.databaseType == 3) { // MongoDB obj.file.aggregate([{ "$group": { _id: "$type", count: { $sum: 1 } } }]).toArray(function (err, docs) { var counters = {}, totalCount = 0; if (err == null) { for (var i in docs) { if (docs[i]._id != null) { counters[docs[i]._id] = docs[i].count; totalCount += docs[i].count; } } } func(counters); }); - } else if (obj.databaseType == DB_MONGOJS) { + } else if (obj.databaseType == 2) { // MongoJS obj.file.aggregate([{ "$group": { _id: "$type", count: { $sum: 1 } } }], function (err, docs) { var counters = {}, totalCount = 0; if (err == null) { for (var i in docs) { if (docs[i]._id != null) { counters[docs[i]._id] = docs[i].count; totalCount += docs[i].count; } } } func(counters); }); - } else if (obj.databaseType == DB_NEDB) { + } else if (obj.databaseType == 1) { // NeDB version obj.file.count({ type: 'node' }, function (err, nodeCount) { obj.file.count({ type: 'mesh' }, function (err, meshCount) { @@ -610,8 +492,8 @@ module.exports.CreateDB = function (parent, func) { if (err == null) { for (var i in docs) { count++; obj.Set(docs[i]); } } obj.GetAllType('mesh', function (err, docs) { if (err == null) { for (var i in docs) { count++; obj.Set(docs[i]); } } - if (obj.databaseType == DB_NEDB) { // If we are using NeDB, compact the database. - obj.file.compactDatafile(); + if (obj.databaseType == 1) { // If we are using NeDB, compact the database. + obj.file.persistence.compactDatafile(); obj.file.on('compaction.done', function () { func(count); }); // It's important to wait for compaction to finish before exit, otherwise NeDB may corrupt. } else { func(count); // For all other databases, normal exit. @@ -759,128 +641,29 @@ module.exports.CreateDB = function (parent, func) { }); } - if (parent.args.sqlite3) { - // SQLite3 database setup - obj.databaseType = DB_SQLITE; - const sqlite3 = require('sqlite3'); - let configParams = parent.config.settings.sqlite3; - if (typeof configParams == 'string') {databaseName = configParams} else {databaseName = configParams.name ? configParams.name : 'meshcentral';}; - obj.sqliteConfig.startupVacuum = configParams.startupvacuum ? configParams.startupvacuum : false; - obj.sqliteConfig.autoVacuum = configParams.autovacuum ? configParams.autovacuum.toLowerCase() : 'incremental'; - obj.sqliteConfig.incrementalVacuum = configParams.incrementalvacuum ? configParams.incrementalvacuum : 100; - obj.sqliteConfig.journalMode = configParams.journalmode ? configParams.journalmode.toLowerCase() : 'delete'; - //allowed modes, 'none' excluded because not usefull for this app, maybe also remove 'memory'? - if (!(['delete', 'truncate', 'persist', 'memory', 'wal'].includes(obj.sqliteConfig.journalMode))) { obj.sqliteConfig.journalMode = 'delete'}; - obj.sqliteConfig.journalSize = configParams.journalsize ? configParams.journalsize : 409600; - //wal can use the more performant 'normal' mode, see https://www.sqlite.org/pragma.html#pragma_synchronous - obj.sqliteConfig.synchronous = (obj.sqliteConfig.journalMode == 'wal') ? 'normal' : 'full'; - if (obj.sqliteConfig.journalMode == 'wal') {obj.sqliteConfig.maintenance += 'PRAGMA wal_checkpoint(PASSIVE);'}; - if (obj.sqliteConfig.autoVacuum == 'incremental') {obj.sqliteConfig.maintenance += 'PRAGMA incremental_vacuum(' + obj.sqliteConfig.incrementalVacuum + ');'}; - obj.sqliteConfig.maintenance += 'PRAGMA optimize;'; - - parent.debug('db', 'SQlite config options: ' + JSON.stringify(obj.sqliteConfig, null, 4)); - if (obj.sqliteConfig.journalMode == 'memory') { console.log('[WARNING] journal_mode=memory: this can lead to database corruption if there is a crash during a transaction. See https://www.sqlite.org/pragma.html#pragma_journal_mode') }; - //.cached not usefull - obj.file = new sqlite3.Database(path.join(parent.datapath, databaseName + '.sqlite'), sqlite3.OPEN_READWRITE, function (err) { - if (err && (err.code == 'SQLITE_CANTOPEN')) { - // Database needs to be created - obj.file = new sqlite3.Database(path.join(parent.datapath, databaseName + '.sqlite'), function (err) { - if (err) { console.log("SQLite Error: " + err); process.exit(1); } - obj.file.exec(` - CREATE TABLE main (id VARCHAR(256) PRIMARY KEY NOT NULL, type CHAR(32), domain CHAR(64), extra CHAR(255), extraex CHAR(255), doc JSON); - CREATE TABLE events(id INTEGER PRIMARY KEY, time TIMESTAMP, domain CHAR(64), action CHAR(255), nodeid CHAR(255), userid CHAR(255), doc JSON); - CREATE TABLE eventids(fkid INT NOT NULL, target CHAR(255), CONSTRAINT fk_eventid FOREIGN KEY (fkid) REFERENCES events (id) ON DELETE CASCADE ON UPDATE RESTRICT); - CREATE TABLE serverstats (time TIMESTAMP PRIMARY KEY, expire TIMESTAMP, doc JSON); - CREATE TABLE power (id INTEGER PRIMARY KEY, time TIMESTAMP, nodeid CHAR(255), doc JSON); - CREATE TABLE smbios (id CHAR(255) PRIMARY KEY, time TIMESTAMP, expire TIMESTAMP, doc JSON); - CREATE TABLE plugin (id INTEGER PRIMARY KEY, doc JSON); - CREATE INDEX ndxtypedomainextra ON main (type, domain, extra); - CREATE INDEX ndxextra ON main (extra); - CREATE INDEX ndxextraex ON main (extraex); - CREATE INDEX ndxeventstime ON events(time); - CREATE INDEX ndxeventsusername ON events(domain, userid, time); - CREATE INDEX ndxeventsdomainnodeidtime ON events(domain, nodeid, time); - CREATE INDEX ndxeventids ON eventids(target); - CREATE INDEX ndxserverstattime ON serverstats (time); - CREATE INDEX ndxserverstatexpire ON serverstats (expire); - CREATE INDEX ndxpowernodeidtime ON power (nodeid, time); - CREATE INDEX ndxsmbiostime ON smbios (time); - CREATE INDEX ndxsmbiosexpire ON smbios (expire); - `, function (err) { - // Completed DB creation of SQLite3 - sqliteSetOptions(func); - //setupFunctions could be put in the sqliteSetupOptions, but left after it for clarity - setupFunctions(func); - } - ); - }); - return; - } else if (err) { console.log("SQLite Error: " + err); process.exit(0); } - - //for existing db's - sqliteSetOptions(); - //setupFunctions could be put in the sqliteSetupOptions, but left after it for clarity - setupFunctions(func); - }); - } else if (parent.args.acebase) { - // AceBase database setup - obj.databaseType = DB_ACEBASE; - const { AceBase } = require('acebase'); - // For information on AceBase sponsor: https://github.com/appy-one/acebase/discussions/100 - obj.file = new AceBase('meshcentral', { sponsor: ((typeof parent.args.acebase == 'object') && (parent.args.acebase.sponsor)), logLevel: 'error', storage: { path: parent.datapath } }); - // Get all the databases ready - obj.file.ready(function () { - // Create AceBase indexes - obj.file.indexes.create('meshcentral', 'type', { include: ['domain', 'meshid'] }); - obj.file.indexes.create('meshcentral', 'email'); - obj.file.indexes.create('meshcentral', 'meshid'); - obj.file.indexes.create('meshcentral', 'intelamt.uuid'); - obj.file.indexes.create('events', 'userid', { include: ['action'] }); - obj.file.indexes.create('events', 'domain', { include: ['nodeid', 'time'] }); - obj.file.indexes.create('events', 'ids', { include: ['time'] }); - obj.file.indexes.create('events', 'time'); - obj.file.indexes.create('power', 'nodeid', { include: ['time'] }); - obj.file.indexes.create('power', 'time'); - obj.file.indexes.create('stats', 'time'); - obj.file.indexes.create('stats', 'expire'); - // Completed setup of AceBase - setupFunctions(func); - }); - } else if (parent.args.mariadb || parent.args.mysql) { + if (parent.args.mariadb || parent.args.mysql) { var connectinArgs = (parent.args.mariadb) ? parent.args.mariadb : parent.args.mysql; - if (typeof connectinArgs == 'string') { - const parts = connectinArgs.split(/[:@/]+/); - var connectionObject = { - "user": parts[1], - "password": parts[2], - "host": parts[3], - "port": parts[4], - "database": parts[5] - }; - var dbname = (connectionObject.database != null) ? connectionObject.database : 'meshcentral'; - } else { - var dbname = (connectinArgs.database != null) ? connectinArgs.database : 'meshcentral'; + var dbname = (connectinArgs.database != null) ? connectinArgs.database : 'meshcentral'; - // Including the db name in the connection obj will cause a connection faliure if it does not exist - var connectionObject = Clone(connectinArgs); - delete connectionObject.database; + // Including the db name in the connection obj will cause a connection failure if it does not exist + var connectionObject = Clone(connectinArgs); + delete connectionObject.database; - try { - if (connectinArgs.ssl) { - if (connectinArgs.ssl.dontcheckserveridentity == true) { connectionObject.ssl.checkServerIdentity = function (name, cert) { return undefined; } }; - if (connectinArgs.ssl.cacertpath) { connectionObject.ssl.ca = [require('fs').readFileSync(connectinArgs.ssl.cacertpath, 'utf8')]; } - if (connectinArgs.ssl.clientcertpath) { connectionObject.ssl.cert = [require('fs').readFileSync(connectinArgs.ssl.clientcertpath, 'utf8')]; } - if (connectinArgs.ssl.clientkeypath) { connectionObject.ssl.key = [require('fs').readFileSync(connectinArgs.ssl.clientkeypath, 'utf8')]; } - } - } catch (ex) { - console.log('Error loading SQL Connector certificate: ' + ex); - process.exit(); + try { + if (connectinArgs.ssl) { + if (connectinArgs.ssl.dontcheckserveridentity == true) { connectionObject.ssl.checkServerIdentity = function(name, cert) { return undefined; } }; + if (connectinArgs.ssl.cacertpath) { connectionObject.ssl.ca = [require('fs').readFileSync(connectinArgs.ssl.cacertpath, 'utf8')]; } + if (connectinArgs.ssl.clientcertpath) { connectionObject.ssl.cert = [require('fs').readFileSync(connectinArgs.ssl.clientcertpath, 'utf8')]; } + if (connectinArgs.ssl.clientkeypath) { connectionObject.ssl.key = [require('fs').readFileSync(connectinArgs.ssl.clientkeypath, 'utf8')]; } } + } catch (ex) { + console.log('Error loading SQL Connector certificate: ' + ex); + process.exit(); } if (parent.args.mariadb) { // Use MariaDB - obj.databaseType = DB_MARIADB; + obj.databaseType = 4; var tempDatastore = require('mariadb').createPool(connectionObject); tempDatastore.getConnection().then(function (conn) { conn.query('CREATE DATABASE IF NOT EXISTS ' + dbname).then(function (result) { @@ -894,70 +677,66 @@ module.exports.CreateDB = function (parent, func) { createTablesIfNotExist(dbname); } else if (parent.args.mysql) { // Use MySQL - obj.databaseType = DB_MYSQL; - var tempDatastore = require('mysql2').createPool(connectionObject); + obj.databaseType = 5; + var tempDatastore = require('mysql').createPool(connectionObject); tempDatastore.query('CREATE DATABASE IF NOT EXISTS ' + dbname, function (error) { if (error != null) { console.log('Auto-create database failed: ' + error); } connectionObject.database = dbname; - Datastore = require('mysql2').createPool(connectionObject); + Datastore = require('mysql').createPool(connectionObject); createTablesIfNotExist(dbname); }); setTimeout(function () { tempDatastore.end(); }, 2000); } } else if (parent.args.postgres) { // Postgres SQL - let connectinArgs = parent.args.postgres; - connectinArgs.database = (databaseName = (connectinArgs.database != null) ? connectinArgs.database : 'meshcentral'); - - let DatastoreTest; - obj.databaseType = DB_POSTGRESQL; - const { Client } = require('pg'); - Datastore = new Client(connectinArgs); - //Connect to and check pg db first to check if own db exists. Otherwise errors out on 'database does not exist' - connectinArgs.database = 'postgres'; - DatastoreTest = new Client(connectinArgs); - DatastoreTest.connect(); - - DatastoreTest.query('SELECT 1 FROM pg_catalog.pg_database WHERE datname = $1', [databaseName], function (err, res) { // check database exists first before creating - if (res.rowCount != 0) { // database exists now check tables exists - DatastoreTest.end(); - Datastore.connect(); - Datastore.query('SELECT doc FROM main WHERE id = $1', ['DatabaseIdentifier'], function (err, res) { - if (err == null) { - (res.rowCount ==0) ? postgreSqlCreateTables(func) : setupFunctions(func) - } else - if (err.code == '42P01') { //42P01 = undefined table, https://www.postgresql.org/docs/current/errcodes-appendix.html - postgreSqlCreateTables(func); - } else { - console.log('Postgresql database exists, other error: ', err.message); process.exit(0); - }; - }); - } else { // If not present, create the tables and indexes - //not needed, just use a create db statement: const pgtools = require('pgtools'); - DatastoreTest.query('CREATE DATABASE '+ databaseName + ';', [], function (err, res) { - if (err == null) { - // Create the tables and indexes - DatastoreTest.end(); - Datastore.connect(); - postgreSqlCreateTables(func); - } else { - console.log('Postgresql database create error: ', err.message); - process.exit(0); - } + var connectinArgs = parent.args.postgres; + var dbname = (connectinArgs.database != null) ? connectinArgs.database : 'meshcentral'; + delete connectinArgs.database; + obj.databaseType = 6; + const pgtools = require('pgtools'); + pgtools.createdb(connectinArgs, dbname, function (err, res) { + const { Pool, Client } = require('pg'); + connectinArgs.database = dbname; + Datastore = new Client(connectinArgs); + Datastore.connect(); + if (err == null) { + // Database was created, create the tables + parent.debug('db', 'Creating tables...'); + sqlDbBatchExec([ + 'CREATE TABLE IF NOT EXISTS main (id VARCHAR(256) PRIMARY KEY NOT NULL, type CHAR(32), domain CHAR(64), extra CHAR(255), extraex CHAR(255), doc JSON)', + 'CREATE TABLE IF NOT EXISTS events(id SERIAL PRIMARY KEY, time TIMESTAMP, domain CHAR(64), action CHAR(255), nodeid CHAR(255), userid CHAR(255), doc JSON)', + 'CREATE TABLE IF NOT EXISTS eventids(fkid INT NOT NULL, target CHAR(255), CONSTRAINT fk_eventid FOREIGN KEY (fkid) REFERENCES events (id) ON DELETE CASCADE ON UPDATE RESTRICT)', + 'CREATE TABLE IF NOT EXISTS serverstats (time TIMESTAMP PRIMARY KEY, expire TIMESTAMP, doc JSON)', + 'CREATE TABLE IF NOT EXISTS power (id SERIAL PRIMARY KEY, time TIMESTAMP, nodeid CHAR(255), doc JSON)', + 'CREATE TABLE IF NOT EXISTS smbios (id CHAR(255) PRIMARY KEY, time TIMESTAMP, expire TIMESTAMP, doc JSON)', + 'CREATE TABLE IF NOT EXISTS plugin (id SERIAL PRIMARY KEY, doc JSON)' + ], function (results) { + parent.debug('db', 'Creating indexes...'); + sqlDbExec('CREATE INDEX ndxtypedomainextra ON main (type, domain, extra)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxextra ON main (extra)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxextraex ON main (extraex)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxeventstime ON events(time)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxeventsusername ON events(domain, userid, time)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxeventsdomainnodeidtime ON events(domain, nodeid, time)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxeventids ON eventids(target)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxserverstattime ON serverstats (time)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxserverstatexpire ON serverstats (expire)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxpowernodeidtime ON power (nodeid, time)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxsmbiostime ON smbios (time)', null, function (err, response) { }); + sqlDbExec('CREATE INDEX ndxsmbiosexpire ON smbios (expire)', null, function (err, response) { }); + setupFunctions(func); }); + } else { + // Database already existed, skip table and index creation + setupFunctions(func); } }); } else if (parent.args.mongodb) { // Use MongoDB - obj.databaseType = DB_MONGODB; - - // If running an older NodeJS version, TextEncoder/TextDecoder is required - if (global.TextEncoder == null) { global.TextEncoder = require('util').TextEncoder; } - if (global.TextDecoder == null) { global.TextDecoder = require('util').TextDecoder; } - - require('mongodb').MongoClient.connect(parent.args.mongodb, { useNewUrlParser: true, useUnifiedTopology: true, enableUtf8Validation: false }, function (err, client) { + obj.databaseType = 3; + require('mongodb').MongoClient.connect(parent.args.mongodb, { useNewUrlParser: true, useUnifiedTopology: true }, function (err, client) { if (err != null) { console.log("Unable to connect to database: " + err); process.exit(); return; } Datastore = client; parent.debug('db', 'Connected to MongoDB database...'); @@ -975,7 +754,7 @@ module.exports.CreateDB = function (parent, func) { } else { if ((info.versionArray[0] < 3) || ((info.versionArray[0] == 3) && (info.versionArray[1] < 6))) { // We are running with mongoDB older than 3.6, this is not good. - parent.addServerWarning("Current version of MongoDB (" + info.version + ") is too old, please upgrade to MongoDB 3.6 or better.", true); + parent.addServerWarning("Current version of MongoDB (" + info.version + ") is too old, please upgrade to MongoDB 3.6 or better."); } } }); @@ -1134,7 +913,7 @@ module.exports.CreateDB = function (parent, func) { }); } else if (parent.args.xmongodb) { // Use MongoJS, this is the old system. - obj.databaseType = DB_MONGOJS; + obj.databaseType = 2; Datastore = require('mongojs'); var db = Datastore(parent.args.xmongodb); var dbcollection = 'meshcentral'; @@ -1238,12 +1017,9 @@ module.exports.CreateDB = function (parent, func) { setupFunctions(func); // Completed setup of MongoJS } else { // Use NeDB (The default) - obj.databaseType = DB_NEDB; - try { Datastore = require('@seald-io/nedb'); } catch (ex) { } // This is the NeDB with Node 23 support. - if (Datastore == null) { - try { Datastore = require('@yetzt/nedb'); } catch (ex) { } // This is the NeDB with fixed security dependencies. - if (Datastore == null) { Datastore = require('nedb'); } // So not to break any existing installations, if the old NeDB is present, use it. - } + obj.databaseType = 1; + try { Datastore = require('@yetzt/nedb'); } catch (ex) { } // This is the NeDB with fixed security dependencies. + if (Datastore == null) { Datastore = require('nedb'); } // So not to break any existing installations, if the old NeDB is present, use it. var datastoreOptions = { filename: parent.getConfigFilePath('meshcentral.db'), autoload: true }; // If a DB encryption key is provided, perform database encryption @@ -1270,7 +1046,7 @@ module.exports.CreateDB = function (parent, func) { // Start NeDB main collection and setup indexes obj.file = new Datastore(datastoreOptions); - obj.file.setAutocompactionInterval(86400000); // Compact once a day + obj.file.persistence.setAutocompactionInterval(86400000); // Compact once a day obj.file.ensureIndex({ fieldName: 'type' }); obj.file.ensureIndex({ fieldName: 'domain' }); obj.file.ensureIndex({ fieldName: 'meshid', sparse: true }); @@ -1279,7 +1055,7 @@ module.exports.CreateDB = function (parent, func) { // Setup the events collection and setup indexes obj.eventsfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-events.db'), autoload: true, corruptAlertThreshold: 1 }); - obj.eventsfile.setAutocompactionInterval(86400000); // Compact once a day + obj.eventsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day obj.eventsfile.ensureIndex({ fieldName: 'ids' }); // TODO: Not sure if this is a good index, this is a array field. obj.eventsfile.ensureIndex({ fieldName: 'nodeid', sparse: true }); obj.eventsfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: expireEventsSeconds }); @@ -1287,18 +1063,18 @@ module.exports.CreateDB = function (parent, func) { // Setup the power collection and setup indexes obj.powerfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-power.db'), autoload: true, corruptAlertThreshold: 1 }); - obj.powerfile.setAutocompactionInterval(86400000); // Compact once a day + obj.powerfile.persistence.setAutocompactionInterval(86400000); // Compact once a day obj.powerfile.ensureIndex({ fieldName: 'nodeid' }); obj.powerfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: expirePowerEventsSeconds }); obj.powerfile.remove({ time: { '$lt': new Date(Date.now() - (expirePowerEventsSeconds * 1000)) } }, { multi: true }); // Force delete older events // Setup the SMBIOS collection, for NeDB we don't setup SMBIOS since NeDB will corrupt the database. Remove any existing ones. //obj.smbiosfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-smbios.db'), autoload: true, corruptAlertThreshold: 1 }); - fs.unlink(parent.getConfigFilePath('meshcentral-smbios.db'), function () { }); + parent.fs.unlink(parent.getConfigFilePath('meshcentral-smbios.db'), function () { }); // Setup the server stats collection and setup indexes obj.serverstatsfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-stats.db'), autoload: true, corruptAlertThreshold: 1 }); - obj.serverstatsfile.setAutocompactionInterval(86400000); // Compact once a day + obj.serverstatsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day obj.serverstatsfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: expireServerStatsSeconds }); obj.serverstatsfile.ensureIndex({ fieldName: 'expire', expireAfterSeconds: 0 }); // Auto-expire events obj.serverstatsfile.remove({ time: { '$lt': new Date(Date.now() - (expireServerStatsSeconds * 1000)) } }, { multi: true }); // Force delete older events @@ -1306,81 +1082,12 @@ module.exports.CreateDB = function (parent, func) { // Setup plugin info collection if (obj.pluginsActive) { obj.pluginsfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-plugins.db'), autoload: true }); - obj.pluginsfile.setAutocompactionInterval(86400000); // Compact once a day + obj.pluginsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day } setupFunctions(func); // Completed setup of NeDB } - function sqliteSetOptions(func) { - //get current auto_vacuum mode for comparison - obj.file.get('PRAGMA auto_vacuum;', function(err, current){ - let pragma = 'PRAGMA journal_mode=' + obj.sqliteConfig.journalMode + ';' + - 'PRAGMA synchronous='+ obj.sqliteConfig.synchronous + ';' + - 'PRAGMA journal_size_limit=' + obj.sqliteConfig.journalSize + ';' + - 'PRAGMA auto_vacuum=' + obj.sqliteConfig.autoVacuum + ';' + - 'PRAGMA incremental_vacuum=' + obj.sqliteConfig.incrementalVacuum + ';' + - 'PRAGMA optimize=0x10002;'; - //check new autovacuum mode, if changing from or to 'none', a VACUUM needs to be done to activate it. See https://www.sqlite.org/pragma.html#pragma_auto_vacuum - if ( obj.sqliteConfig.startupVacuum - || (current.auto_vacuum == 0 && obj.sqliteConfig.autoVacuum !='none') - || (current.auto_vacuum != 0 && obj.sqliteConfig.autoVacuum =='none')) - { - pragma += 'VACUUM;'; - }; - parent.debug ('db', 'Config statement: ' + pragma); - - obj.file.exec( pragma, - function (err) { - if (err) { parent.debug('db', 'Config pragma error: ' + (err.message)) }; - sqliteGetPragmas(['journal_mode', 'journal_size_limit', 'freelist_count', 'auto_vacuum', 'page_size', 'wal_autocheckpoint', 'synchronous'], function (pragma, pragmaValue) { - parent.debug('db', 'PRAGMA: ' + pragma + '=' + pragmaValue); - }); - }); - }); - //setupFunctions(func); - } - - function sqliteGetPragmas (pragmas, func){ - //pragmas can only be gotting one by one - pragmas.forEach (function (pragma) { - obj.file.get('PRAGMA ' + pragma + ';', function(err, res){ - if (pragma == 'auto_vacuum') { res[pragma] = SQLITE_AUTOVACUUM[res[pragma]] }; - if (pragma == 'synchronous') { res[pragma] = SQLITE_SYNCHRONOUS[res[pragma]] }; - if (func) { func (pragma, res[pragma]); } - }); - }); - } - // Create the PostgreSQL tables - function postgreSqlCreateTables(func) { - // Database was created, create the tables - parent.debug('db', 'Creating tables...'); - sqlDbBatchExec([ - 'CREATE TABLE IF NOT EXISTS main (id VARCHAR(256) PRIMARY KEY NOT NULL, type CHAR(32), domain CHAR(64), extra CHAR(255), extraex CHAR(255), doc JSON)', - 'CREATE TABLE IF NOT EXISTS events(id SERIAL PRIMARY KEY, time TIMESTAMP, domain CHAR(64), action CHAR(255), nodeid CHAR(255), userid CHAR(255), doc JSON)', - 'CREATE TABLE IF NOT EXISTS eventids(fkid INT NOT NULL, target CHAR(255), CONSTRAINT fk_eventid FOREIGN KEY (fkid) REFERENCES events (id) ON DELETE CASCADE ON UPDATE RESTRICT)', - 'CREATE TABLE IF NOT EXISTS serverstats (time TIMESTAMP PRIMARY KEY, expire TIMESTAMP, doc JSON)', - 'CREATE TABLE IF NOT EXISTS power (id SERIAL PRIMARY KEY, time TIMESTAMP, nodeid CHAR(255), doc JSON)', - 'CREATE TABLE IF NOT EXISTS smbios (id CHAR(255) PRIMARY KEY, time TIMESTAMP, expire TIMESTAMP, doc JSON)', - 'CREATE TABLE IF NOT EXISTS plugin (id SERIAL PRIMARY KEY, doc JSON)' - ], function (results) { - parent.debug('db', 'Creating indexes...'); - sqlDbExec('CREATE INDEX ndxtypedomainextra ON main (type, domain, extra)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxextra ON main (extra)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxextraex ON main (extraex)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxeventstime ON events(time)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxeventsusername ON events(domain, userid, time)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxeventsdomainnodeidtime ON events(domain, nodeid, time)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxeventids ON eventids(target)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxserverstattime ON serverstats (time)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxserverstatexpire ON serverstats (expire)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxpowernodeidtime ON power (nodeid, time)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxsmbiostime ON smbios (time)', null, function (err, response) { }); - sqlDbExec('CREATE INDEX ndxsmbiosexpire ON smbios (expire)', null, function (err, response) { }); - setupFunctions(func); - }); - } - // Check the object names for a "." function checkObjectNames(r, tag) { if (typeof r != 'object') return; @@ -1391,82 +1098,39 @@ module.exports.CreateDB = function (parent, func) { } // Query the database - function sqlDbQuery(query, args, func, debug) { - if (obj.databaseType == DB_SQLITE) { // SQLite - if (args == null) { args = []; } - obj.file.all(query, args, function (err, docs) { - if (err != null) { console.log(query, args, err, docs); } - if (docs != null) { - for (var i in docs) { - if (typeof docs[i].doc == 'string') { - try { docs[i] = JSON.parse(docs[i].doc); } catch (ex) { - console.log(query, args, docs[i]); - } - } - } - } - if (func) { func(err, docs); } - }); - } else if (obj.databaseType == DB_MARIADB) { // MariaDB + function sqlDbQuery(query, args, func) { + if (obj.databaseType == 4) { // MariaDB Datastore.getConnection() .then(function (conn) { conn.query(query, args) .then(function (rows) { conn.release(); - var docs = []; - for (var i in rows) { - if (rows[i].doc) { - docs.push(performTypedRecordDecrypt((typeof rows[i].doc == 'object') ? rows[i].doc : JSON.parse(rows[i].doc))); - } else if ((rows.length == 1) && (rows[i]['COUNT(doc)'] != null)) { - // This is a SELECT COUNT() operation - docs = parseInt(rows[i]['COUNT(doc)']); - } - } + const docs = []; + for (var i in rows) { if (rows[i].doc) { docs.push(performTypedRecordDecrypt((typeof rows[i].doc == 'object') ? rows[i].doc : JSON.parse(rows[i].doc))); } } if (func) try { func(null, docs); } catch (ex) { console.log('SQLERR1', ex); } }) .catch(function (err) { conn.release(); if (func) try { func(err); } catch (ex) { console.log('SQLERR2', ex); } }); }).catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log('SQLERR3', ex); } } }); - } else if (obj.databaseType == DB_MYSQL) { // MySQL + } else if (obj.databaseType == 5) { // MySQL Datastore.query(query, args, function (error, results, fields) { if (error != null) { if (func) try { func(error); } catch (ex) { console.log('SQLERR4', ex); } } else { var docs = []; - for (var i in results) { - if (results[i].doc) { - if (typeof results[i].doc == 'string') { - docs.push(JSON.parse(results[i].doc)); - } else { - docs.push(results[i].doc); - } - } else if ((results.length == 1) && (results[i]['COUNT(doc)'] != null)) { - // This is a SELECT COUNT() operation - docs = results[i]['COUNT(doc)']; - } - } + for (var i in results) { if (results[i].doc) { docs.push(JSON.parse(results[i].doc)); } } if (func) { try { func(null, docs); } catch (ex) { console.log('SQLERR5', ex); } } } }); - } else if (obj.databaseType == DB_POSTGRESQL) { // Postgres SQL + } else if (obj.databaseType == 6) { // Postgres SQL Datastore.query(query, args, function (error, results) { if (error != null) { + console.log(query, args, error); if (func) try { func(error); } catch (ex) { console.log('SQLERR4', ex); } } else { var docs = []; if ((results.command == 'INSERT') && (results.rows != null) && (results.rows.length == 1)) { docs = results.rows[0]; } else if (results.command == 'SELECT') { - for (var i in results.rows) { - if (results.rows[i].doc) { - if (typeof results.rows[i].doc == 'string') { - docs.push(JSON.parse(results.rows[i].doc)); - } else { - docs.push(results.rows[i].doc); - } - } else if (results.rows[i].count && (results.rows.length == 1)) { - // This is a SELECT COUNT() operation - docs = parseInt(results.rows[i].count); - } - } + for (var i in results.rows) { if (results.rows[i].doc) { if (typeof results.rows[i].doc == 'string') { docs.push(JSON.parse(results.rows[i].doc)); } else { docs.push(results.rows[i].doc); } } } } if (func) { try { func(null, docs, results); } catch (ex) { console.log('SQLERR5', ex); } } } @@ -1476,7 +1140,7 @@ module.exports.CreateDB = function (parent, func) { // Exec on the database function sqlDbExec(query, args, func) { - if (obj.databaseType == DB_MARIADB) { // MariaDB + if (obj.databaseType == 4) { // MariaDB Datastore.getConnection() .then(function (conn) { conn.query(query, args) @@ -1486,7 +1150,7 @@ module.exports.CreateDB = function (parent, func) { }) .catch(function (err) { conn.release(); if (func) try { func(err); } catch (ex) { console.log(ex); } }); }).catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log(ex); } } }); - } else if ((obj.databaseType == DB_MYSQL) || (obj.databaseType == DB_POSTGRESQL)) { // MySQL or Postgres SQL + } else if ((obj.databaseType == 5) || (obj.databaseType == 6)) { // MySQL or Postgres SQL Datastore.query(query, args, function (error, results, fields) { if (func) try { func(error, results ? results[0] : null); } catch (ex) { console.log(ex); } }); @@ -1495,7 +1159,7 @@ module.exports.CreateDB = function (parent, func) { // Execute a batch of commands on the database function sqlDbBatchExec(queries, func) { - if (obj.databaseType == DB_MARIADB) { // MariaDB + if (obj.databaseType == 4) { // MariaDB Datastore.getConnection() .then(function (conn) { var Promises = []; @@ -1505,16 +1169,7 @@ module.exports.CreateDB = function (parent, func) { .catch(function (err) { conn.release(); if (func) { try { func(err); } catch (ex) { console.log(ex); } } }); }) .catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log(ex); } } }); - } else if (obj.databaseType == DB_MYSQL) { // MySQL - Datastore.getConnection(function(err, connection) { - if (err) { if (func) { try { func(err); } catch (ex) { console.log(ex); } } return; } - var Promises = []; - for (var i in queries) { if (typeof queries[i] == 'string') { Promises.push(connection.promise().query(queries[i])); } else { Promises.push(connection.promise().query(queries[i][0], queries[i][1])); } } - Promise.all(Promises) - .then(function (error, results, fields) { connection.release(); if (func) { try { func(error, results); } catch (ex) { console.log(ex); } } }) - .catch(function (error, results, fields) { connection.release(); if (func) { try { func(error); } catch (ex) { console.log(ex); } } }); - }); - } else if (obj.databaseType == DB_POSTGRESQL) { // Postgres + } else if ((obj.databaseType == 5) || (obj.databaseType == 6)) { // MySQL var Promises = []; for (var i in queries) { if (typeof queries[i] == 'string') { Promises.push(Datastore.query(queries[i])); } else { Promises.push(Datastore.query(queries[i][0], queries[i][1])); } } Promise.all(Promises) @@ -1524,625 +1179,7 @@ module.exports.CreateDB = function (parent, func) { } function setupFunctions(func) { - if (obj.databaseType == DB_SQLITE) { - // Database actions on the main collection. SQLite3: https://www.linode.com/docs/guides/getting-started-with-nodejs-sqlite/ - obj.Set = function (value, func) { - obj.dbCounters.fileSet++; - var extra = null, extraex = null; - value = common.escapeLinksFieldNameEx(value); - if (value.meshid) { extra = value.meshid; } else if (value.email) { extra = 'email/' + value.email; } else if (value.nodeid) { extra = value.nodeid; } - if ((value.type == 'node') && (value.intelamt != null) && (value.intelamt.uuid != null)) { extraex = 'uuid/' + value.intelamt.uuid; } - if (value._id == null) { value._id = require('crypto').randomBytes(16).toString('hex'); } - sqlDbQuery('INSERT INTO main VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (id) DO UPDATE SET type = $2, domain = $3, extra = $4, extraex = $5, doc = $6;', [value._id, (value.type ? value.type : null), ((value.domain != null) ? value.domain : null), extra, extraex, JSON.stringify(performTypedRecordEncrypt(value))], func); - } - obj.SetRaw = function (value, func) { - obj.dbCounters.fileSet++; - var extra = null, extraex = null; - if (value.meshid) { extra = value.meshid; } else if (value.email) { extra = 'email/' + value.email; } else if (value.nodeid) { extra = value.nodeid; } - if ((value.type == 'node') && (value.intelamt != null) && (value.intelamt.uuid != null)) { extraex = 'uuid/' + value.intelamt.uuid; } - if (value._id == null) { value._id = require('crypto').randomBytes(16).toString('hex'); } - sqlDbQuery('INSERT INTO main VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (id) DO UPDATE SET type = $2, domain = $3, extra = $4, extraex = $5, doc = $6;', [value._id, (value.type ? value.type : null), ((value.domain != null) ? value.domain : null), extra, extraex, JSON.stringify(performTypedRecordEncrypt(value))], func); - } - obj.Get = function (_id, func) { - sqlDbQuery('SELECT doc FROM main WHERE id = $1', [_id], function (err, docs) { - if ((docs != null) && (docs.length > 0)) { for (var i in docs) { if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.GetAll = function (func) { - sqlDbQuery('SELECT domain, doc FROM main', null, function (err, docs) { - if ((docs != null) && (docs.length > 0)) { for (var i in docs) { if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.GetHash = function (id, func) { - sqlDbQuery('SELECT doc FROM main WHERE id = $1', [id], function (err, docs) { - if ((docs != null) && (docs.length > 0)) { for (var i in docs) { if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.GetAllTypeNoTypeField = function (type, domain, func) { - sqlDbQuery('SELECT doc FROM main WHERE type = $1 AND domain = $2', [type, domain], function (err, docs) { - if ((docs != null) && (docs.length > 0)) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - }; - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) { - if (limit == 0) { limit = -1; } // In SQLite, no limit is -1 - if (id && (id != '')) { - sqlDbQuery('SELECT doc FROM main WHERE (id = $1) AND (type = $2) AND (domain = $3) AND (extra IN (' + dbMergeSqlArray(meshes) + ')) LIMIT $4 OFFSET $5', [id, type, domain, limit, skip], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } else { - if (extrasids == null) { - sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND (extra IN (' + dbMergeSqlArray(meshes) + ')) LIMIT $3 OFFSET $4', [type, domain, limit, skip], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } else { - sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND ((extra IN (' + dbMergeSqlArray(meshes) + ')) OR (id IN (' + dbMergeSqlArray(extrasids) + '))) LIMIT $3 OFFSET $4', [type, domain, limit, skip], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - } - }; - obj.CountAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { - if (id && (id != '')) { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE (id = $1) AND (type = $2) AND (domain = $3) AND (extra IN (' + dbMergeSqlArray(meshes) + '))', [id, type, domain], function (err, docs) { - func(err, (err == null) ? docs[0]['COUNT(doc)'] : null); - }); - } else { - if (extrasids == null) { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE (type = $1) AND (domain = $2) AND (extra IN (' + dbMergeSqlArray(meshes) + '))', [type, domain], function (err, docs) { - func(err, (err == null) ? docs[0]['COUNT(doc)'] : null); - }); - } else { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE (type = $1) AND (domain = $2) AND ((extra IN (' + dbMergeSqlArray(meshes) + ')) OR (id IN (' + dbMergeSqlArray(extrasids) + ')))', [type, domain], function (err, docs) { - func(err, (err == null) ? docs[0]['COUNT(doc)'] : null); - }); - } - } - }; - obj.GetAllTypeNodeFiltered = function (nodes, domain, type, id, func) { - if (id && (id != '')) { - sqlDbQuery('SELECT doc FROM main WHERE (id = $1) AND (type = $2) AND (domain = $3) AND (extra IN (' + dbMergeSqlArray(nodes) + '))', [id, type, domain], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } else { - sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND (extra IN (' + dbMergeSqlArray(nodes) + '))', [type, domain], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - }; - obj.GetAllType = function (type, func) { - sqlDbQuery('SELECT doc FROM main WHERE type = $1', [type], function (err, docs) { - if (docs != null) { for (var i in docs) { if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.GetAllIdsOfType = function (ids, domain, type, func) { - sqlDbQuery('SELECT doc FROM main WHERE (id IN (' + dbMergeSqlArray(ids) + ')) AND domain = $1 AND type = $2', [domain, type], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.GetUserWithEmail = function (domain, email, func) { - sqlDbQuery('SELECT doc FROM main WHERE domain = $1 AND extra = $2', [domain, 'email/' + email], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.GetUserWithVerifiedEmail = function (domain, email, func) { - sqlDbQuery('SELECT doc FROM main WHERE domain = $1 AND extra = $2', [domain, 'email/' + email], function (err, docs) { - if (docs != null) { for (var i in docs) { delete docs[i].type; if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, performTypedRecordDecrypt(docs)); - }); - } - obj.Remove = function (id, func) { sqlDbQuery('DELETE FROM main WHERE id = $1', [id], func); }; - obj.RemoveAll = function (func) { sqlDbQuery('DELETE FROM main', null, func); }; - obj.RemoveAllOfType = function (type, func) { sqlDbQuery('DELETE FROM main WHERE type = $1', [type], func); }; - obj.InsertMany = function (data, func) { var pendingOps = 0; for (var i in data) { pendingOps++; obj.SetRaw(data[i], function () { if (--pendingOps == 0) { func(); } }); } }; // Insert records directly, no link escaping - obj.RemoveMeshDocuments = function (id, func) { sqlDbQuery('DELETE FROM main WHERE extra = $1', [id], function () { sqlDbQuery('DELETE FROM main WHERE id = $1', ['nt' + id], func); }); }; - obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }; - obj.DeleteDomain = function (domain, func) { sqlDbQuery('DELETE FROM main WHERE domain = $1', [domain], func); }; - obj.SetUser = function (user) { if (user == null) return; if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; - obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }; - obj.getLocalAmtNodes = function (func) { - sqlDbQuery('SELECT doc FROM main WHERE (type = \'node\') AND (extraex IS NULL)', null, function (err, docs) { - if (docs != null) { for (var i in docs) { if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - var r = []; if (err == null) { for (var i in docs) { if (docs[i].host != null && docs[i].intelamt != null) { r.push(docs[i]); } } } func(err, r); - }); - }; - obj.getAmtUuidMeshNode = function (domainid, mtype, uuid, func) { - sqlDbQuery('SELECT doc FROM main WHERE domain = $1 AND extraex = $2', [domainid, 'uuid/' + uuid], function (err, docs) { - if (docs != null) { for (var i in docs) { if (docs[i].links != null) { docs[i] = common.unEscapeLinksFieldName(docs[i]); } } } - func(err, docs); - }); - }; - obj.isMaxType = function (max, type, domainid, func) { if (max == null) { func(false); } else { sqlDbExec('SELECT COUNT(id) FROM main WHERE domain = $1 AND type = $2', [domainid, type], function (err, response) { func((response['COUNT(id)'] == null) || (response['COUNT(id)'] > max), response['COUNT(id)']) }); } } - - // Database actions on the events collection - obj.GetAllEvents = function (func) { - sqlDbQuery('SELECT doc FROM events', null, func); - }; - obj.StoreEvent = function (event, func) { - obj.dbCounters.eventsSet++; - sqlDbQuery('INSERT INTO events VALUES (NULL, $1, $2, $3, $4, $5, $6) RETURNING id', [event.time, ((typeof event.domain == 'string') ? event.domain : null), event.action, event.nodeid ? event.nodeid : null, event.userid ? event.userid : null, JSON.stringify(event)], function (err, docs) { - if(func){ func(); } - if ((err == null) && (docs[0].id)) { - for (var i in event.ids) { - if (event.ids[i] != '*') { - obj.pendingTransfer++; - sqlDbQuery('INSERT INTO eventids VALUES ($1, $2)', [docs[0].id, event.ids[i]], function(){ if(func){ func(); } }); - } - } - } - }); - }; - obj.GetEvents = function (ids, domain, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain]; - if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1"; - if (filter != null) { - query = query + " AND action = $2"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC"; - } else { - query = query + 'JOIN eventids ON id = fkid WHERE (domain = $1 AND (target IN (' + dbMergeSqlArray(ids) + '))'; - if (filter != null) { - query = query + " AND action = $2"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC "; - } - sqlDbQuery(query, dataarray, func); - }; - obj.GetEventsWithLimit = function (ids, domain, limit, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain]; - if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1"; - if (filter != null) { - query = query + " AND action = $2) ORDER BY time DESC LIMIT $3"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $2"; - } - } else { - query = query + "JOIN eventids ON id = fkid WHERE (domain = $1 AND (target IN (" + dbMergeSqlArray(ids) + "))"; - if (filter != null) { - query = query + " AND action = $2) GROUP BY id ORDER BY time DESC LIMIT $3"; - dataarray.push(filter); - } else { - query = query + ") GROUP BY id ORDER BY time DESC LIMIT $2"; - } - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; - obj.GetUserEvents = function (ids, domain, userid, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain, userid]; - if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1 AND userid = $2"; - if (filter != null) { - query = query + " AND action = $3"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC"; - } else { - query = query + 'JOIN eventids ON id = fkid WHERE (domain = $1 AND userid = $2 AND (target IN (' + dbMergeSqlArray(ids) + '))'; - if (filter != null) { - query = query + " AND action = $3"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC"; - } - sqlDbQuery(query, dataarray, func); - }; - obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain, userid]; - if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1 AND userid = $2"; - if (filter != null) { - query = query + " AND action = $3) ORDER BY time DESC LIMIT $4"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $3"; - } - } else { - query = query + "JOIN eventids ON id = fkid WHERE (domain = $1 AND userid = $2 AND (target IN (" + dbMergeSqlArray(ids) + "))"; - if (filter != null) { - query = query + " AND action = $3) GROUP BY id ORDER BY time DESC LIMIT $4"; - dataarray.push(filter); - } else { - query = query + ") GROUP BY id ORDER BY time DESC LIMIT $3"; - } - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; - obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) { - if (ids.indexOf('*') >= 0) { - sqlDbQuery('SELECT doc FROM events WHERE ((domain = $1) AND (time BETWEEN $2 AND $3)) ORDER BY time', [domain, start, end], func); - } else { - sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE ((domain = $1) AND (target IN (' + dbMergeSqlArray(ids) + ')) AND (time BETWEEN $2 AND $3)) GROUP BY id ORDER BY time', [domain, start, end], func); - } - }; - //obj.GetUserLoginEvents = function (domain, userid, func) { } // TODO - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, filter, func) { - var query = "SELECT doc FROM events WHERE (nodeid = $1 AND domain = $2"; - var dataarray = [nodeid, domain]; - if (filter != null) { - query = query + " AND action = $3) ORDER BY time DESC LIMIT $4"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $3"; - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; - obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, filter, func) { - var query = "SELECT doc FROM events WHERE (nodeid = $1) AND (domain = $2) AND ((userid = $3) OR (userid IS NULL)) "; - var dataarray = [nodeid, domain, userid]; - if (filter != null) { - query = query + "AND (action = $4) ORDER BY time DESC LIMIT $5"; - dataarray.push(filter); - } else { - query = query + "ORDER BY time DESC LIMIT $4"; - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; - obj.RemoveAllEvents = function (domain) { sqlDbQuery('DELETE FROM events', null, function (err, docs) { }); }; - obj.RemoveAllNodeEvents = function (domain, nodeid) { if ((domain == null) || (nodeid == null)) return; sqlDbQuery('DELETE FROM events WHERE domain = $1 AND nodeid = $2', [domain, nodeid], function (err, docs) { }); }; - obj.RemoveAllUserEvents = function (domain, userid) { if ((domain == null) || (userid == null)) return; sqlDbQuery('DELETE FROM events WHERE domain = $1 AND userid = $2', [domain, userid], function (err, docs) { }); }; - obj.GetFailedLoginCount = function (userid, domainid, lastlogin, func) { sqlDbQuery('SELECT COUNT(*) FROM events WHERE action = \'authfail\' AND domain = $1 AND userid = $2 AND time > $3', [domainid, userid, lastlogin], function (err, response) { func(err == null ? response[0]['COUNT(*)'] : 0); }); } - - // Database actions on the power collection - obj.getAllPower = function (func) { sqlDbQuery('SELECT doc FROM power', null, func); }; - obj.storePowerEvent = function (event, multiServer, func) { obj.dbCounters.powerSet++; if (multiServer != null) { event.server = multiServer.serverid; } sqlDbQuery('INSERT INTO power VALUES (NULL, $1, $2, $3)', [event.time, event.nodeid ? event.nodeid : null, JSON.stringify(event)], func); }; - obj.getPowerTimeline = function (nodeid, func) { sqlDbQuery('SELECT doc FROM power WHERE ((nodeid = $1) OR (nodeid = \'*\')) ORDER BY time ASC', [nodeid], func); }; - obj.removeAllPowerEvents = function () { sqlDbQuery('DELETE FROM power', null, function (err, docs) { }); }; - obj.removeAllPowerEventsForNode = function (nodeid) { if (nodeid == null) return; sqlDbQuery('DELETE FROM power WHERE nodeid = $1', [nodeid], function (err, docs) { }); }; - - // Database actions on the SMBIOS collection - obj.GetAllSMBIOS = function (func) { sqlDbQuery('SELECT doc FROM smbios', null, func); }; - obj.SetSMBIOS = function (smbios, func) { var expire = new Date(smbios.time); expire.setMonth(expire.getMonth() + 6); sqlDbQuery('INSERT INTO smbios VALUES ($1, $2, $3, $4) ON CONFLICT (id) DO UPDATE SET time = $2, expire = $3, doc = $4', [smbios._id, smbios.time, expire, JSON.stringify(smbios)], func); }; - obj.RemoveSMBIOS = function (id) { sqlDbQuery('DELETE FROM smbios WHERE id = $1', [id], function (err, docs) { }); }; - obj.GetSMBIOS = function (id, func) { sqlDbQuery('SELECT doc FROM smbios WHERE id = $1', [id], func); }; - - // Database actions on the Server Stats collection - obj.SetServerStats = function (data, func) { sqlDbQuery('INSERT INTO serverstats VALUES ($1, $2, $3) ON CONFLICT (time) DO UPDATE SET expire = $2, doc = $3', [data.time, data.expire, JSON.stringify(data)], func); }; - obj.GetServerStats = function (hours, func) { var t = new Date(); t.setTime(t.getTime() - (60 * 60 * 1000 * hours)); sqlDbQuery('SELECT doc FROM serverstats WHERE time > $1', [t], func); }; // TODO: Expire old entries - - // Read a configuration file from the database - obj.getConfigFile = function (path, func) { obj.Get('cfile/' + path, func); } - - // Write a configuration file to the database - obj.setConfigFile = function (path, data, func) { obj.Set({ _id: 'cfile/' + path, type: 'cfile', data: data.toString('base64') }, func); } - - // List all configuration files - obj.listConfigFiles = function (func) { sqlDbQuery('SELECT doc FROM main WHERE type = "cfile" ORDER BY id', func); } - - // Get database information (TODO: Complete this) - obj.getDbStats = function (func) { - obj.stats = { c: 4 }; - sqlDbQuery('SELECT COUNT(*) FROM main', null, function (err, response) { obj.stats.meshcentral = (err == null ? response[0]['COUNT(*)'] : 0); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - sqlDbQuery('SELECT COUNT(*) FROM serverstats', null, function (err, response) { obj.stats.serverstats = (err == null ? response[0]['COUNT(*)'] : 0); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - sqlDbQuery('SELECT COUNT(*) FROM power', null, function (err, response) { obj.stats.power = (err == null ? response[0]['COUNT(*)'] : 0); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - sqlDbQuery('SELECT COUNT(*) FROM smbios', null, function (err, response) { obj.stats.smbios = (err == null ? response[0]['COUNT(*)'] : 0); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - } - - // Plugin operations - if (obj.pluginsActive) { - obj.addPlugin = function (plugin, func) { sqlDbQuery('INSERT INTO plugin VALUES (NULL, $1)', [JSON.stringify(plugin)], func); }; // Add a plugin - obj.getPlugins = function (func) { sqlDbQuery('SELECT JSON_INSERT(doc, "$._id", id) as doc FROM plugin', null, func); }; // Get all plugins - obj.getPlugin = function (id, func) { sqlDbQuery('SELECT JSON_INSERT(doc, "$._id", id) as doc FROM plugin WHERE id = $1', [id], func); }; // Get plugin - obj.deletePlugin = function (id, func) { sqlDbQuery('DELETE FROM plugin WHERE id = $1', [id], func); }; // Delete plugin - obj.setPluginStatus = function (id, status, func) { sqlDbQuery('UPDATE plugin SET doc=JSON_SET(doc,"$.status",$1) WHERE id=$2', [status,id], func); }; - obj.updatePlugin = function (id, args, func) { delete args._id; sqlDbQuery('UPDATE plugin SET doc=json_patch(doc,$1) WHERE id=$2', [JSON.stringify(args),id], func); }; - } - } else if (obj.databaseType == DB_ACEBASE) { - // Database actions on the main collection. AceBase: https://github.com/appy-one/acebase - obj.Set = function (data, func) { - data = common.escapeLinksFieldNameEx(data); - var xdata = performTypedRecordEncrypt(data); - obj.dbCounters.fileSet++; - obj.file.ref('meshcentral').child(encodeURIComponent(xdata._id)).set(common.aceEscapeFieldNames(xdata)).then(function (ref) { if (func) { func(); } }) - }; - obj.Get = function (id, func) { - obj.file.ref('meshcentral').child(encodeURIComponent(id)).get(function (snapshot) { - if (snapshot.exists()) { func(null, performTypedRecordDecrypt([common.aceUnEscapeFieldNames(snapshot.val())])); } else { func(null, []); } - }); - }; - obj.GetAll = function (func) { - obj.file.ref('meshcentral').get(function(snapshot) { - const val = snapshot.val(); - const docs = Object.keys(val).map(function(key) { return val[key]; }); - func(null, common.aceUnEscapeAllFieldNames(docs)); - }); - }; - obj.GetHash = function (id, func) { - obj.file.ref('meshcentral').child(encodeURIComponent(id)).get({ include: ['hash'] }, function (snapshot) { - if (snapshot.exists()) { func(null, snapshot.val()); } else { func(null, null); } - }); - }; - obj.GetAllTypeNoTypeField = function (type, domain, func) { - obj.file.query('meshcentral').filter('type', '==', type).filter('domain', '==', domain).get({ exclude: ['type'] }, function (snapshots) { - const docs = []; - for (var i in snapshots) { const x = snapshots[i].val(); docs.push(x); } - func(null, common.aceUnEscapeAllFieldNames(docs)); - }); - } - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) { - if (meshes.length == 0) { func(null, []); return; } - var query = obj.file.query('meshcentral').skip(skip).take(limit).filter('type', '==', type).filter('domain', '==', domain); - if (id) { query = query.filter('_id', '==', id); } - if (extrasids == null) { - query = query.filter('meshid', 'in', meshes); - query.get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); - } else { - // TODO: This is a slow query as we did not find a filter-or-filter, so we query everything and filter manualy. - query.get(function (snapshots) { - const docs = []; - for (var i in snapshots) { const x = snapshots[i].val(); if ((extrasids.indexOf(x._id) >= 0) || (meshes.indexOf(x.meshid) >= 0)) { docs.push(x); } } - func(null, performTypedRecordDecrypt(docs)); - }); - } - }; - obj.GetAllTypeNodeFiltered = function (nodes, domain, type, id, func) { - var query = obj.file.query('meshcentral').filter('type', '==', type).filter('domain', '==', domain).filter('nodeid', 'in', nodes); - if (id) { query = query.filter('_id', '==', id); } - query.get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); - }; - obj.GetAllType = function (type, func) { - obj.file.query('meshcentral').filter('type', '==', type).get(function (snapshots) { - const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } - func(null, common.aceUnEscapeAllFieldNames(performTypedRecordDecrypt(docs))); - }); - }; - obj.GetAllIdsOfType = function (ids, domain, type, func) { obj.file.query('meshcentral').filter('_id', 'in', ids).filter('domain', '==', domain).filter('type', '==', type).get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); }; - obj.GetUserWithEmail = function (domain, email, func) { obj.file.query('meshcentral').filter('type', '==', 'user').filter('domain', '==', domain).filter('email', '==', email).get({ exclude: ['type'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); }; - obj.GetUserWithVerifiedEmail = function (domain, email, func) { obj.file.query('meshcentral').filter('type', '==', 'user').filter('domain', '==', domain).filter('email', '==', email).filter('emailVerified', '==', true).get({ exclude: ['type'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); }; - obj.Remove = function (id, func) { obj.file.ref('meshcentral').child(encodeURIComponent(id)).remove().then(function () { if (func) { func(); } }); }; - obj.RemoveAll = function (func) { obj.file.query('meshcentral').remove().then(function () { if (func) { func(); } }); }; - obj.RemoveAllOfType = function (type, func) { obj.file.query('meshcentral').filter('type', '==', type).remove().then(function () { if (func) { func(); } }); }; - obj.InsertMany = function (data, func) { var r = {}; for (var i in data) { const ref = obj.file.ref('meshcentral').child(encodeURIComponent(data[i]._id)); r[ref.key] = common.aceEscapeFieldNames(data[i]); } obj.file.ref('meshcentral').set(r).then(function (ref) { func(); }); }; // Insert records directly, no link escaping - obj.RemoveMeshDocuments = function (id) { obj.file.query('meshcentral').filter('meshid', '==', id).remove(); obj.file.ref('meshcentral').child(encodeURIComponent('nt' + id)).remove(); }; - obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }; - obj.DeleteDomain = function (domain, func) { obj.file.query('meshcentral').filter('domain', '==', domain).remove().then(function () { if (func) { func(); } }); }; - obj.SetUser = function (user) { if (user == null) return; if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; - obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }; - obj.getLocalAmtNodes = function (func) { obj.file.query('meshcentral').filter('type', '==', 'node').filter('host', 'exists').filter('host', '!=', null).filter('intelamt', 'exists').get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); }; - obj.getAmtUuidMeshNode = function (domainid, mtype, uuid, func) { obj.file.query('meshcentral').filter('type', '==', 'node').filter('domain', '==', domainid).filter('mtype', '!=', mtype).filter('intelamt.uuid', '==', uuid).get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, performTypedRecordDecrypt(docs)); }); }; - obj.isMaxType = function (max, type, domainid, func) { if (max == null) { func(false); } else { obj.file.query('meshcentral').filter('type', '==', type).filter('domain', '==', domainid).get({ snapshots: false }, function (snapshots) { func((snapshots.length > max), snapshots.length); }); } } - - // Database actions on the events collection - obj.GetAllEvents = function (func) { - obj.file.ref('events').get(function (snapshot) { - const val = snapshot.val(); - const docs = Object.keys(val).map(function(key) { return val[key]; }); - func(null, docs); - }) - }; - obj.StoreEvent = function (event, func) { - if (typeof event.account == 'object') { event = Object.assign({}, event); event.account = common.aceEscapeFieldNames(event.account); } - obj.dbCounters.eventsSet++; - obj.file.ref('events').push(event).then(function (userRef) { if (func) { func(); } }); - }; - obj.GetEvents = function (ids, domain, filter, func) { - // This request is slow since we have not found a .filter() that will take two arrays and match a single item. - if (filter != null) { - obj.file.query('events').filter('domain', '==', domain).filter('action', '==', filter).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type'] }, function (snapshots) { - const docs = []; - for (var i in snapshots) { - const doc = snapshots[i].val(); - if ((doc.ids == null) || (!Array.isArray(doc.ids))) continue; - var found = false; - for (var j in doc.ids) { if (ids.indexOf(doc.ids[j]) >= 0) { found = true; } } // Check if one of the items in both arrays matches - if (found) { delete doc.ids; if (typeof doc.account == 'object') { doc.account = common.aceUnEscapeFieldNames(doc.account); } docs.push(doc); } - } - func(null, docs); - }); - } else { - obj.file.query('events').filter('domain', '==', domain).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type'] }, function (snapshots) { - const docs = []; - for (var i in snapshots) { - const doc = snapshots[i].val(); - if ((doc.ids == null) || (!Array.isArray(doc.ids))) continue; - var found = false; - for (var j in doc.ids) { if (ids.indexOf(doc.ids[j]) >= 0) { found = true; } } // Check if one of the items in both arrays matches - if (found) { delete doc.ids; if (typeof doc.account == 'object') { doc.account = common.aceUnEscapeFieldNames(doc.account); } docs.push(doc); } - } - func(null, docs); - }); - } - }; - obj.GetEventsWithLimit = function (ids, domain, limit, filter, func) { - // This request is slow since we have not found a .filter() that will take two arrays and match a single item. - // TODO: Request a new AceBase feature for a 'array:contains-one-of' filter: - // obj.file.indexes.create('events', 'ids', { type: 'array' }); - // db.query('events').filter('ids', 'array:contains-one-of', ids) - if (filter != null) { - obj.file.query('events').filter('domain', '==', domain).filter('action', '==', filter).take(limit).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type'] }, function (snapshots) { - const docs = []; - for (var i in snapshots) { - const doc = snapshots[i].val(); - if ((doc.ids == null) || (!Array.isArray(doc.ids))) continue; - var found = false; - for (var j in doc.ids) { if (ids.indexOf(doc.ids[j]) >= 0) { found = true; } } // Check if one of the items in both arrays matches - if (found) { delete doc.ids; if (typeof doc.account == 'object') { doc.account = common.aceUnEscapeFieldNames(doc.account); } docs.push(doc); } - } - func(null, docs); - }); - } else { - obj.file.query('events').filter('domain', '==', domain).take(limit).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type'] }, function (snapshots) { - const docs = []; - for (var i in snapshots) { - const doc = snapshots[i].val(); - if ((doc.ids == null) || (!Array.isArray(doc.ids))) continue; - var found = false; - for (var j in doc.ids) { if (ids.indexOf(doc.ids[j]) >= 0) { found = true; } } // Check if one of the items in both arrays matches - if (found) { delete doc.ids; if (typeof doc.account == 'object') { doc.account = common.aceUnEscapeFieldNames(doc.account); } docs.push(doc); } - } - func(null, docs); - }); - } - }; - obj.GetUserEvents = function (ids, domain, userid, filter, func) { - if (filter != null) { - obj.file.query('events').filter('domain', '==', domain).filter('userid', 'in', userid).filter('ids', 'in', ids).filter('action', '==', filter).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type', 'ids'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } else { - obj.file.query('events').filter('domain', '==', domain).filter('userid', 'in', userid).filter('ids', 'in', ids).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type', 'ids'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } - }; - obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, filter, func) { - if (filter != null) { - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('userid', 'in', userid).filter('ids', 'in', ids).filter('action', '==', filter).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type', 'ids'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } else { - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('userid', 'in', userid).filter('ids', 'in', ids).sort('time', false).get({ exclude: ['_id', 'domain', 'node', 'type', 'ids'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } - }; - obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) { - obj.file.query('events').filter('domain', '==', domain).filter('ids', 'in', ids).filter('msgid', 'in', msgids).filter('time', 'between', [start, end]).sort('time', false).get({ exclude: ['type', '_id', 'domain', 'node'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - }; - obj.GetUserLoginEvents = function (domain, userid, func) { - obj.file.query('events').filter('domain', '==', domain).filter('action', 'in', ['authfail', 'login']).filter('userid', '==', userid).filter('msgArgs', 'exists').sort('time', false).get({ include: ['action', 'time', 'msgid', 'msgArgs', 'tokenName'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - }; - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, filter, func) { - if (filter != null) { - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('nodeid', '==', nodeid).filter('action', '==', filter).sort('time', false).get({ exclude: ['type', 'etype', '_id', 'domain', 'ids', 'node', 'nodeid'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } else { - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('nodeid', '==', nodeid).sort('time', false).get({ exclude: ['type', 'etype', '_id', 'domain', 'ids', 'node', 'nodeid'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } - }; - obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, filter, func) { - if (filter != null) { - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('nodeid', '==', nodeid).filter('userid', '==', userid).filter('action', '==', filter).sort('time', false).get({ exclude: ['type', 'etype', '_id', 'domain', 'ids', 'node', 'nodeid'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } else { - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('nodeid', '==', nodeid).filter('userid', '==', userid).sort('time', false).get({ exclude: ['type', 'etype', '_id', 'domain', 'ids', 'node', 'nodeid'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - } - obj.file.query('events').take(limit).filter('domain', '==', domain).filter('nodeid', '==', nodeid).filter('userid', '==', userid).sort('time', false).get({ exclude: ['type', 'etype', '_id', 'domain', 'ids', 'node', 'nodeid'] }, function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - }; - obj.RemoveAllEvents = function (domain) { - obj.file.query('events').filter('domain', '==', domain).remove().then(function () { if (func) { func(); } });; - }; - obj.RemoveAllNodeEvents = function (domain, nodeid) { - if ((domain == null) || (nodeid == null)) return; - obj.file.query('events').filter('domain', '==', domain).filter('nodeid', '==', nodeid).remove().then(function () { if (func) { func(); } });; - }; - obj.RemoveAllUserEvents = function (domain, userid) { - if ((domain == null) || (userid == null)) return; - obj.file.query('events').filter('domain', '==', domain).filter('userid', '==', userid).remove().then(function () { if (func) { func(); } });; - }; - obj.GetFailedLoginCount = function (userid, domainid, lastlogin, func) { - obj.file.query('events').filter('domain', '==', domainid).filter('userid', '==', userid).filter('time', '>', lastlogin).sort('time', false).get({ snapshots: false }, function (snapshots) { func(null, snapshots.length); }); - } - - // Database actions on the power collection - obj.getAllPower = function (func) { - obj.file.ref('power').get(function (snapshot) { - const val = snapshot.val(); - const docs = Object.keys(val).map(function(key) { return val[key]; }); - func(null, docs); - }); - }; - obj.storePowerEvent = function (event, multiServer, func) { - if (multiServer != null) { event.server = multiServer.serverid; } - obj.file.ref('power').push(event).then(function (userRef) { if (func) { func(); } }); - }; - obj.getPowerTimeline = function (nodeid, func) { - obj.file.query('power').filter('nodeid', 'in', ['*', nodeid]).sort('time').get({ exclude: ['_id', 'nodeid', 's'] }, function (snapshots) { - const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); - }); - }; - obj.removeAllPowerEvents = function () { - obj.file.ref('power').remove().then(function () { if (func) { func(); } }); - }; - obj.removeAllPowerEventsForNode = function (nodeid) { - if (nodeid == null) return; - obj.file.query('power').filter('nodeid', '==', nodeid).remove().then(function () { if (func) { func(); } }); - }; - - // Database actions on the SMBIOS collection - if (obj.smbiosfile != null) { - obj.GetAllSMBIOS = function (func) { - obj.file.ref('smbios').get(function (snapshot) { - const val = snapshot.val(); - const docs = Object.keys(val).map(function(key) { return val[key]; }); - func(null, docs); - }); - }; - obj.SetSMBIOS = function (smbios, func) { - obj.file.ref('meshcentral/' + encodeURIComponent(smbios._id)).set(smbios).then(function (ref) { if (func) { func(); } }) - }; - obj.RemoveSMBIOS = function (id) { - obj.file.query('smbios').filter('_id', '==', id).remove().then(function () { if (func) { func(); } }); - }; - obj.GetSMBIOS = function (id, func) { - obj.file.query('smbios').filter('_id', '==', id).get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); - }; - } - - // Database actions on the Server Stats collection - obj.SetServerStats = function (data, func) { - obj.file.ref('stats').push(data).then(function (userRef) { if (func) { func(); } }); - }; - obj.GetServerStats = function (hours, func) { - var t = new Date(); - t.setTime(t.getTime() - (60 * 60 * 1000 * hours)); - obj.file.query('stats').filter('time', '>', t).get({ exclude: ['_id', 'cpu'] }, function (snapshots) { - const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); - }); - }; - - // Read a configuration file from the database - obj.getConfigFile = function (path, func) { obj.Get('cfile/' + path, func); } - - // Write a configuration file to the database - obj.setConfigFile = function (path, data, func) { obj.Set({ _id: 'cfile/' + path, type: 'cfile', data: data.toString('base64') }, func); } - - // List all configuration files - obj.listConfigFiles = function (func) { - obj.file.query('meshcentral').filter('type', '==', 'cfile').sort('_id').get(function (snapshots) { - const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); - }); - } - - // Get database information - obj.getDbStats = function (func) { - obj.stats = { c: 5 }; - obj.file.ref('meshcentral').count().then(function (count) { obj.stats.meshcentral = count; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - obj.file.ref('events').count().then(function (count) { obj.stats.events = count; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - obj.file.ref('power').count().then(function (count) { obj.stats.power = count; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - obj.file.ref('smbios').count().then(function (count) { obj.stats.smbios = count; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - obj.file.ref('stats').count().then(function (count) { obj.stats.serverstats = count; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - } - - // Plugin operations - if (obj.pluginsActive) { - obj.addPlugin = function (plugin, func) { plugin.type = 'plugin'; obj.file.ref('plugin').child(encodeURIComponent(plugin._id)).set(plugin).then(function (ref) { if (func) { func(); } }) }; // Add a plugin - obj.getPlugins = function (func) { - obj.file.ref('plugin').get({ exclude: ['type'] }, function (snapshot) { - const val = snapshot.val(); - const docs = Object.keys(val).map(function(key) { return val[key]; }).sort(function(a, b) { return a.name < b.name ? -1 : 1 }); - func(null, docs); - }); - }; // Get all plugins - obj.getPlugin = function (id, func) { obj.file.query('plugin').filter('_id', '==', id).get(function (snapshots) { const docs = []; for (var i in snapshots) { docs.push(snapshots[i].val()); } func(null, docs); }); }; // Get plugin - obj.deletePlugin = function (id, func) { obj.file.ref('plugin').child(encodeURIComponent(id)).remove().then(function () { if (func) { func(); } }); }; // Delete plugin - obj.setPluginStatus = function (id, status, func) { obj.file.ref('plugin').child(encodeURIComponent(id)).update({ status: status }).then(function (ref) { if (func) { func(); } }) }; - obj.updatePlugin = function (id, args, func) { delete args._id; obj.file.ref('plugin').child(encodeURIComponent(id)).set(args).then(function (ref) { if (func) { func(); } }) }; - } - } else if (obj.databaseType == DB_POSTGRESQL) { + if (obj.databaseType == 6) { // Database actions on the main collection (Postgres) obj.Set = function (value, func) { obj.dbCounters.fileSet++; @@ -2165,26 +1202,14 @@ module.exports.CreateDB = function (parent, func) { obj.GetAll = function (func) { sqlDbQuery('SELECT domain, doc FROM main', null, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } obj.GetHash = function (id, func) { sqlDbQuery('SELECT doc FROM main WHERE id = $1', [id], function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } obj.GetAllTypeNoTypeField = function (type, domain, func) { sqlDbQuery('SELECT doc FROM main WHERE type = $1 AND domain = $2', [type, domain], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); }; - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) { - if (limit == 0) { limit = 0xFFFFFFFF; } + obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { if (id && (id != '')) { - sqlDbQuery('SELECT doc FROM main WHERE (id = $1) AND (type = $2) AND (domain = $3) AND (extra = ANY ($4)) LIMIT $5 OFFSET $6', [id, type, domain, meshes, limit, skip], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); + sqlDbQuery('SELECT doc FROM main WHERE (id = $1) AND (type = $2) AND (domain = $3) AND (extra = ANY ($4))', [id, type, domain, meshes], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); } else { if (extrasids == null) { - sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND (extra = ANY ($3)) LIMIT $4 OFFSET $5', [type, domain, meshes, limit, skip], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }, true); + sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND (extra = ANY ($3))', [type, domain, meshes], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }, true); } else { - sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND ((extra = ANY ($3)) OR (id = ANY ($4))) LIMIT $5 OFFSET $6', [type, domain, meshes, extrasids, limit, skip], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); - } - } - }; - obj.CountAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { - if (id && (id != '')) { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE (id = $1) AND (type = $2) AND (domain = $3) AND (extra = ANY ($4))', [id, type, domain, meshes], function (err, docs) { func(err, docs); }); - } else { - if (extrasids == null) { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE (type = $1) AND (domain = $2) AND (extra = ANY ($3))', [type, domain, meshes], function (err, docs) { func(err, docs); }, true); - } else { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE (type = $1) AND (domain = $2) AND ((extra = ANY ($3)) OR (id = ANY ($4)))', [type, domain, meshes, extrasids], function (err, docs) { func(err, docs); }); + sqlDbQuery('SELECT doc FROM main WHERE (type = $1) AND (domain = $2) AND ((extra = ANY ($3)) OR (id = ANY ($4)))', [type, domain, meshes, extrasids], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); } } }; @@ -2206,9 +1231,9 @@ module.exports.CreateDB = function (parent, func) { obj.RemoveMeshDocuments = function (id, func) { sqlDbQuery('DELETE FROM main WHERE extra = $1', [id], function () { sqlDbQuery('DELETE FROM main WHERE id = $1', ['nt' + id], func); }); }; obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }; obj.DeleteDomain = function (domain, func) { sqlDbQuery('DELETE FROM main WHERE domain = $1', [domain], func); }; - obj.SetUser = function (user) { if (user == null) return; if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; + obj.SetUser = function (user) { if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }; - obj.getLocalAmtNodes = function (func) { sqlDbQuery('SELECT doc FROM main WHERE (type = \'node\') AND (extraex IS NULL)', null, function (err, docs) { var r = []; if (err == null) { for (var i in docs) { if (docs[i].host != null && docs[i].intelamt != null) { r.push(docs[i]); } } } func(err, r); }); }; + obj.getLocalAmtNodes = function (func) { sqlDbQuery('SELECT doc FROM main WHERE (type = \'node\') AND (extraex IS NOT NULL)', null, function (err, docs) { var r = []; if (err == null) { for (var i in docs) { if (docs[i].host != null) { r.push(docs[i]); } } } func(err, r); }); }; obj.getAmtUuidMeshNode = function (domainid, mtype, uuid, func) { sqlDbQuery('SELECT doc FROM main WHERE domain = $1 AND extraex = $2', [domainid, 'uuid/' + uuid], func); }; obj.isMaxType = function (max, type, domainid, func) { if (max == null) { func(false); } else { sqlDbExec('SELECT COUNT(id) FROM main WHERE domain = $1 AND type = $2', [domainid, type], function (err, response) { func((response['COUNT(id)'] == null) || (response['COUNT(id)'] > max), response['COUNT(id)']) }); } } @@ -2217,109 +1242,36 @@ module.exports.CreateDB = function (parent, func) { obj.StoreEvent = function (event, func) { obj.dbCounters.eventsSet++; sqlDbQuery('INSERT INTO events VALUES (DEFAULT, $1, $2, $3, $4, $5, $6) RETURNING id', [event.time, ((typeof event.domain == 'string') ? event.domain : null), event.action, event.nodeid ? event.nodeid : null, event.userid ? event.userid : null, event], function (err, docs) { - if(func){ func(); } - if (docs.id) { - for (var i in event.ids) { - if (event.ids[i] != '*') { - obj.pendingTransfer++; - sqlDbQuery('INSERT INTO eventids VALUES ($1, $2)', [docs.id, event.ids[i]], function(){ if(func){ func(); } }); - } - } - } + if (docs.id) { for (var i in event.ids) { if (event.ids[i] != '*') { sqlDbQuery('INSERT INTO eventids VALUES ($1, $2)', [docs.id, event.ids[i]]); } } } }); }; - obj.GetEvents = function (ids, domain, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain]; + obj.GetEvents = function (ids, domain, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1"; - if (filter != null) { - query = query + " AND action = $2"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events WHERE (domain = $1) ORDER BY time DESC', [domain], func); } else { - query = query + "JOIN eventids ON id = fkid WHERE (domain = $1 AND (target = ANY ($2))"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = $3"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = $1 AND (target = ANY ($2))) GROUP BY id ORDER BY time DESC', [domain, ids], func); } - sqlDbQuery(query, dataarray, func); }; - obj.GetEventsWithLimit = function (ids, domain, limit, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain]; + obj.GetEventsWithLimit = function (ids, domain, limit, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1"; - if (filter != null) { - query = query + " AND action = $2) ORDER BY time DESC LIMIT $3"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $2"; - } + sqlDbQuery('SELECT doc FROM events WHERE (domain = $1) ORDER BY time DESC LIMIT $2', [domain, limit], func); } else { - if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = $1 AND (target = ANY ($2))"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = $3) ORDER BY time DESC LIMIT $4"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $3"; - } + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = $1 AND (target = ANY ($2))) GROUP BY id ORDER BY time DESC LIMIT $3', [domain, ids, limit], func); } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); }; - obj.GetUserEvents = function (ids, domain, userid, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain, userid]; + obj.GetUserEvents = function (ids, domain, userid, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1 AND userid = $2"; - if (filter != null) { - query = query + " AND action = $3"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events WHERE (domain = $1 AND userid = $2) ORDER BY time DESC', [domain, userid], func); } else { - if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = $1 AND userid = $2 AND (target = ANY ($3))"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = $4"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = $1 AND userid = $2 AND (target = ANY ($3))) GROUP BY id ORDER BY time DESC', [domain, userid, ids], func); } - sqlDbQuery(query, dataarray, func); }; - obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain, userid]; + obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = $1 AND userid = $2"; - if (filter != null) { - query = query + " AND action = $3) ORDER BY time DESC LIMIT $4 "; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $3"; - } + sqlDbQuery('SELECT doc FROM events WHERE (domain = $1 AND userid = $2) ORDER BY time DESC LIMIT $3', [domain, userid, limit], func); } else { - if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = $1 AND userid = $2 AND (target = ANY ($3))"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = $4) GROUP BY id ORDER BY time DESC LIMIT $5"; - dataarray.push(filter); - } else { - query = query + ") GROUP BY id ORDER BY time DESC LIMIT $4"; - } + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = $1 AND userid = $2 AND (target = ANY ($3))) GROUP BY id ORDER BY time DESC LIMIT $4', [domain, userid, ids, limit], func); } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); }; obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) { if (ids.indexOf('*') >= 0) { @@ -2329,30 +1281,8 @@ module.exports.CreateDB = function (parent, func) { } }; //obj.GetUserLoginEvents = function (domain, userid, func) { } // TODO - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, filter, func) { - var query = "SELECT doc FROM events WHERE (nodeid = $1 AND domain = $2"; - var dataarray = [nodeid, domain]; - if (filter != null) { - query = query + " AND action = $3) ORDER BY time DESC LIMIT $4"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $3"; - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; - obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, filter, func) { - var query = "SELECT doc FROM events WHERE (nodeid = $1 AND domain = $2 AND ((userid = $3) OR (userid IS NULL))"; - var dataarray = [nodeid, domain, userid]; - if (filter != null) { - query = query + " AND action = $4) ORDER BY time DESC LIMIT $5"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT $4"; - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; + obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, func) { sqlDbQuery('SELECT doc FROM events WHERE (nodeid = $1) AND (domain = $2) ORDER BY time DESC LIMIT $3', [nodeid, domain, limit], func); }; + obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, func) { sqlDbQuery('SELECT doc FROM events WHERE (nodeid = $1) AND (domain = $2) AND ((userid = $3) OR (userid IS NULL)) ORDER BY time DESC LIMIT $4', [nodeid, domain, userid, limit], func); }; obj.RemoveAllEvents = function (domain) { sqlDbQuery('DELETE FROM events', null, function (err, docs) { }); }; obj.RemoveAllNodeEvents = function (domain, nodeid) { if ((domain == null) || (nodeid == null)) return; sqlDbQuery('DELETE FROM events WHERE domain = $1 AND nodeid = $2', [domain, nodeid], function (err, docs) { }); }; obj.RemoveAllUserEvents = function (domain, userid) { if ((domain == null) || (userid == null)) return; sqlDbQuery('DELETE FROM events WHERE domain = $1 AND userid = $2', [domain, userid], function (err, docs) { }); }; @@ -2384,6 +1314,20 @@ module.exports.CreateDB = function (parent, func) { // List all configuration files obj.listConfigFiles = function (func) { sqlDbQuery('SELECT doc FROM main WHERE type = "cfile" ORDER BY id', func); } + // Get all configuration files + obj.getAllConfigFiles = function (password, func) { + obj.file.find({ type: 'cfile' }).toArray(function (err, docs) { + if (err != null) { func(null); return; } + var r = null; + for (var i = 0; i < docs.length; i++) { + var name = docs[i]._id.split('/')[1]; + var data = obj.decryptData(password, docs[i].data); + if (data != null) { if (r == null) { r = {}; } r[name] = data; } + } + func(r); + }); + } + // Get database information (TODO: Complete this) obj.getDbStats = function (func) { obj.stats = { c: 4 }; @@ -2395,14 +1339,14 @@ module.exports.CreateDB = function (parent, func) { // Plugin operations if (obj.pluginsActive) { - obj.addPlugin = function (plugin, func) { sqlDbQuery('INSERT INTO plugin VALUES (DEFAULT, $1)', [plugin], func); }; // Add a plugin - obj.getPlugins = function (func) { sqlDbQuery("SELECT doc::jsonb || ('{\"_id\":' || plugin.id || '}')::jsonb as doc FROM plugin", null, func); }; // Get all plugins - obj.getPlugin = function (id, func) { sqlDbQuery("SELECT doc::jsonb || ('{\"_id\":' || plugin.id || '}')::jsonb as doc FROM plugin WHERE id = $1", [id], func); }; // Get plugin + obj.addPlugin = function (plugin, func) { sqlDbQuery('INSERT INTO plugin VALUES (DEFAULT, $2)', [value], func); }; // Add a plugin + obj.getPlugins = function (func) { sqlDbQuery('SELECT doc FROM plugin', null, func); }; // Get all plugins + obj.getPlugin = function (id, func) { sqlDbQuery('SELECT doc FROM plugin WHERE id = $1', [id], func); }; // Get plugin obj.deletePlugin = function (id, func) { sqlDbQuery('DELETE FROM plugin WHERE id = $1', [id], func); }; // Delete plugin - obj.setPluginStatus = function (id, status, func) { sqlDbQuery("UPDATE plugin SET doc= jsonb_set(doc::jsonb,'{status}',$1) WHERE id=$2", [status,id], func); }; - obj.updatePlugin = function (id, args, func) { delete args._id; sqlDbQuery('UPDATE plugin SET doc= doc::jsonb || ($1) WHERE id=$2', [args,id], func); }; + obj.setPluginStatus = function (id, status, func) { obj.getPlugin(id, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].status = status; obj.updatePlugin(id, docs[0], func); } }); }; + obj.updatePlugin = function (id, args, func) { delete args._id; sqlDbQuery('INSERT INTO plugin VALUES ($1, $2) ON CONFLICT (id) DO UPDATE SET doc = $2', [id, args], func); }; } - } else if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL)) { + } else if ((obj.databaseType == 4) || (obj.databaseType == 5)) { // Database actions on the main collection (MariaDB or MySQL) obj.Set = function (value, func) { obj.dbCounters.fileSet++; @@ -2425,23 +1369,13 @@ module.exports.CreateDB = function (parent, func) { obj.GetAll = function (func) { sqlDbQuery('SELECT domain, doc FROM main', null, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } obj.GetHash = function (id, func) { sqlDbQuery('SELECT doc FROM main WHERE id = ?', [id], function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } obj.GetAllTypeNoTypeField = function (type, domain, func) { sqlDbQuery('SELECT doc FROM main WHERE type = ? AND domain = ?', [type, domain], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); }; - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) { - if (limit == 0) { limit = 0xFFFFFFFF; } + obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { if ((meshes == null) || (meshes.length == 0)) { meshes = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. if ((extrasids == null) || (extrasids.length == 0)) { extrasids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. if (id && (id != '')) { - sqlDbQuery('SELECT doc FROM main WHERE id = ? AND type = ? AND domain = ? AND extra IN (?) LIMIT ? OFFSET ?', [id, type, domain, meshes, limit, skip], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); + sqlDbQuery('SELECT doc FROM main WHERE id = ? AND type = ? AND domain = ? AND extra IN (?)', [id, type, domain, meshes], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); } else { - sqlDbQuery('SELECT doc FROM main WHERE type = ? AND domain = ? AND (extra IN (?) OR id IN (?)) LIMIT ? OFFSET ?', [type, domain, meshes, extrasids, limit, skip], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); - } - }; - obj.CountAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { - if ((meshes == null) || (meshes.length == 0)) { meshes = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - if ((extrasids == null) || (extrasids.length == 0)) { extrasids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - if (id && (id != '')) { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE id = ? AND type = ? AND domain = ? AND extra IN (?)', [id, type, domain, meshes], function (err, docs) { func(err, docs); }); - } else { - sqlDbQuery('SELECT COUNT(doc) FROM main WHERE type = ? AND domain = ? AND (extra IN (?) OR id IN (?))', [type, domain, meshes, extrasids], function (err, docs) { func(err, docs); }); + sqlDbQuery('SELECT doc FROM main WHERE type = ? AND domain = ? AND (extra IN (?) OR id IN (?))', [type, domain, meshes, extrasids], function (err, docs) { if (err == null) { for (var i in docs) { delete docs[i].type } } func(err, performTypedRecordDecrypt(docs)); }); } }; obj.GetAllTypeNodeFiltered = function (nodes, domain, type, id, func) { @@ -2466,9 +1400,9 @@ module.exports.CreateDB = function (parent, func) { obj.RemoveMeshDocuments = function (id, func) { sqlDbQuery('DELETE FROM main WHERE extra = ?', [id], function () { sqlDbQuery('DELETE FROM main WHERE id = ?', ['nt' + id], func); } ); }; obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }; obj.DeleteDomain = function (domain, func) { sqlDbQuery('DELETE FROM main WHERE domain = ?', [domain], func); }; - obj.SetUser = function (user) { if (user == null) return; if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; + obj.SetUser = function (user) { if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }; - obj.getLocalAmtNodes = function (func) { sqlDbQuery('SELECT doc FROM main WHERE (type = "node") AND (extraex IS NULL)', null, function (err, docs) { var r = []; if (err == null) { for (var i in docs) { if (docs[i].host != null && docs[i].intelamt != null) { r.push(docs[i]); } } } func(err, r); }); }; + obj.getLocalAmtNodes = function (func) { sqlDbQuery('SELECT doc FROM main WHERE (type = "node") AND (extraex IS NOT NULL)', null, function (err, docs) { var r = []; if (err == null) { for (var i in docs) { if (docs[i].host != null) { r.push(docs[i]); } } } func(err, r); }); }; obj.getAmtUuidMeshNode = function (domainid, mtype, uuid, func) { sqlDbQuery('SELECT doc FROM main WHERE domain = ? AND extraex = ?', [domainid, 'uuid/' + uuid], func); }; obj.isMaxType = function (max, type, domainid, func) { if (max == null) { func(false); } else { sqlDbExec('SELECT COUNT(id) FROM main WHERE domain = ? AND type = ?', [domainid, type], function (err, response) { func((response['COUNT(id)'] == null) || (response['COUNT(id)'] > max), response['COUNT(id)']) }); } } @@ -2480,95 +1414,37 @@ module.exports.CreateDB = function (parent, func) { for (var i in event.ids) { if (event.ids[i] != '*') { batchQuery.push(['INSERT INTO eventids VALUE (LAST_INSERT_ID(), ?)', [event.ids[i]]]); } } sqlDbBatchExec(batchQuery, function (err, docs) { if (func != null) { func(err, docs); } }); }; - obj.GetEvents = function (ids, domain, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain]; + obj.GetEvents = function (ids, domain, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = ?"; - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events WHERE (domain = ?) ORDER BY time DESC', [domain], func); } else { if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = ? AND target IN (?)"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = ? AND target IN (?)) GROUP BY id ORDER BY time DESC', [domain, ids], func); } - sqlDbQuery(query, dataarray, func); }; - obj.GetEventsWithLimit = function (ids, domain, limit, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain]; + obj.GetEventsWithLimit = function (ids, domain, limit, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = ?"; - if (filter != null) { - query = query + " AND action = ? "; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC LIMIT ?"; + sqlDbQuery('SELECT doc FROM events WHERE (domain = ?) ORDER BY time DESC LIMIT ?', [domain, limit], func); } else { if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = ? AND target IN (?)"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC LIMIT ?"; + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = ? AND target IN (?)) GROUP BY id ORDER BY time DESC LIMIT ?', [domain, ids, limit], func); } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); }; - obj.GetUserEvents = function (ids, domain, userid, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain, userid]; + obj.GetUserEvents = function (ids, domain, userid, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = ? AND userid = ?"; - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events WHERE (domain = ? AND userid = ?) ORDER BY time DESC', [domain, userid], func); } else { if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = ? AND userid = ? AND target IN (?)"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC"; + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = ? AND userid = ? AND target IN (?)) GROUP BY id ORDER BY time DESC', [domain, userid, ids], func); } - sqlDbQuery(query, dataarray, func); }; - obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, filter, func) { - var query = "SELECT doc FROM events "; - var dataarray = [domain, userid]; + obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, func) { if (ids.indexOf('*') >= 0) { - query = query + "WHERE (domain = ? AND userid = ?"; - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") ORDER BY time DESC LIMIT ?"; + sqlDbQuery('SELECT doc FROM events WHERE (domain = ? AND userid = ?) ORDER BY time DESC LIMIT ?', [domain, userid, limit], func); } else { if (ids.length == 0) { ids = ''; } // MySQL can't handle a query with IN() on an empty array, we have to use an empty string instead. - query = query + "JOIN eventids ON id = fkid WHERE (domain = ? AND userid = ? AND target IN (?)"; - dataarray.push(ids); - if (filter != null) { - query = query + " AND action = ?"; - dataarray.push(filter); - } - query = query + ") GROUP BY id ORDER BY time DESC LIMIT ?"; + sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE (domain = ? AND userid = ? AND target IN (?)) GROUP BY id ORDER BY time DESC LIMIT ?', [domain, userid, ids, limit], func); } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); }; obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) { if (ids.indexOf('*') >= 0) { @@ -2579,30 +1455,8 @@ module.exports.CreateDB = function (parent, func) { } }; //obj.GetUserLoginEvents = function (domain, userid, func) { } // TODO - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, filter, func) { - var query = "SELECT doc FROM events WHERE (nodeid = ? AND domain = ?"; - var dataarray = [nodeid, domain]; - if (filter != null) { - query = query + " AND action = ?) ORDER BY time DESC LIMIT ?"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT ?"; - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; - obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, filter, func) { - var query = "SELECT doc FROM events WHERE (nodeid = ? AND domain = ? AND ((userid = ?) OR (userid IS NULL))"; - var dataarray = [nodeid, domain, userid]; - if (filter != null) { - query = query + " AND action = ?) ORDER BY time DESC LIMIT ?"; - dataarray.push(filter); - } else { - query = query + ") ORDER BY time DESC LIMIT ?"; - } - dataarray.push(limit); - sqlDbQuery(query, dataarray, func); - }; + obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, func) { sqlDbQuery('SELECT doc FROM events WHERE (nodeid = ?) AND (domain = ?) ORDER BY time DESC LIMIT ?', [nodeid, domain, limit], func); }; + obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, func) { sqlDbQuery('SELECT doc FROM events WHERE (nodeid = ?) AND (domain = ?) AND ((userid = ?) OR (userid IS NULL)) ORDER BY time DESC LIMIT ?', [nodeid, domain, userid, limit], func); }; obj.RemoveAllEvents = function (domain) { sqlDbQuery('DELETE FROM events', null, function (err, docs) { }); }; obj.RemoveAllNodeEvents = function (domain, nodeid) { if ((domain == null) || (nodeid == null)) return; sqlDbQuery('DELETE FROM events WHERE domain = ? AND nodeid = ?', [domain, nodeid], function (err, docs) { }); }; obj.RemoveAllUserEvents = function (domain, userid) { if ((domain == null) || (userid == null)) return; sqlDbQuery('DELETE FROM events WHERE domain = ? AND userid = ?', [domain, userid], function (err, docs) { }); }; @@ -2633,26 +1487,40 @@ module.exports.CreateDB = function (parent, func) { // List all configuration files obj.listConfigFiles = function (func) { sqlDbQuery('SELECT doc FROM main WHERE type = "cfile" ORDER BY id', func); } + + // Get all configuration files + obj.getAllConfigFiles = function (password, func) { + obj.file.find({ type: 'cfile' }).toArray(function (err, docs) { + if (err != null) { func(null); return; } + var r = null; + for (var i = 0; i < docs.length; i++) { + var name = docs[i]._id.split('/')[1]; + var data = obj.decryptData(password, docs[i].data); + if (data != null) { if (r == null) { r = {}; } r[name] = data; } + } + func(r); + }); + } // Get database information (TODO: Complete this) obj.getDbStats = function (func) { obj.stats = { c: 4 }; - sqlDbExec('SELECT COUNT(id) FROM main', null, function (err, response) { obj.stats.meshcentral = Number(response['COUNT(id)']); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - sqlDbExec('SELECT COUNT(time) FROM serverstats', null, function (err, response) { obj.stats.serverstats = Number(response['COUNT(time)']); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - sqlDbExec('SELECT COUNT(id) FROM power', null, function (err, response) { obj.stats.power = Number(response['COUNT(id)']); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); - sqlDbExec('SELECT COUNT(id) FROM smbios', null, function (err, response) { obj.stats.smbios = Number(response['COUNT(id)']); if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + sqlDbExec('SELECT COUNT(id) FROM main', null, function (err, response) { obj.stats.meshcentral = response['COUNT(id)']; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + sqlDbExec('SELECT COUNT(time) FROM serverstats', null, function (err, response) { obj.stats.serverstats = response['COUNT(time)']; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + sqlDbExec('SELECT COUNT(id) FROM power', null, function (err, response) { obj.stats.power = response['COUNT(id)']; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + sqlDbExec('SELECT COUNT(id) FROM smbios', null, function (err, response) { obj.stats.smbios = response['COUNT(id)']; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); } // Plugin operations if (obj.pluginsActive) { - obj.addPlugin = function (plugin, func) { sqlDbQuery('INSERT INTO plugin VALUE (?, ?)', [null, JSON.stringify(plugin)], func); }; // Add a plugin - obj.getPlugins = function (func) { sqlDbQuery('SELECT JSON_INSERT(doc, "$._id", id) as doc FROM plugin', null, func); }; // Get all plugins - obj.getPlugin = function (id, func) { sqlDbQuery('SELECT JSON_INSERT(doc, "$._id", id) as doc FROM plugin WHERE id = ?', [id], func); }; // Get plugin + obj.addPlugin = function (plugin, func) { sqlDbQuery('INSERT INTO plugin VALUE (?, ?)', [null, JSON.stringify(value)], func); }; // Add a plugin + obj.getPlugins = function (func) { sqlDbQuery('SELECT doc FROM plugin', null, func); }; // Get all plugins + obj.getPlugin = function (id, func) { sqlDbQuery('SELECT doc FROM plugin WHERE id = ?', [id], func); }; // Get plugin obj.deletePlugin = function (id, func) { sqlDbQuery('DELETE FROM plugin WHERE id = ?', [id], func); }; // Delete plugin - obj.setPluginStatus = function (id, status, func) { sqlDbQuery('UPDATE meshcentral.plugin SET doc=JSON_SET(doc,"$.status",?) WHERE id=?', [status,id], func); }; - obj.updatePlugin = function (id, args, func) { delete args._id; sqlDbQuery('UPDATE meshcentral.plugin SET doc=JSON_MERGE_PATCH(doc,?) WHERE id=?', [JSON.stringify(args),id], func); }; + obj.setPluginStatus = function (id, status, func) { obj.getPlugin(id, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].status = status; obj.updatePlugin(id, docs[0], func); } }); }; + obj.updatePlugin = function (id, args, func) { delete args._id; sqlDbQuery('REPLACE INTO plugin VALUE (?, ?)', [id, JSON.stringify(args)], func); }; } - } else if (obj.databaseType == DB_MONGODB) { + } else if (obj.databaseType == 3) { // Database actions on the main collection (MongoDB) // Bulk operations @@ -2731,34 +1599,15 @@ module.exports.CreateDB = function (parent, func) { obj.GetAll = function (func) { obj.file.find({}).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); }; obj.GetHash = function (id, func) { obj.file.find({ _id: id }).project({ _id: 0, hash: 1 }).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); }; obj.GetAllTypeNoTypeField = function (type, domain, func) { obj.file.find({ type: type, domain: domain }).project({ type: 0 }).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); }; - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) { + obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { if (extrasids == null) { - const x = { type: type, domain: domain, meshid: { $in: meshes } }; + var x = { type: type, domain: domain, meshid: { $in: meshes } }; if (id) { x._id = id; } - var f = obj.file.find(x, { type: 0 }); - if (skip > 0) f = f.skip(skip); // Skip records - if (limit > 0) f = f.limit(limit); // Limit records - f.toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); + obj.file.find(x, { type: 0 }).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } else { - const x = { type: type, domain: domain, $or: [ { meshid: { $in: meshes } }, { _id: { $in: extrasids } } ] }; + var x = { type: type, domain: domain, $or: [ { meshid: { $in: meshes } }, { _id: { $in: extrasids } } ] }; if (id) { x._id = id; } - var f = obj.file.find(x, { type: 0 }); - if (skip > 0) f = f.skip(skip); // Skip records - if (limit > 0) f = f.limit(limit); // Limit records - f.toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); - } - }; - obj.CountAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { - if (extrasids == null) { - const x = { type: type, domain: domain, meshid: { $in: meshes } }; - if (id) { x._id = id; } - var f = obj.file.find(x, { type: 0 }); - f.count(function (err, count) { func(err, count); }); - } else { - const x = { type: type, domain: domain, $or: [{ meshid: { $in: meshes } }, { _id: { $in: extrasids } }] }; - if (id) { x._id = id; } - var f = obj.file.find(x, { type: 0 }); - f.count(function (err, count) { func(err, count); }); + obj.file.find(x, { type: 0 }).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } }; obj.GetAllTypeNodeFiltered = function (nodes, domain, type, id, func) { @@ -2797,7 +1646,7 @@ module.exports.CreateDB = function (parent, func) { obj.RemoveMeshDocuments = function (id) { obj.file.deleteMany({ meshid: id }, { multi: true }); obj.file.deleteOne({ _id: 'nt' + id }); }; obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }; obj.DeleteDomain = function (domain, func) { obj.file.deleteMany({ domain: domain }, { multi: true }, func); }; - obj.SetUser = function (user) { if (user == null) return; if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; + obj.SetUser = function (user) { if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }; obj.getLocalAmtNodes = function (func) { obj.file.find({ type: 'node', host: { $exists: true, $ne: null }, intelamt: { $exists: true } }).toArray(func); }; obj.getAmtUuidMeshNode = function (domainid, mtype, uuid, func) { obj.file.find({ type: 'node', domain: domainid, mtype: mtype, 'intelamt.uuid': uuid }).toArray(func); }; @@ -2837,38 +1686,14 @@ module.exports.CreateDB = function (parent, func) { obj.StoreEvent = function (event, func) { obj.dbCounters.eventsSet++; obj.eventsfile.insertOne(event, func); }; } - obj.GetEvents = function (ids, domain, filter, func) { - var finddata = { domain: domain, ids: { $in: ids } }; - if (filter != null) finddata.action = filter; - obj.eventsfile.find(finddata).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).toArray(func); - }; - obj.GetEventsWithLimit = function (ids, domain, limit, filter, func) { - var finddata = { domain: domain, ids: { $in: ids } }; - if (filter != null) finddata.action = filter; - obj.eventsfile.find(finddata).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).toArray(func); - }; - obj.GetUserEvents = function (ids, domain, userid, filter, func) { - var finddata = { domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }; - if (filter != null) finddata.action = filter; - obj.eventsfile.find(finddata).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).toArray(func); - }; - obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, filter, func) { - var finddata = { domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }; - if (filter != null) finddata.action = filter; - obj.eventsfile.find(finddata).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).toArray(func); - }; + obj.GetEvents = function (ids, domain, func) { obj.eventsfile.find({ domain: domain, ids: { $in: ids } }).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).toArray(func); }; + obj.GetEventsWithLimit = function (ids, domain, limit, func) { obj.eventsfile.find({ domain: domain, ids: { $in: ids } }).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).toArray(func); }; + obj.GetUserEvents = function (ids, domain, userid, func) { obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).toArray(func); }; + obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, func) { obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }).project({ type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).toArray(func); }; obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) { obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }], msgid: { $in: msgids }, time: { $gte: start, $lte: end } }).project({ type: 0, _id: 0, domain: 0, node: 0 }).sort({ time: 1 }).toArray(func); }; obj.GetUserLoginEvents = function (domain, userid, func) { obj.eventsfile.find({ domain: domain, action: { $in: ['authfail', 'login'] }, userid: userid, msgArgs: { $exists: true } }).project({ action: 1, time: 1, msgid: 1, msgArgs: 1, tokenName: 1 }).sort({ time: -1 }).toArray(func); }; - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, filter, func) { - var finddata = { domain: domain, nodeid: nodeid }; - if (filter != null) finddata.action = filter; - obj.eventsfile.find(finddata).project({ type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).toArray(func); - }; - obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, filter, func) { - var finddata = { domain: domain, nodeid: nodeid, userid: { $in: [userid, null] } }; - if (filter != null) finddata.action = filter; - obj.eventsfile.find(finddata).project({ type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).toArray(func); - }; + obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, func) { obj.eventsfile.find({ domain: domain, nodeid: nodeid }).project({ type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).toArray(func); }; + obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, func) { obj.eventsfile.find({ domain: domain, nodeid: nodeid, userid: { $in: [userid, null] } }).project({ type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).toArray(func); }; obj.RemoveAllEvents = function (domain) { obj.eventsfile.deleteMany({ domain: domain }, { multi: true }); }; obj.RemoveAllNodeEvents = function (domain, nodeid) { if ((domain == null) || (nodeid == null)) return; obj.eventsfile.deleteMany({ domain: domain, nodeid: nodeid }, { multi: true }); }; obj.RemoveAllUserEvents = function (domain, userid) { if ((domain == null) || (userid == null)) return; obj.eventsfile.deleteMany({ domain: domain, userid: userid }, { multi: true }); }; @@ -2928,26 +1753,29 @@ module.exports.CreateDB = function (parent, func) { // List all configuration files obj.listConfigFiles = function (func) { obj.file.find({ type: 'cfile' }).sort({ _id: 1 }).toArray(func); } + // Get all configuration files + obj.getAllConfigFiles = function (password, func) { + obj.file.find({ type: 'cfile' }).toArray(function (err, docs) { + if (err != null) { func(null); return; } + var r = null; + for (var i = 0; i < docs.length; i++) { + var name = docs[i]._id.split('/')[1]; + var data = obj.decryptData(password, docs[i].data); + if (data != null) { if (r == null) { r = {}; } r[name] = data; } + } + func(r); + }); + } + // Get database information obj.getDbStats = function (func) { obj.stats = { c: 6 }; - obj.getStats(function (r) { obj.stats.recordTypes = r; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }) - obj.file.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.eventsfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.powerfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.smbiosfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.serverstatsfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - } - - // Correct database information of obj.getDbStats before returning it - function getDbStatsEx(data) { - var r = {}; - if (data.recordTypes != null) { r = data.recordTypes; } - try { r.smbios = data['meshcentral.smbios'].count; } catch (ex) { } - try { r.power = data['meshcentral.power'].count; } catch (ex) { } - try { r.events = data['meshcentral.events'].count; } catch (ex) { } - try { r.serverstats = data['meshcentral.serverstats'].count; } catch (ex) { } - return r; + obj.getStats(function (r) { obj.stats.recordTypes = r; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }) + obj.file.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.eventsfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.powerfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.smbiosfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.serverstatsfile.stats().then(function (stats) { obj.stats[stats.ns] = { size: stats.size, count: stats.count, avgObjSize: stats.avgObjSize, capped: stats.capped }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }, function () { if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); } // Plugin operations @@ -2992,18 +1820,18 @@ module.exports.CreateDB = function (parent, func) { obj.GetAll = function (func) { obj.file.find({}, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); }; obj.GetHash = function (id, func) { obj.file.find({ _id: id }, { _id: 0, hash: 1 }, func); }; obj.GetAllTypeNoTypeField = function (type, domain, func) { obj.file.find({ type: type, domain: domain }, { type: 0 }, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); }; - //obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, domain, type, id, skip, limit, func) { + //obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, domain, type, id, func) { //var x = { type: type, domain: domain, meshid: { $in: meshes } }; //if (id) { x._id = id; } //obj.file.find(x, { type: 0 }, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); //}; - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, skip, limit, func) { + obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, extrasids, domain, type, id, func) { if (extrasids == null) { - const x = { type: type, domain: domain, meshid: { $in: meshes } }; + var x = { type: type, domain: domain, meshid: { $in: meshes } }; if (id) { x._id = id; } obj.file.find(x, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } else { - const x = { type: type, domain: domain, $or: [{ meshid: { $in: meshes } }, { _id: { $in: extrasids } }] }; + var x = { type: type, domain: domain, $or: [{ meshid: { $in: meshes } }, { _id: { $in: extrasids } }] }; if (id) { x._id = id; } obj.file.find(x, function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); } @@ -3024,7 +1852,7 @@ module.exports.CreateDB = function (parent, func) { obj.RemoveMeshDocuments = function (id) { obj.file.remove({ meshid: id }, { multi: true }); obj.file.remove({ _id: 'nt' + id }); }; obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if ((err == null) && (docs.length == 1)) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }; obj.DeleteDomain = function (domain, func) { obj.file.remove({ domain: domain }, { multi: true }, func); }; - obj.SetUser = function (user) { if (user == null) return; if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; + obj.SetUser = function (user) { if (user.subscriptions != null) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); } else { obj.Set(user); } }; obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }; obj.getLocalAmtNodes = function (func) { obj.file.find({ type: 'node', host: { $exists: true, $ne: null }, intelamt: { $exists: true } }, func); }; obj.getAmtUuidMeshNode = function (domainid, mtype, uuid, func) { obj.file.find({ type: 'node', domain: domainid, mtype: mtype, 'intelamt.uuid': uuid }, func); }; @@ -3033,74 +1861,38 @@ module.exports.CreateDB = function (parent, func) { // Database actions on the events collection obj.GetAllEvents = function (func) { obj.eventsfile.find({}, func); }; obj.StoreEvent = function (event, func) { obj.eventsfile.insert(event, func); }; - obj.GetEvents = function (ids, domain, filter, func) { - var finddata = { domain: domain, ids: { $in: ids } }; - if (filter != null) finddata.action = filter; - if (obj.databaseType == DB_NEDB) { - obj.eventsfile.find(finddata, { _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).exec(func); + obj.GetEvents = function (ids, domain, func) { if (obj.databaseType == 1) { obj.eventsfile.find({ domain: domain, ids: { $in: ids } }, { _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).exec(func); } else { obj.eventsfile.find({ domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }, func); } }; + obj.GetEventsWithLimit = function (ids, domain, limit, func) { if (obj.databaseType == 1) { obj.eventsfile.find({ domain: domain, ids: { $in: ids } }, { _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.eventsfile.find({ domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); } }; + obj.GetUserEvents = function (ids, domain, userid, func) { + if (obj.databaseType == 1) { + obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).exec(func); } else { - obj.eventsfile.find(finddata, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }, func); + obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }, func); } }; - obj.GetEventsWithLimit = function (ids, domain, limit, filter, func) { - var finddata = { domain: domain, ids: { $in: ids } }; - if (filter != null) finddata.action = filter; - if (obj.databaseType == DB_NEDB) { - obj.eventsfile.find(finddata, { _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); + obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, func) { + if (obj.databaseType == 1) { + obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { - obj.eventsfile.find(finddata, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); - } - }; - obj.GetUserEvents = function (ids, domain, userid, filter, func) { - var finddata = { domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }; - if (filter != null) finddata.action = filter; - if (obj.databaseType == DB_NEDB) { - obj.eventsfile.find(finddata, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).exec(func); - } else { - obj.eventsfile.find(finddata, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }, func); - } - }; - obj.GetUserEventsWithLimit = function (ids, domain, userid, limit, filter, func) { - var finddata = { domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }; - if (filter != null) finddata.action = filter; - if (obj.databaseType == DB_NEDB) { - obj.eventsfile.find(finddata, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); - } else { - obj.eventsfile.find(finddata, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); + obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }, { userid: userid }] }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); } }; obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) { - if (obj.databaseType == DB_NEDB) { + if (obj.databaseType == 1) { obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }], msgid: { $in: msgids }, time: { $gte: start, $lte: end } }, { type: 0, _id: 0, domain: 0, node: 0 }).sort({ time: 1 }).exec(func); } else { obj.eventsfile.find({ domain: domain, $or: [{ ids: { $in: ids } }], msgid: { $in: msgids }, time: { $gte: start, $lte: end } }, { type: 0, _id: 0, domain: 0, node: 0 }).sort({ time: 1 }, func); } }; obj.GetUserLoginEvents = function (domain, userid, func) { - if (obj.databaseType == DB_NEDB) { + if (obj.databaseType == 1) { obj.eventsfile.find({ domain: domain, action: { $in: ['authfail', 'login'] }, userid: userid, msgArgs: { $exists: true } }, { action: 1, time: 1, msgid: 1, msgArgs: 1, tokenName: 1 }).sort({ time: -1 }).exec(func); } else { obj.eventsfile.find({ domain: domain, action: { $in: ['authfail', 'login'] }, userid: userid, msgArgs: { $exists: true } }, { action: 1, time: 1, msgid: 1, msgArgs: 1, tokenName: 1 }).sort({ time: -1 }, func); } }; - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, filter, func) { - var finddata = { domain: domain, nodeid: nodeid }; - if (filter != null) finddata.action = filter; - if (obj.databaseType == DB_NEDB) { - obj.eventsfile.find(finddata, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).exec(func); - } else { - obj.eventsfile.find(finddata, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit, func); - } - }; - obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, filter, func) { - var finddata = { domain: domain, nodeid: nodeid, userid: { $in: [userid, null] } }; - if (filter != null) finddata.action = filter; - if (obj.databaseType == DB_NEDB) { - obj.eventsfile.find(finddata, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).exec(func); - } else { - obj.eventsfile.find(finddata, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit, func); - } - }; + obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, func) { if (obj.databaseType == 1) { obj.eventsfile.find({ domain: domain, nodeid: nodeid }, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.eventsfile.find({ domain: domain, nodeid: nodeid }, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit, func); } }; + obj.GetNodeEventsSelfWithLimit = function (nodeid, domain, userid, limit, func) { if (obj.databaseType == 1) { obj.eventsfile.find({ domain: domain, nodeid: nodeid, userid: { $in: [userid, null] } }, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.eventsfile.find({ domain: domain, nodeid: nodeid }, { type: 0, etype: 0, _id: 0, domain: 0, ids: 0, node: 0, nodeid: 0 }).sort({ time: -1 }).limit(limit, func); } }; obj.RemoveAllEvents = function (domain) { obj.eventsfile.remove({ domain: domain }, { multi: true }); }; obj.RemoveAllNodeEvents = function (domain, nodeid) { if ((domain == null) || (nodeid == null)) return; obj.eventsfile.remove({ domain: domain, nodeid: nodeid }, { multi: true }); }; obj.RemoveAllUserEvents = function (domain, userid) { if ((domain == null) || (userid == null)) return; obj.eventsfile.remove({ domain: domain, userid: userid }, { multi: true }); }; @@ -3109,7 +1901,7 @@ module.exports.CreateDB = function (parent, func) { // Database actions on the power collection obj.getAllPower = function (func) { obj.powerfile.find({}, func); }; obj.storePowerEvent = function (event, multiServer, func) { if (multiServer != null) { event.server = multiServer.serverid; } obj.powerfile.insert(event, func); }; - obj.getPowerTimeline = function (nodeid, func) { if (obj.databaseType == DB_NEDB) { obj.powerfile.find({ nodeid: { $in: ['*', nodeid] } }, { _id: 0, nodeid: 0, s: 0 }).sort({ time: 1 }).exec(func); } else { obj.powerfile.find({ nodeid: { $in: ['*', nodeid] } }, { _id: 0, nodeid: 0, s: 0 }).sort({ time: 1 }, func); } }; + obj.getPowerTimeline = function (nodeid, func) { if (obj.databaseType == 1) { obj.powerfile.find({ nodeid: { $in: ['*', nodeid] } }, { _id: 0, nodeid: 0, s: 0 }).sort({ time: 1 }).exec(func); } else { obj.powerfile.find({ nodeid: { $in: ['*', nodeid] } }, { _id: 0, nodeid: 0, s: 0 }).sort({ time: 1 }, func); } }; obj.removeAllPowerEvents = function () { obj.powerfile.remove({}, { multi: true }); }; obj.removeAllPowerEventsForNode = function (nodeid) { if (nodeid == null) return; obj.powerfile.remove({ nodeid: nodeid }, { multi: true }); }; @@ -3134,25 +1926,28 @@ module.exports.CreateDB = function (parent, func) { // List all configuration files obj.listConfigFiles = function (func) { obj.file.find({ type: 'cfile' }).sort({ _id: 1 }).exec(func); } + // Get all configuration files + obj.getAllConfigFiles = function (password, func) { + obj.file.find({ type: 'cfile' }, function (err, docs) { + if (err != null) { func(null); return; } + var r = null; + for (var i = 0; i < docs.length; i++) { + var name = docs[i]._id.split('/')[1]; + var data = obj.decryptData(password, docs[i].data); + if (data != null) { if (r == null) { r = {}; } r[name] = data; } + } + func(r); + }); + } + // Get database information obj.getDbStats = function (func) { obj.stats = { c: 5 }; - obj.getStats(function (r) { obj.stats.recordTypes = r; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }) - obj.file.count({}, function (err, count) { obj.stats.meshcentral = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.eventsfile.count({}, function (err, count) { obj.stats.events = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.powerfile.count({}, function (err, count) { obj.stats.power = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - obj.serverstatsfile.count({}, function (err, count) { obj.stats.serverstats = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(getDbStatsEx(obj.stats)); } }); - } - - // Correct database information of obj.getDbStats before returning it - function getDbStatsEx(data) { - var r = {}; - if (data.recordTypes != null) { r = data.recordTypes; } - try { r.smbios = data['smbios'].count; } catch (ex) { } - try { r.power = data['power'].count; } catch (ex) { } - try { r.events = data['events'].count; } catch (ex) { } - try { r.serverstats = data['serverstats'].count; } catch (ex) { } - return r; + obj.getStats(function (r) { obj.stats.recordTypes = r; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }) + obj.file.count({}, function (err, count) { obj.stats.meshcentral = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.eventsfile.count({}, function (err, count) { obj.stats.events = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.powerfile.count({}, function (err, count) { obj.stats.power = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); + obj.serverstatsfile.count({}, function (err, count) { obj.stats.serverstats = { count: count }; if (--obj.stats.c == 0) { delete obj.stats.c; func(obj.stats); } }); } // Plugin operations @@ -3167,114 +1962,64 @@ module.exports.CreateDB = function (parent, func) { } - // Get all configuration files - obj.getAllConfigFiles = function (password, func) { - obj.GetAllType('cfile', function (err, docs) { - if (err != null) { func(null); return; } - var r = null; - for (var i = 0; i < docs.length; i++) { - var name = docs[i]._id.split('/')[1]; - var data = obj.decryptData(password, docs[i].data); - if (data != null) { if (r == null) { r = {}; } r[name] = data; } - } - func(r); - }); - } - func(obj); // Completed function setup } // Return a human readable string with current backup configuration obj.getBackupConfig = function () { var r = '', backupPath = parent.backuppath; + if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; } - let dbname = 'meshcentral'; + var dbname = 'meshcentral'; if (parent.args.mongodbname) { dbname = parent.args.mongodbname; } else if ((typeof parent.args.mariadb == 'object') && (typeof parent.args.mariadb.database == 'string')) { dbname = parent.args.mariadb.database; } else if ((typeof parent.args.mysql == 'object') && (typeof parent.args.mysql.database == 'string')) { dbname = parent.args.mysql.database; } - else if (typeof parent.config.settings.sqlite3 == 'string') {dbname = parent.config.settings.sqlite3 + '.sqlite'}; const currentDate = new Date(); const fileSuffix = currentDate.getFullYear() + '-' + padNumber(currentDate.getMonth() + 1, 2) + '-' + padNumber(currentDate.getDate(), 2) + '-' + padNumber(currentDate.getHours(), 2) + '-' + padNumber(currentDate.getMinutes(), 2); - obj.newAutoBackupFile = parent.config.settings.autobackup.backupname + fileSuffix; + const newAutoBackupFile = 'meshcentral-autobackup-' + fileSuffix; + const newAutoBackupPath = parent.path.join(backupPath, newAutoBackupFile); r += 'DB Name: ' + dbname + '\r\n'; - r += 'DB Type: ' + DB_LIST[obj.databaseType] + '\r\n'; + r += 'DB Type: ' + ['None', 'NeDB', 'MongoJS', 'MongoDB', 'MariaDB', 'MySQL'][obj.databaseType] + '\r\n'; r += 'BackupPath: ' + backupPath + '\r\n'; - r += 'BackupFile: ' + obj.newAutoBackupFile + '.zip\r\n'; + r += 'newAutoBackupFile: ' + newAutoBackupFile + '\r\n'; + r += 'newAutoBackupPath: ' + newAutoBackupPath + '\r\n'; if (parent.config.settings.autobackup == null) { r += 'No Settings/AutoBackup\r\n'; } else { - if (parent.config.settings.autobackup.backuphour != null && parent.config.settings.autobackup.backuphour != -1) { - r += 'Backup between: ' + parent.config.settings.autobackup.backuphour + 'H-' + (parent.config.settings.autobackup.backuphour + 1) + 'H\r\n'; - } if (parent.config.settings.autobackup.backupintervalhours != null) { - r += 'Backup Interval (Hours): ' + parent.config.settings.autobackup.backupintervalhours + '\r\n'; + if (typeof parent.config.settings.autobackup.backupintervalhours != 'number') { r += 'Bad backupintervalhours type\r\n'; } + else { r += 'Backup Interval (Hours): ' + parent.config.settings.autobackup.backupintervalhours + '\r\n'; } } if (parent.config.settings.autobackup.keeplastdaysbackup != null) { - r += 'Keep Last Backups (Days): ' + parent.config.settings.autobackup.keeplastdaysbackup + '\r\n'; + if (typeof parent.config.settings.autobackup.keeplastdaysbackup != 'number') { r += 'Bad keeplastdaysbackup type\r\n'; } + else { r += 'Keep Last Backups (Days): ' + parent.config.settings.autobackup.keeplastdaysbackup + '\r\n'; } } if (parent.config.settings.autobackup.zippassword != null) { - r += 'ZIP Password: '; - if (typeof parent.config.settings.autobackup.zippassword != 'string') { r += 'Bad zippassword type, Backups will not be encrypted\r\n'; } - else if (parent.config.settings.autobackup.zippassword == "") { r += 'Blank zippassword, Backups will fail\r\n'; } - else { r += 'Set\r\n'; } + if (typeof parent.config.settings.autobackup.zippassword != 'string') { r += 'Bad zippassword type\r\n'; } + else { r += 'ZIP Password Set\r\n'; } } if (parent.config.settings.autobackup.mongodumppath != null) { - r += 'MongoDump Path: '; if (typeof parent.config.settings.autobackup.mongodumppath != 'string') { r += 'Bad mongodumppath type\r\n'; } - else { r += parent.config.settings.autobackup.mongodumppath + '\r\n'; } + else { r += 'MongoDump Path: ' + parent.config.settings.autobackup.mongodumppath + '\r\n'; } } if (parent.config.settings.autobackup.mysqldumppath != null) { - r += 'MySqlDump Path: '; if (typeof parent.config.settings.autobackup.mysqldumppath != 'string') { r += 'Bad mysqldump type\r\n'; } - else { r += parent.config.settings.autobackup.mysqldumppath + '\r\n'; } + else { r += 'MySqlDump Path: ' + parent.config.settings.autobackup.mysqldumppath + '\r\n'; } } - if (parent.config.settings.autobackup.backupotherfolders) { - r += 'Backup other folders: '; - r += parent.filespath + ', ' + parent.recordpath + '\r\n'; - } - if (parent.config.settings.autobackup.backupwebfolders) { - r += 'Backup webfolders: '; - if (parent.webViewsOverridePath) {r += parent.webViewsOverridePath }; - if (parent.webPublicOverridePath) {r += ', '+ parent.webPublicOverridePath}; - if (parent.webEmailsOverridePath) {r += ',' + parent.webEmailsOverridePath}; - r+= '\r\n'; - } - if (parent.config.settings.autobackup.backupignorefilesglob != []) { - r += 'Backup IgnoreFilesGlob: '; - { r += parent.config.settings.autobackup.backupignorefilesglob + '\r\n'; } - } - if (parent.config.settings.autobackup.backupskipfoldersglob != []) { - r += 'Backup SkipFoldersGlob: '; - { r += parent.config.settings.autobackup.backupskipfoldersglob + '\r\n'; } - } - - if (typeof parent.config.settings.autobackup.s3 == 'object') { - r += 'S3 Backups: Enabled\r\n'; - } - if (typeof parent.config.settings.autobackup.webdav == 'object') { - r += 'WebDAV Backups: Enabled\r\n'; - r += 'WebDAV backup path: ' + ((typeof parent.config.settings.autobackup.webdav.foldername == 'string') ? parent.config.settings.autobackup.webdav.foldername : 'MeshCentral-Backups') + '\r\n'; - r += 'WebDAV maximum files: '+ ((typeof parent.config.settings.autobackup.webdav.maxfiles == 'number') ? parent.config.settings.autobackup.webdav.maxfiles : 'no limit') + '\r\n'; - } - if (typeof parent.config.settings.autobackup.googledrive == 'object') { - r += 'Google Drive Backups: Enabled\r\n'; - } - - } return r; } function buildSqlDumpCommand() { - var props = (obj.databaseType == DB_MARIADB) ? parent.args.mariadb : parent.args.mysql; + var props = (obj.databaseType == 4) ? parent.args.mariadb : parent.args.mysql; var mysqldumpPath = 'mysqldump'; if (parent.config.settings.autobackup && parent.config.settings.autobackup.mysqldumppath) { - mysqldumpPath = path.normalize(parent.config.settings.autobackup.mysqldumppath); + mysqldumpPath = parent.config.settings.autobackup.mysqldumppath; } var cmd = '\"' + mysqldumpPath + '\" --user=\'' + props.user + '\''; @@ -3287,11 +2032,11 @@ module.exports.CreateDB = function (parent, func) { // SSL options different on mariadb/mysql var sslOptions = ''; - if (obj.databaseType == DB_MARIADB) { + if (obj.databaseType == 4) { if (props.ssl) { sslOptions = ' --ssl'; if (props.ssl.cacertpath) sslOptions = ' --ssl-ca=' + props.ssl.cacertpath; - if (props.ssl.dontcheckserveridentity != true) {sslOptions += ' --ssl-verify-server-cert'} else {sslOptions += ' --ssl-verify-server-cert=false'}; + if (props.ssl.dontcheckserveridentity != true) sslOptions += ' --ssl-verify-server-cert'; if (props.ssl.clientcertpath) sslOptions += ' --ssl-cert=' + props.ssl.clientcertpath; if (props.ssl.clientkeypath) sslOptions += ' --ssl-key=' + props.ssl.clientkeypath; } @@ -3318,7 +2063,7 @@ module.exports.CreateDB = function (parent, func) { var mongoDumpPath = 'mongodump'; if (parent.config.settings.autobackup && parent.config.settings.autobackup.mongodumppath) { - mongoDumpPath = path.normalize(parent.config.settings.autobackup.mongodumppath); + mongoDumpPath = parent.config.settings.autobackup.mongodumppath; } var cmd = '"' + mongoDumpPath + '"'; @@ -3328,88 +2073,58 @@ module.exports.CreateDB = function (parent, func) { } // Check that the server is capable of performing a backup - // Tries configured custom location with fallback to default location - // Now runs after autobackup config init in meshcentral.js so config options are checked obj.checkBackupCapability = function (func) { - if ((parent.config.settings.autobackup == null) || (parent.config.settings.autobackup == false)) { return; }; - //block backup until validated. Gets put back if all checks are ok. - let backupInterval = parent.config.settings.autobackup.backupintervalhours; - parent.config.settings.autobackup.backupintervalhours = -1; - let backupPath = parent.backuppath; - - if (backupPath.startsWith(parent.datapath)) { - func(1, "Backup path can't be set within meshcentral-data folder. No backups will be made."); - return; - } - // Check create/write backupdir - try { fs.mkdirSync(backupPath); } - catch (e) { - // EEXIST error = dir already exists - if (e.code != 'EEXIST' ) { - //Unable to create backuppath - console.error(e.message); - func(1, 'Unable to create ' + backupPath + '. No backups will be made. Error: ' + e.message); - return; - } - } - const testFile = path.join(backupPath, (parent.config.settings.autobackup.backupname + ".test")); - - try { fs.writeFileSync( testFile, "DeleteMe"); } - catch (e) { - //Unable to create file - console.error (e.message); - func(1, "Backuppath (" + backupPath + ") can't be written to. No backups will be made. Error: " + e.message); - return; - } - try { fs.unlinkSync(testFile); parent.debug('backup', 'Backuppath ' + backupPath + ' accesscheck successful');} - catch (e) { - console.error (e.message); - func(1, "Backuppathtestfile (" + testFile + ") can't be deleted, check filerights. Error: " + e.message); - // Assume write rights, no delete rights. Continue with warning. - //return; - } - - // Check database dumptools - if ((obj.databaseType == DB_MONGOJS) || (obj.databaseType == DB_MONGODB)) { + if ((parent.config.settings.autobackup == null) || (parent.config.settings.autobackup == false)) { func(); } + if ((obj.databaseType == 2) || (obj.databaseType == 3)) { // Check that we have access to MongoDump + var backupPath = parent.backuppath; + if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; } + try { parent.fs.mkdirSync(backupPath); } catch (e) { } + var cmd = buildMongoDumpCommand(); cmd += (parent.platform == 'win32') ? ' --archive=\"nul\"' : ' --archive=\"/dev/null\"'; const child_process = require('child_process'); child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) { - if ((error != null) && (error != '')) { - func(1, "Unable to find mongodump tool, backup will not be performed. Command tried: " + cmd); - return; - } else {parent.config.settings.autobackup.backupintervalhours = backupInterval;} + try { + if ((error != null) && (error != '')) { + + console.log(error); + + if (parent.platform == 'win32') { + func(1, "Unable to find mongodump.exe, MongoDB database auto-backup will not be performed."); + } else { + func(1, "Unable to find mongodump, MongoDB database auto-backup will not be performed."); + } + } else { + func(); + } + } catch (ex) { console.log(ex); } }); - } else if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL)) { + } else if ((obj.databaseType == 4) || (obj.databaseType == 5)) { // Check that we have access to mysqldump + var backupPath = parent.backuppath; + if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; } + try { parent.fs.mkdirSync(backupPath); } catch (e) { } + var cmd = buildSqlDumpCommand(); cmd += ' > ' + ((parent.platform == 'win32') ? '\"nul\"' : '\"/dev/null\"'); const child_process = require('child_process'); - child_process.exec(cmd, { cwd: backupPath, timeout: 1000*30 }, function(error, stdout, stdin) { - if ((error != null) && (error != '')) { - func(1, "Unable to find mysqldump tool, backup will not be performed. Command tried: " + cmd); - return; - } else {parent.config.settings.autobackup.backupintervalhours = backupInterval;} - - }); - } else if (obj.databaseType == DB_POSTGRESQL) { - // Check that we have access to pg_dump - parent.config.settings.autobackup.pgdumppath = path.normalize(parent.config.settings.autobackup.pgdumppath ? parent.config.settings.autobackup.pgdumppath : 'pg_dump'); - let cmd = '"' + parent.config.settings.autobackup.pgdumppath + '"' - + ' --dbname=postgresql://' + parent.config.settings.postgres.user + ":" +parent.config.settings.postgres.password - + "@" + parent.config.settings.postgres.host + ":" + parent.config.settings.postgres.port + "/" + databaseName - + ' > ' + ((parent.platform == 'win32') ? '\"nul\"' : '\"/dev/null\"'); - const child_process = require('child_process'); child_process.exec(cmd, { cwd: backupPath }, function(error, stdout, stdin) { - if ((error != null) && (error != '')) { - func(1, "Unable to find pg_dump tool, backup will not be performed. Command tried: " + cmd); - return; - } else {parent.config.settings.autobackup.backupintervalhours = backupInterval;} - }); + try { + if ((error != null) && (error != '')) { + if (parent.platform == 'win32') { + func(1, "Unable to find mysqldump.exe, MySQL/MariaDB database auto-backup will not be performed."); + } else { + func(1, "Unable to find mysqldump, MySQL/MariaDB database auto-backup will not be performed."); + } + } else { + func(); + } + } catch (ex) { console.log(ex); } + }); } else { - //all ok, enable backup - parent.config.settings.autobackup.backupintervalhours = backupInterval;} + func(); + } } // MongoDB pending bulk read operation, perform fast bulk document reads. @@ -3522,268 +2237,157 @@ module.exports.CreateDB = function (parent, func) { } // Perform a server backup + obj.performingBackup = false; obj.performBackup = function (func) { - parent.debug('backup','Entering performBackup'); try { - if (obj.performingBackup) return 'Backup alreay in progress.'; - if (parent.config.settings.autobackup.backupintervalhours == -1) { if (func) { func('Backup disabled.'); return 'Backup disabled.' }}; + if (obj.performingBackup) return 1; obj.performingBackup = true; - let backupPath = parent.backuppath; - let dataPath = parent.datapath; + //console.log('Performing backup...'); + var backupPath = parent.backuppath; + if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; } + try { parent.fs.mkdirSync(backupPath); } catch (e) { } + const dbname = (parent.args.mongodbname) ? (parent.args.mongodbname) : 'meshcentral'; + const dburl = parent.args.mongodb; const currentDate = new Date(); const fileSuffix = currentDate.getFullYear() + '-' + padNumber(currentDate.getMonth() + 1, 2) + '-' + padNumber(currentDate.getDate(), 2) + '-' + padNumber(currentDate.getHours(), 2) + '-' + padNumber(currentDate.getMinutes(), 2); - obj.newAutoBackupFile = path.join(backupPath, parent.config.settings.autobackup.backupname + fileSuffix + '.zip'); - parent.debug('backup','newAutoBackupFile=' + obj.newAutoBackupFile); + const newAutoBackupFile = 'meshcentral-autobackup-' + fileSuffix; + const newAutoBackupPath = parent.path.join(backupPath, newAutoBackupFile); - if ((obj.databaseType == DB_MONGOJS) || (obj.databaseType == DB_MONGODB)) { - // Perform a MongoDump - const dbname = (parent.args.mongodbname) ? (parent.args.mongodbname) : 'meshcentral'; - const dburl = parent.args.mongodb; - - obj.newDBDumpFile = path.join(backupPath, (dbname + '-mongodump-' + fileSuffix + '.archive')); + if ((obj.databaseType == 2) || (obj.databaseType == 3)) { + // Perform a MongoDump backup + const newBackupFile = 'mongodump-' + fileSuffix; + var newBackupPath = parent.path.join(backupPath, newBackupFile); var cmd = buildMongoDumpCommand(); - cmd += (dburl) ? ' --archive=\"' + obj.newDBDumpFile + '\"' : - ' --db=\"' + dbname + '\" --archive=\"' + obj.newDBDumpFile + '\"'; - parent.debug('backup','Mongodump cmd: ' + cmd); - const child_process = require('child_process'); - const dumpProcess = child_process.exec( - cmd, - { cwd: parent.parentpath }, - (error)=> {if (error) {obj.backupStatus |= BACKUPFAIL_DBDUMP; console.error('ERROR: Unable to perform MongoDB backup: ' + error + '\r\n'); obj.createBackupfile(func);}} - ); - - dumpProcess.on('exit', (code) => { - if (code != 0) {console.log(`Mongodump child process exited with code ${code}`); obj.backupStatus |= BACKUPFAIL_DBDUMP;} - obj.createBackupfile(func); - }); + cmd += (dburl) ? ' --archive=\"' + newBackupPath + '.archive\"' : + ' --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"'; - } else if ((obj.databaseType == DB_MARIADB) || (obj.databaseType == DB_MYSQL)) { + const child_process = require('child_process'); + var backupProcess = child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) { + try { + var mongoDumpSuccess = true; + backupProcess = null; + if ((error != null) && (error != '')) { mongoDumpSuccess = false; console.log('ERROR: Unable to perform MongoDB backup: ' + error + '\r\n'); } + + // Perform archive compression + var archiver = require('archiver'); + var output = parent.fs.createWriteStream(newAutoBackupPath + '.zip'); + var archive = null; + if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.zippassword == 'string')) { + try { archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted')); } catch (ex) { } + archive = archiver.create('zip-encrypted', { zlib: { level: 9 }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword }); + } else { + archive = archiver('zip', { zlib: { level: 9 } }); + } + output.on('close', function () { + obj.performingBackup = false; + if (func) { if (mongoDumpSuccess) { func('Auto-backup completed.'); } else { func('Auto-backup completed without mongodb database: ' + error); } } + obj.performCloudBackup(newAutoBackupPath + '.zip', func); + setTimeout(function () { try { parent.fs.unlink(newBackupPath + '.archive', function () { }); } catch (ex) { console.log(ex); } }, 5000); + }); + output.on('end', function () { }); + output.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); + archive.on('warning', function (err) { console.log('Backup warning: ' + err); if (func) { func('Backup warning: ' + err); } }); + archive.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); + archive.pipe(output); + if (mongoDumpSuccess == true) { archive.file(newBackupPath + '.archive', { name: newBackupFile + '.archive' }); } + archive.directory(parent.datapath, 'meshcentral-data'); + archive.finalize(); + } catch (ex) { console.log(ex); } + }); + } else if ((obj.databaseType == 4) || (obj.databaseType == 5)) { // Perform a MySqlDump backup const newBackupFile = 'mysqldump-' + fileSuffix; - obj.newDBDumpFile = path.join(backupPath, newBackupFile + '.sql'); + var newBackupPath = parent.path.join(backupPath, newBackupFile); var cmd = buildSqlDumpCommand(); - cmd += ' --result-file=\"' + obj.newDBDumpFile + '\"'; - parent.debug('backup','Maria/MySQLdump cmd: ' + cmd); - + cmd += ' --result-file=\"' + newBackupPath + '.sql\"'; const child_process = require('child_process'); - const dumpProcess = child_process.exec( - cmd, - { cwd: parent.parentpath }, - (error)=> {if (error) {obj.backupStatus |= BACKUPFAIL_DBDUMP; console.error('ERROR: Unable to perform MySQL backup: ' + error + '\r\n'); obj.createBackupfile(func);}} - ); - dumpProcess.on('exit', (code) => { - if (code != 0) {console.error(`MySQLdump child process exited with code ${code}`); obj.backupStatus |= BACKUPFAIL_DBDUMP;} - obj.createBackupfile(func); - }); + var backupProcess = child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) { + try { + var sqlDumpSuccess = true; + backupProcess = null; + if ((error != null) && (error != '')) { sqlDumpSuccess = false; console.log('ERROR: Unable to perform MySQL/MariaDB backup: ' + error + '\r\n'); } - } else if (obj.databaseType == DB_SQLITE) { - //.db3 suffix to escape escape backupfile glob to exclude the sqlite db files - obj.newDBDumpFile = path.join(backupPath, databaseName + '-sqlitedump-' + fileSuffix + '.db3'); - // do a VACUUM INTO in favor of the backup API to compress the export, see https://www.sqlite.org/backup.html - parent.debug('backup','SQLitedump: VACUUM INTO ' + obj.newDBDumpFile); - obj.file.exec('VACUUM INTO \'' + obj.newDBDumpFile + '\'', function (err) { - if (err) { console.error('SQLite backup error: ' + err); obj.backupStatus |=BACKUPFAIL_DBDUMP;}; - //always finish/clean up - obj.createBackupfile(func); - }); - } else if (obj.databaseType == DB_POSTGRESQL) { - // Perform a PostgresDump backup - const newBackupFile = databaseName + '-pgdump-' + fileSuffix + '.sql'; - obj.newDBDumpFile = path.join(backupPath, newBackupFile); - let cmd = '"' + parent.config.settings.autobackup.pgdumppath + '"' - + ' --dbname=postgresql://' + parent.config.settings.postgres.user + ":" +parent.config.settings.postgres.password - + "@" + parent.config.settings.postgres.host + ":" + parent.config.settings.postgres.port + "/" + databaseName - + " --file=" + obj.newDBDumpFile; - parent.debug('backup','Postgresqldump cmd: ' + cmd); - const child_process = require('child_process'); - const dumpProcess = child_process.exec( - cmd, - { cwd: dataPath }, - (error)=> {if (error) {obj.backupStatus |= BACKUPFAIL_DBDUMP; console.log('ERROR: Unable to perform PostgreSQL dump: ' + error.message + '\r\n'); obj.createBackupfile(func);}} - ); - dumpProcess.on('exit', (code) => { - if (code != 0) {console.log(`PostgreSQLdump child process exited with code: ` + code); obj.backupStatus |= BACKUPFAIL_DBDUMP;} - obj.createBackupfile(func); + var archiver = require('archiver'); + var output = parent.fs.createWriteStream(newAutoBackupPath + '.zip'); + var archive = null; + if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.zippassword == 'string')) { + try { archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted')); } catch (ex) { } + archive = archiver.create('zip-encrypted', { zlib: { level: 9 }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword }); + } else { + archive = archiver('zip', { zlib: { level: 9 } }); + } + output.on('close', function () { + obj.performingBackup = false; + if (func) { if (sqlDumpSuccess) { func('Auto-backup completed.'); } else { func('Auto-backup completed without MySQL/MariaDB database: ' + error); } } + obj.performCloudBackup(newAutoBackupPath + '.zip', func); + setTimeout(function () { try { parent.fs.unlink(newBackupPath + '.sql', function () { }); } catch (ex) { console.log(ex); } }, 5000); + }); + output.on('end', function () { }); + output.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); + archive.on('warning', function (err) { console.log('Backup warning: ' + err); if (func) { func('Backup warning: ' + err); } }); + archive.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); + archive.pipe(output); + if (sqlDumpSuccess == true) { archive.file(newBackupPath + '.sql', { name: newBackupFile + '.sql' }); } + archive.directory(parent.datapath, 'meshcentral-data'); + archive.finalize(); + } catch (ex) { console.log(ex); } }); } else { - // NeDB/Acebase backup, no db dump needed, just make a file backup - obj.createBackupfile(func); - } - } catch (ex) { console.error(ex); parent.addServerWarning( 'Something went wrong during performBackup, check errorlog: ' +ex.message, true); }; - return 'Starting auto-backup...'; - }; - - obj.createBackupfile = function(func) { - parent.debug('backup', 'Entering createBackupfile'); - let archiver = require('archiver'); - let archive = null; - let zipLevel = Math.min(Math.max(Number(parent.config.settings.autobackup.zipcompression ? parent.config.settings.autobackup.zipcompression : 5),1),9); - - //if password defined, create encrypted zip - if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.zippassword == 'string')) { - try { - //Only register format once, otherwise it triggers an error - if (archiver.isRegisteredFormat('zip-encrypted') == false) { archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted')); } - archive = archiver.create('zip-encrypted', { zlib: { level: zipLevel }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword }); - if (func) { func('Creating encrypted ZIP'); } - } catch (ex) { // registering encryption failed, do not fall back to non-encrypted, fail backup and skip old backup removal as a precaution to not lose any backups - obj.backupStatus |= BACKUPFAIL_ZIPMODULE; - if (func) { func('Zipencryptionmodule failed, aborting');} - console.error('Zipencryptionmodule failed, aborting'); - } - } else { - if (func) { func('Creating a NON-ENCRYPTED ZIP'); } - archive = archiver('zip', { zlib: { level: zipLevel } }); - } - - //original behavior, just a filebackup if dbdump fails : (obj.backupStatus == 0 || obj.backupStatus == BACKUPFAIL_DBDUMP) - if (obj.backupStatus == 0) { - // Zip the data directory with the dbdump|NeDB files - let output = fs.createWriteStream(obj.newAutoBackupFile); - - // Archive finalized and closed - output.on('close', function () { - if (obj.backupStatus == 0) { - let mesg = 'Auto-backup completed: ' + obj.newAutoBackupFile + ', backup-size: ' + ((archive.pointer() / 1048576).toFixed(2)) + "Mb"; - console.log(mesg); - if (func) { func(mesg); }; - obj.performCloudBackup(obj.newAutoBackupFile, func); - obj.removeExpiredBackupfiles(func); - + // Perform a NeDB backup + var archiver = require('archiver'); + var output = parent.fs.createWriteStream(newAutoBackupPath + '.zip'); + var archive = null; + if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.zippassword == 'string')) { + try { archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted')); } catch (ex) { } + archive = archiver.create('zip-encrypted', { zlib: { level: 9 }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword }); } else { - let mesg = 'Zipbackup failed (' + obj.backupStatus.toString(2).slice(-8) + '), deleting incomplete backup: ' + obj.newAutoBackupFile; - if (func) { func(mesg) } - else { parent.addServerWarning(mesg, true ) }; - if (fs.existsSync(obj.newAutoBackupFile)) { fs.unlink(obj.newAutoBackupFile, function (err) { console.error('Failed to clean up backupfile: ' + err.message) }) }; - }; - if (obj.databaseType != DB_NEDB) { - //remove dump archive file, because zipped and otherwise fills up - if (fs.existsSync(obj.newDBDumpFile)) { fs.unlink(obj.newDBDumpFile, function (err) { if (err) {console.error('Failed to clean up dbdump file: ' + err.message) } }) }; - }; - obj.performingBackup = false; - obj.backupStatus = 0x0; + archive = archiver('zip', { zlib: { level: 9 } }); } - ); - output.on('end', function () { }); - output.on('error', function (err) { - if ((obj.backupStatus & BACKUPFAIL_ZIPCREATE) == 0) { - console.error('Output error: ' + err.message); - if (func) { func('Output error: ' + err.message); }; - obj.backupStatus |= BACKUPFAIL_ZIPCREATE; - archive.abort(); - }; - }); - archive.on('warning', function (err) { - //if files added to the archiver object aren't reachable anymore (e.g. sqlite-journal files) - //an ENOENT warning is given, but the archiver module has no option to/does not skip/resume - //so the backup needs te be aborted as it otherwise leaves an incomplete zip and never 'ends' - if ((obj.backupStatus & BACKUPFAIL_ZIPCREATE) == 0) { - console.log('Zip warning: ' + err.message); - if (func) { func('Zip warning: ' + err.message); }; - obj.backupStatus |= BACKUPFAIL_ZIPCREATE; - archive.abort(); - }; - }); - archive.on('error', function (err) { - if ((obj.backupStatus & BACKUPFAIL_ZIPCREATE) == 0) { - console.error('Zip error: ' + err.message); - if (func) { func('Zip error: ' + err.message); }; - obj.backupStatus |= BACKUPFAIL_ZIPCREATE; - archive.abort(); - } - }); - archive.pipe(output); - - let globIgnoreFiles; - //slice in case exclusion gets pushed - globIgnoreFiles = parent.config.settings.autobackup.backupignorefilesglob ? parent.config.settings.autobackup.backupignorefilesglob.slice() : []; - if (parent.config.settings.sqlite3) { globIgnoreFiles.push (datapathFoldername + '/' + databaseName + '.sqlite*'); }; //skip sqlite database file, and temp files with ext -journal, -wal & -shm - //archiver.glob doesn't seem to use the third param, archivesubdir. Bug? - //workaround: go up a dir and add data dir explicitly to keep the zip tidy - archive.glob((datapathFoldername + '/**'), { - cwd: datapathParentPath, - ignore: globIgnoreFiles, - skip: (parent.config.settings.autobackup.backupskipfoldersglob ? parent.config.settings.autobackup.backupskipfoldersglob : []) - }); - - if (parent.config.settings.autobackup.backupwebfolders) { - if (parent.webViewsOverridePath) { archive.directory(parent.webViewsOverridePath, 'meshcentral-views'); } - if (parent.webPublicOverridePath) { archive.directory(parent.webPublicOverridePath, 'meshcentral-public'); } - if (parent.webEmailsOverridePath) { archive.directory(parent.webEmailsOverridePath, 'meshcentral-emails'); } - }; - if (parent.config.settings.autobackup.backupotherfolders) { - archive.directory(parent.filespath, 'meshcentral-files'); - archive.directory(parent.recordpath, 'meshcentral-recordings'); - }; - //add dbdump to the root of the zip - if (obj.newDBDumpFile != null) archive.file(obj.newDBDumpFile, { name: path.basename(obj.newDBDumpFile) }); - archive.finalize(); - } else { - //failed somewhere before zipping - console.error('Backup failed ('+ obj.backupStatus.toString(2).slice(-8) + ')'); - if (func) { func('Backup failed ('+ obj.backupStatus.toString(2).slice(-8) + ')') } - else { - parent.addServerWarning('Backup failed ('+ obj.backupStatus.toString(2).slice(-8) + ')', true); + output.on('close', function () { obj.performingBackup = false; if (func) { func('Auto-backup completed.'); } obj.performCloudBackup(newAutoBackupPath + '.zip', func); }); + output.on('end', function () { }); + output.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); + archive.on('warning', function (err) { console.log('Backup warning: ' + err); if (func) { func('Backup warning: ' + err); } }); + archive.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); + archive.pipe(output); + archive.directory(parent.datapath, 'meshcentral-data'); + archive.finalize(); } - //Just in case something's there - if (fs.existsSync(obj.newDBDumpFile)) { fs.unlink(obj.newDBDumpFile, function (err) { if (err) {console.error('Failed to clean up dbdump file: ' + err.message) } }); }; - obj.backupStatus = 0x0; - obj.performingBackup = false; - }; - }; - // Remove expired backupfiles by filenamedate - obj.removeExpiredBackupfiles = function (func) { - if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.keeplastdaysbackup == 'number')) { - let cutoffDate = new Date(); - cutoffDate.setDate(cutoffDate.getDate() - parent.config.settings.autobackup.keeplastdaysbackup); - fs.readdir(parent.backuppath, function (err, dir) { - try { - if (err == null) { - if (dir.length > 0) { - let fileName = parent.config.settings.autobackup.backupname; - let checked = 0; - let removed = 0; + // Remove old backups + if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.keeplastdaysbackup == 'number')) { + var cutoffDate = new Date(); + cutoffDate.setDate(cutoffDate.getDate() - parent.config.settings.autobackup.keeplastdaysbackup); + parent.fs.readdir(parent.backuppath, function (err, dir) { + try { + if ((err == null) && (dir.length > 0)) { for (var i in dir) { var name = dir[i]; - parent.debug('backup', "checking file: ", path.join(parent.backuppath, name)); - if (name.startsWith(fileName) && name.endsWith('.zip')) { - var timex = name.substring(fileName.length, name.length - 4).split('-'); + if (name.startsWith('meshcentral-autobackup-') && name.endsWith('.zip')) { + var timex = name.substring(23, name.length - 4).split('-'); if (timex.length == 5) { - checked++; var fileDate = new Date(parseInt(timex[0]), parseInt(timex[1]) - 1, parseInt(timex[2]), parseInt(timex[3]), parseInt(timex[4])); - if (fileDate && (cutoffDate > fileDate)) { - console.log("Removing expired backup file: ", path.join(parent.backuppath, name)); - fs.unlink(path.join(parent.backuppath, name), function (err) { if (err) { console.error(err.message); if (func) {func('Error removing: ' + err.message); } } }); - removed++; - } + if (fileDate && (cutoffDate > fileDate)) { try { parent.fs.unlink(parent.path.join(parent.backuppath, name), function () { }); } catch (ex) { } } } - else { parent.debug('backup', "file: " + name + " timestamp failure: ", timex); } } } - let mesg= 'Checked ' + checked + ' candidates in ' + parent.backuppath + '. Removed ' + removed + ' expired backupfiles using cutoffDate: '+ cutoffDate.toLocaleString('default', { dateStyle: 'short', timeStyle: 'short' }); - parent.debug (mesg); - if (func) { func(mesg); } - } else { console.error('No files found in ' + parent.backuppath + '. There should be at least one.')} - } - else - { console.error(err); parent.addServerWarning( 'Reading files in backup directory ' + parent.backuppath + ' failed, check errorlog: ' + err.message, true); } - } catch (ex) { console.error(ex); parent.addServerWarning( 'Something went wrong during removeExpiredBackupfiles, check errorlog: ' +ex.message, true); } - }); - } + } + } catch (ex) { console.log(ex); } + }); + } + } catch (ex) { console.log(ex); } + return 0; } // Perform cloud backup obj.performCloudBackup = function (filename, func) { + // WebDAV Backup if ((typeof parent.config.settings.autobackup == 'object') && (typeof parent.config.settings.autobackup.webdav == 'object')) { - parent.debug( 'backup', 'Entering WebDAV backup'); - if (func) { func('Entering WebDAV backup.'); } - const xdateTimeSort = function (a, b) { if (a.xdate > b.xdate) return 1; if (a.xdate < b.xdate) return -1; return 0; } + // Fetch the folder name var webdavfolderName = 'MeshCentral-Backups'; if (typeof parent.config.settings.autobackup.webdav.foldername == 'string') { webdavfolderName = parent.config.settings.autobackup.webdav.foldername; } @@ -3791,74 +2395,65 @@ module.exports.CreateDB = function (parent, func) { // Clean up our WebDAV folder function performWebDavCleanup(client) { if ((typeof parent.config.settings.autobackup.webdav.maxfiles == 'number') && (parent.config.settings.autobackup.webdav.maxfiles > 1)) { - let fileName = parent.config.settings.autobackup.backupname; - //only files matching our backupfilename - let directoryItems = client.getDirectoryContents(webdavfolderName, { deep: false, glob: "/**/" + fileName + "*.zip" }); + var directoryItems = client.getDirectoryContents(webdavfolderName); directoryItems.then( function (files) { for (var i in files) { files[i].xdate = new Date(files[i].lastmod); } files.sort(xdateTimeSort); - parent.debug('backup','WebDAV filtered directory contents: ' + JSON.stringify(files, null, 4)); while (files.length >= parent.config.settings.autobackup.webdav.maxfiles) { - let delFile = files.shift().filename; - client.deleteFile(delFile).then(function (state) { - parent.debug('backup','WebDAV file deleted: ' + delFile); - if (func) { func('WebDAV file deleted: ' + delFile); } + client.deleteFile(files.shift().filename).then(function (state) { + if (func) { func('WebDAV file deleted.'); } }).catch(function (err) { - console.error(err); - if (func) { func('WebDAV (deleteFile) error: ' + err.message); } + if (func) { func('WebDAV (deleteFile) error: ' + err); } }); } } ).catch(function (err) { - console.error(err); - if (func) { func('WebDAV (getDirectoryContents) error: ' + err.message); } + if (func) { func('WebDAV (getDirectoryContents) error: ' + err); } }); } } // Upload to the WebDAV folder function performWebDavUpload(client, filepath) { - require('fs').stat(filepath, function(err,stat){ - var fileStream = require('fs').createReadStream(filepath); - fileStream.on('close', function () { console.log('WebDAV upload completed: ' + webdavfolderName + '/' + require('path').basename(filepath)); if (func) { func('WebDAV upload completed: ' + webdavfolderName + '/' + require('path').basename(filepath)); } }) - fileStream.on('error', function (err) { console.error(err); if (func) { func('WebDAV (fileUpload) error: ' + err.message); } }) - fileStream.pipe(client.createWriteStream('/' + webdavfolderName + '/' + require('path').basename(filepath), { headers: { "Content-Length": stat.size } })); - parent.debug('backup', 'Uploading using WebDAV to: ' + parent.config.settings.autobackup.webdav.url); - if (func) { func('Uploading using WebDAV to: ' + parent.config.settings.autobackup.webdav.url); } - }); + var fileStream = require('fs').createReadStream(filepath); + fileStream.on('close', function () { if (func) { func('WebDAV upload completed'); } }) + fileStream.on('error', function (err) { if (func) { func('WebDAV (fileUpload) error: ' + err); } }) + fileStream.pipe(client.createWriteStream('/' + webdavfolderName + '/' + require('path').basename(filepath))); + if (func) { func('Uploading using WebDAV...'); } } + if (func) { func('Attempting WebDAV upload...'); } const { createClient } = require('webdav'); - const client = createClient(parent.config.settings.autobackup.webdav.url, { - username: parent.config.settings.autobackup.webdav.username, - password: parent.config.settings.autobackup.webdav.password, - maxContentLength: Infinity, - maxBodyLength: Infinity - }); - client.exists(webdavfolderName).then(function(a){ - if(a){ - performWebDavCleanup(client); - performWebDavUpload(client, filename); - }else{ - client.createDirectory(webdavfolderName, {recursive: true}).then(function (a) { - console.log('backup','WebDAV folder created: ' + webdavfolderName); - if (func) { func('WebDAV folder created: ' + webdavfolderName); } + const client = createClient(parent.config.settings.autobackup.webdav.url, { username: parent.config.settings.autobackup.webdav.username, password: parent.config.settings.autobackup.webdav.password }); + var directoryItems = client.getDirectoryContents('/'); + directoryItems.then( + function (files) { + var folderFound = false; + for (var i in files) { if ((files[i].basename == webdavfolderName) && (files[i].type == 'directory')) { folderFound = true; } } + if (folderFound == false) { + client.createDirectory(webdavfolderName).then(function (a) { + if (a.statusText == 'Created') { + if (func) { func('WebDAV folder created'); } + performWebDavUpload(client, filename); + } else { + if (func) { func('WebDAV (createDirectory) status: ' + a.statusText); } + } + }).catch(function (err) { + if (func) { func('WebDAV (createDirectory) error: ' + err); } + }); + } else { + performWebDavCleanup(client); performWebDavUpload(client, filename); - }).catch(function (err) { - console.error(err); - if (func) { func('WebDAV (createDirectory) error: ' + err.message); } - }); + } } - }).catch(function (err) { - console.error(err); - if (func) { func('WebDAV (exists) error: ' + err.message); } + ).catch(function (err) { + if (func) { func('WebDAV (getDirectoryContents) error: ' + err); } }); } // Google Drive Backup if ((typeof parent.config.settings.autobackup == 'object') && (typeof parent.config.settings.autobackup.googledrive == 'object')) { - parent.debug( 'backup', 'Entering Google Drive backup'); obj.Get('GoogleDriveBackup', function (err, docs) { if ((err != null) || (docs.length != 1) || (docs[0].state != 3)) return; if (func) { func('Attempting Google Drive upload...'); } @@ -3934,111 +2529,11 @@ module.exports.CreateDB = function (parent, func) { }); }); } - - // S3 Backup - if ((typeof parent.config.settings.autobackup == 'object') && (typeof parent.config.settings.autobackup.s3 == 'object')) { - parent.debug( 'backup', 'Entering S3 backup'); - var s3folderName = 'MeshCentral-Backups'; - if (typeof parent.config.settings.autobackup.s3.foldername == 'string') { s3folderName = parent.config.settings.autobackup.s3.foldername; } - // Construct the config object - var accessKey = parent.config.settings.autobackup.s3.accesskey, - secretKey = parent.config.settings.autobackup.s3.secretkey, - endpoint = parent.config.settings.autobackup.s3.endpoint ? parent.config.settings.autobackup.s3.endpoint : 's3.amazonaws.com', - port = parent.config.settings.autobackup.s3.port ? parent.config.settings.autobackup.s3.port : 443, - useSsl = parent.config.settings.autobackup.s3.ssl ? parent.config.settings.autobackup.s3.ssl : true, - bucketName = parent.config.settings.autobackup.s3.bucketname, - pathPrefix = s3folderName, - threshold = parent.config.settings.autobackup.s3.maxfiles ? parent.config.settings.autobackup.s3.maxfiles : 0, - fileToUpload = filename; - // Create a MinIO client - const Minio = require('minio'); - var minioClient = new Minio.Client({ - endPoint: endpoint, - port: port, - useSSL: useSsl, - accessKey: accessKey, - secretKey: secretKey - }); - // List objects in the specified bucket and path prefix - var listObjectsPromise = new Promise(function(resolve, reject) { - var items = []; - var stream = minioClient.listObjects(bucketName, pathPrefix, true); - stream.on('data', function(item) { - if (!item.name.endsWith('/')) { // Exclude directories - items.push(item); - } - }); - stream.on('end', function() { - resolve(items); - }); - stream.on('error', function(err) { - reject(err); - }); - }); - listObjectsPromise.then(function(objects) { - // Count the number of files - var fileCount = objects.length; - // Return if no files to carry on uploading - if (fileCount === 0) { return Promise.resolve(); } - // Sort the files by LastModified date (oldest first) - objects.sort(function(a, b) { return new Date(a.lastModified) - new Date(b.lastModified); }); - // Check if the threshold is zero and return if - if (threshold === 0) { return Promise.resolve(); } - // Check if the number of files exceeds the threshold (maxfiles) is 0 - if (fileCount >= threshold) { - // Calculate how many files need to be deleted to make space for the new file - var filesToDelete = fileCount - threshold + 1; // +1 to make space for the new file - if (func) { func('Deleting ' + filesToDelete + ' older ' + (filesToDelete == 1 ? 'file' : 'files') + ' from S3 ...'); } - // Create an array of promises for deleting files - var deletePromises = objects.slice(0, filesToDelete).map(function(fileToDelete) { - return new Promise(function(resolve, reject) { - minioClient.removeObject(bucketName, fileToDelete.name, function(err) { - if (err) { - reject(err); - } else { - if (func) { func('Deleted file: ' + fileToDelete.name + ' from S3'); } - resolve(); - } - }); - }); - }); - // Wait for all deletions to complete - return Promise.all(deletePromises); - } else { - return Promise.resolve(); // No deletion needed - } - }).then(function() { - // Determine the upload path by combining the pathPrefix with the filename - var fileName = require('path').basename(fileToUpload); - var uploadPath = require('path').join(pathPrefix, fileName); - // Upload a new file - var uploadPromise = new Promise(function(resolve, reject) { - if (func) { func('Uploading file ' + uploadPath + ' to S3'); } - minioClient.fPutObject(bucketName, uploadPath, fileToUpload, function(err, etag) { - if (err) { - reject(err); - } else { - if (func) { func('Uploaded file: ' + uploadPath + ' to S3'); } - resolve(etag); - } - }); - }); - return uploadPromise; - }).catch(function(error) { - if (func) { func('Error managing files in S3: ' + error); } - }); - } } // Transfer NeDB data into the current database obj.nedbtodb = function (func) { - var nedbDatastore = null; - try { nedbDatastore = require('@seald-io/nedb'); } catch (ex) { } // This is the NeDB with Node 23 support. - if (nedbDatastore == null) { - try { nedbDatastore = require('@yetzt/nedb'); } catch (ex) { } // This is the NeDB with fixed security dependencies. - if (nedbDatastore == null) { nedbDatastore = require('nedb'); } // So not to break any existing installations, if the old NeDB is present, use it. - } - + var nedbDatastore = require('nedb'); var datastoreOptions = { filename: parent.getConfigFilePath('meshcentral.db'), autoload: true }; // If a DB encryption key is provided, perform database encryption @@ -4074,16 +2569,16 @@ module.exports.CreateDB = function (parent, func) { var eventRecordsTransferCount = 0; var powerRecordsTransferCount = 0; var statsRecordsTransferCount = 0; - obj.pendingTransfer = 0; + var pendingTransfer = 0; // Transfer the data from main database nedbfile.find({}, function (err, docs) { if ((err == null) && (docs.length > 0)) { performTypedRecordDecrypt(docs) for (var i in docs) { - obj.pendingTransfer++; + pendingTransfer++; normalRecordsTransferCount++; - obj.Set(common.unEscapeLinksFieldName(docs[i]), function () { obj.pendingTransfer--; }); + obj.Set(common.unEscapeLinksFieldName(docs[i]), function () { pendingTransfer--; }); } } @@ -4091,9 +2586,9 @@ module.exports.CreateDB = function (parent, func) { nedbeventsfile.find({}, function (err, docs) { if ((err == null) && (docs.length > 0)) { for (var i in docs) { - obj.pendingTransfer++; + pendingTransfer++; eventRecordsTransferCount++; - obj.StoreEvent(docs[i], function () { obj.pendingTransfer--; }); + obj.StoreEvent(docs[i], function () { pendingTransfer--; }); } } @@ -4101,9 +2596,9 @@ module.exports.CreateDB = function (parent, func) { nedbpowerfile.find({}, function (err, docs) { if ((err == null) && (docs.length > 0)) { for (var i in docs) { - obj.pendingTransfer++; + pendingTransfer++; powerRecordsTransferCount++; - obj.storePowerEvent(docs[i], null, function () { obj.pendingTransfer--; }); + obj.storePowerEvent(docs[i], null, function () { pendingTransfer--; }); } } @@ -4111,15 +2606,15 @@ module.exports.CreateDB = function (parent, func) { nedbserverstatsfile.find({}, function (err, docs) { if ((err == null) && (docs.length > 0)) { for (var i in docs) { - obj.pendingTransfer++; + pendingTransfer++; statsRecordsTransferCount++; - obj.SetServerStats(docs[i], function () { obj.pendingTransfer--; }); + obj.SetServerStats(docs[i], function () { pendingTransfer--; }); } } // Only exit when all the records are stored. setInterval(function () { - if (obj.pendingTransfer == 0) { func("Done. " + normalRecordsTransferCount + " record(s), " + eventRecordsTransferCount + " event(s), " + powerRecordsTransferCount + " power change(s), " + statsRecordsTransferCount + " stat(s)."); } + if (pendingTransfer == 0) { func("Done. " + normalRecordsTransferCount + " record(s), " + eventRecordsTransferCount + " event(s), " + powerRecordsTransferCount + " power change(s), " + statsRecordsTransferCount + " stat(s)."); } }, 200) }); }); @@ -4131,7 +2626,6 @@ module.exports.CreateDB = function (parent, func) { // Called when a node has changed function dbNodeChange(nodeChange, added) { - if (parent.webserver == null) return; common.unEscapeLinksFieldName(nodeChange.fullDocument); const node = performTypedRecordDecrypt([nodeChange.fullDocument])[0]; parent.DispatchEvent(['*', node.meshid], obj, { etype: 'node', action: (added ? 'addnode' : 'changenode'), node: parent.webserver.CloneSafeNode(node), nodeid: node._id, domain: node.domain, nolog: 1 }); @@ -4145,23 +2639,16 @@ module.exports.CreateDB = function (parent, func) { // Update the mesh object in memory const mmesh = parent.webserver.meshes[mesh._id]; - if (mmesh != null) { - // Update an existing device group - for (var i in mesh) { mmesh[i] = mesh[i]; } - for (var i in mmesh) { if (mesh[i] == null) { delete mmesh[i]; } } - } else { - // Device group not present, create it. - parent.webserver.meshes[mesh._id] = mesh; - } + for (var i in mesh) { mmesh[i] = mesh[i]; } + for (var i in mmesh) { if (mesh[i] == null) { delete mmesh[i]; } } // Send the mesh update - var mesh2 = Object.assign({}, mesh); // Shallow clone - if (mesh2.deleted) { mesh2.action = 'deletemesh'; } else { mesh2.action = (added ? 'createmesh' : 'meshchange'); } - mesh2.meshid = mesh2._id; - mesh2.nolog = 1; - delete mesh2.type; - delete mesh2._id; - parent.DispatchEvent(['*', mesh2.meshid], obj, parent.webserver.CloneSafeMesh(mesh2)); + if (mesh.deleted) { mesh.action = 'deletemesh'; } else { mesh.action = (added ? 'createmesh' : 'meshchange'); } + mesh.meshid = mesh._id; + mesh.nolog = 1; + delete mesh.type; + delete mesh._id; + parent.DispatchEvent(['*', mesh.meshid], obj, parent.webserver.CloneSafeMesh(mesh)); } // Called when a user account has changed @@ -4169,17 +2656,11 @@ module.exports.CreateDB = function (parent, func) { if (parent.webserver == null) return; common.unEscapeLinksFieldName(userChange.fullDocument); const user = performTypedRecordDecrypt([userChange.fullDocument])[0]; - + // Update the user object in memory const muser = parent.webserver.users[user._id]; - if (muser != null) { - // Update an existing user - for (var i in user) { muser[i] = user[i]; } - for (var i in muser) { if (user[i] == null) { delete muser[i]; } } - } else { - // User not present, create it. - parent.webserver.users[user._id] = user; - } + for (var i in user) { muser[i] = user[i]; } + for (var i in muser) { if (user[i] == null) { delete muser[i]; } } // Send the user update var targets = ['*', 'server-users', user._id]; @@ -4195,29 +2676,16 @@ module.exports.CreateDB = function (parent, func) { // Update the user group object in memory const uusergroup = parent.webserver.userGroups[usergroup._id]; - if (uusergroup != null) { - // Update an existing user group - for (var i in usergroup) { uusergroup[i] = usergroup[i]; } - for (var i in uusergroup) { if (usergroup[i] == null) { delete uusergroup[i]; } } - } else { - // Usergroup not present, create it. - parent.webserver.userGroups[usergroup._id] = usergroup; - } + for (var i in usergroup) { uusergroup[i] = usergroup[i]; } + for (var i in uusergroup) { if (usergroup[i] == null) { delete uusergroup[i]; } } // Send the user group update - var usergroup2 = Object.assign({}, usergroup); // Shallow clone - usergroup2.action = (added ? 'createusergroup' : 'usergroupchange'); - usergroup2.ugrpid = usergroup2._id; - usergroup2.nolog = 1; - delete usergroup2.type; - delete usergroup2._id; - parent.DispatchEvent(['*', usergroup2.ugrpid], obj, usergroup2); - } - - function dbMergeSqlArray(arr) { - var x = ''; - for (var i in arr) { if (x != '') { x += ','; } x += '\'' + arr[i] + '\''; } - return x; + usergroup.action = (added ? 'createusergroup' : 'usergroupchange'); + usergroup.ugrpid = usergroup._id; + usergroup.nolog = 1; + delete usergroup.type; + delete usergroup._id; + parent.DispatchEvent(['*', usergroup.ugrpid], obj, usergroup); } return obj; diff --git a/dependencies.txt b/dependencies.txt index 6bf8bcdd..5a3021e9 100644 --- a/dependencies.txt +++ b/dependencies.txt @@ -1,16 +1,15 @@ - "@seald-io/nedb": "4.0.4", - "archiver": "7.0.1", - "body-parser": "1.20.3", - "cbor": "5.2.0", - "compression": "1.7.5", - "cookie-session": "2.1.0", - "express": "4.21.2", - "express-handlebars": "7.1.3", - "express-ws": "5.0.2", - "ipcheck": "0.1.0", - "minimist": "1.2.8", - "multiparty": "4.2.3", - "node-forge": "1.3.1", - "ua-parser-js": "1.0.39", - "ws": "8.18.0", - "yauzl": "2.10.0" \ No newline at end of file + "archiver": "^5.3.1", + "body-parser": "^1.19.0", + "cbor": "~5.2.0", + "compression": "^1.7.4", + "cookie-session": "^1.4.0", + "express": "^4.17.0", + "express-handlebars": "^5.3.5", + "express-ws": "^4.0.0", + "ipcheck": "^0.1.0", + "minimist": "^1.2.5", + "multiparty": "^4.2.1", + "@yetzt/nedb": "^1.8.0", + "node-forge": "^1.0.0", + "ws": "^5.2.3", + "yauzl": "^2.10.0" \ No newline at end of file diff --git a/docker/BUILD.md b/docker/BUILD.md deleted file mode 100644 index 1b100795..00000000 --- a/docker/BUILD.md +++ /dev/null @@ -1,29 +0,0 @@ -# How to create a docker image for meshcentral - -``` -> git clone https://github.com/Ylianst/MeshCentral.git -> cd MeshCentral - -> docker build -f docker/Dockerfile --force-rm -t meshcentral . - -# alternative, if you want to include the mongodb-tools (mongodump, ...), you can add the 'INCLUDE_MONGODBTOOLS=yes' build argument -> docker build -f docker/Dockerfile --force-rm --build-arg INCLUDE_MONGODBTOOLS=yes -t meshcentral . - -# (optional) cleanup after docker build: -> cd .. -> rm -rf MeshCentral/ -``` - -> | Argument | Description | -> | :--- | :--- | -> | -f docker/Dockerfile | Path/Name of the Dockerfile | -> | --force-rm | Always remove intermediate containers | -> | -t meshcentral | Name and optionally a tag in the 'name:tag' format | - -### Optional build arguments -> | Argument | Description | -> | :--- | :--- | -> | INCLUDE_MONGODBTOOLS=yes | Includes mongodb-tools (mongodump, ...) in the image | -> | DISABLE_MINIFY=yes | Disables the minification of files | -> | DISABLE_TRANSLATE=yes | Disables the translation of files | - diff --git a/docker/Dockerfile b/docker/Dockerfile index 26806e1d..c10a7a4c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,94 +1,66 @@ -FROM --platform=$BUILDPLATFORM node:22-alpine AS builder +FROM node:current-alpine AS base -RUN mkdir -p /opt/meshcentral/meshcentral -COPY ./ /opt/meshcentral/meshcentral/ +#Add non-root user, add installation directories and assign proper permissions +RUN mkdir -p /opt/meshcentral + +# meshcentral installation WORKDIR /opt/meshcentral +RUN apk add --no-cache bash + + +FROM base AS builder + ARG DISABLE_MINIFY="" ARG DISABLE_TRANSLATE="" +RUN mkdir /opt/meshcentral/meshcentral +COPY ./ /opt/meshcentral/meshcentral/ RUN if ! [ -z "$DISABLE_MINIFY" ] && [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ] \ && [ "$DISABLE_MINIFY" != "true" ] && [ "$DISABLE_MINIFY" != "TRUE" ]; then \ - echo -e "\e[0;31;49mInvalid value for build argument DISABLE_MINIFY, possible values: yes/true\e[;0m"; exit 1; \ + echo -e "\e[0;31;49mInvalid value for build argument DISABLE_MINIFY, possible values: yes/true\e[;0m"; exit 1; \ fi RUN if ! [ -z "$DISABLE_TRANSLATE" ] && [ "$DISABLE_TRANSLATE" != "yes" ] && [ "$DISABLE_TRANSLATE" != "YES" ] \ && [ "$DISABLE_TRANSLATE" != "true" ] && [ "$DISABLE_TRANSLATE" != "TRUE" ]; then \ - echo -e "\e[0;31;49mInvalid value for build argument DISABLE_TRANSLATE, possible values: yes/true\e[;0m"; exit 1; \ + echo -e "\e[0;31;49mInvalid value for build argument DISABLE_TRANSLATE, possible values: yes/true\e[;0m"; exit 1; \ fi -# install translate/minify modules if need too -RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral && npm install html-minifier@4.0.0 jsdom@22.1.0 esprima@4.0.1; fi - -# first extractall if need too -RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; fi +# first try throws Error: Cannot find module 'jsdom' +RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; exit 0; fi # minify files RUN if [ -z "$DISABLE_MINIFY" ]; then cd meshcentral/translate && node translate.js minifyall; fi # translate +RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; fi RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js translateall; fi -# cleanup -RUN rm -rf /opt/meshcentral/meshcentral/docker -RUN rm -rf /opt/meshcentral/meshcentral/node_modules - -FROM --platform=$TARGETPLATFORM alpine:3.21 - -#Add non-root user, add installation directories and assign proper permissions -RUN mkdir -p /opt/meshcentral/meshcentral - -# meshcentral installation -WORKDIR /opt/meshcentral - -RUN apk update \ - && apk add --no-cache --update tzdata nodejs npm bash python3 make gcc g++ \ - && rm -rf /var/cache/apk/* -RUN npm install -g npm@latest +FROM base ARG INCLUDE_MONGODBTOOLS="" -ARG PREINSTALL_LIBS="false" - -# environment variables -ENV NODE_ENV="production" -ENV CONFIG_FILE="config.json" - -# environment variables for initial configuration file -ENV USE_MONGODB="false" -ENV MONGO_INITDB_ROOT_USERNAME="root" -ENV MONGO_INITDB_ROOT_PASSWORD="pass" -ENV MONGO_URL="" -ENV HOSTNAME="localhost" -ENV ALLOW_NEW_ACCOUNTS="true" -ENV ALLOWPLUGINS="false" -ENV LOCALSESSIONRECORDING="true" -ENV MINIFY="false" -ENV WEBRTC="false" -ENV IFRAME="false" -ENV SESSION_KEY="" -ENV REVERSE_PROXY="false" -ENV REVERSE_PROXY_TLS_PORT="" -ENV ARGS="" - RUN if ! [ -z "$INCLUDE_MONGODBTOOLS" ] && [ "$INCLUDE_MONGODBTOOLS" != "yes" ] && [ "$INCLUDE_MONGODBTOOLS" != "YES" ] \ && [ "$INCLUDE_MONGODBTOOLS" != "true" ] && [ "$INCLUDE_MONGODBTOOLS" != "TRUE" ]; then \ - echo -e "\e[0;31;49mInvalid value for build argument INCLUDE_MONGODBTOOLS, possible values: yes/true\e[;0m"; exit 1; \ + echo -e "\e[0;31;49mInvalid value for build argument INCLUDE_MONGODBTOOLS, possible values: yes/true\e[;0m"; exit 1; \ fi RUN if ! [ -z "$INCLUDE_MONGODBTOOLS" ]; then apk add --no-cache mongodb-tools; fi # copy files from builder-image COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral -COPY ./docker/startup.sh ./startup.sh -COPY ./docker/config.json.template /opt/meshcentral/config.json.template +COPY --from=builder /opt/meshcentral/meshcentral/docker/startup.sh ./startup.sh +COPY --from=builder /opt/meshcentral/meshcentral/docker/config.json.template /opt/meshcentral/config.json.template + +# cleanup +RUN rm -rf /opt/meshcentral/meshcentral/docker +RUN rm -rf /opt/meshcentral/meshcentral/node_modules # install dependencies from package.json RUN cd meshcentral && npm install -# NOTE: ALL MODULES MUST HAVE A VERSION NUMBER AND THE VERSION MUST MATCH THAT USED IN meshcentral.js mainStart() -RUN if ! [ -z "$INCLUDE_MONGODBTOOLS" ]; then cd meshcentral && npm install mongodb@4.13.0 saslprep@1.0.3; fi -RUN if ! [ -z "$PREINSTALL_LIBS" ] && [ "$PREINSTALL_LIBS" == "true" ]; then cd meshcentral && npm install ssh2@1.16.0 semver@7.5.4 nodemailer@6.9.15 image-size@1.1.1 wildleek@2.0.0 otplib@10.2.3 yubikeyotp@0.2.0; fi +# install dependencies for plugins +RUN cd meshcentral && npm install nedb EXPOSE 80 443 4433 @@ -96,6 +68,6 @@ EXPOSE 80 443 4433 VOLUME /opt/meshcentral/meshcentral-data VOLUME /opt/meshcentral/meshcentral-files VOLUME /opt/meshcentral/meshcentral-web -VOLUME /opt/meshcentral/meshcentral-backups +VOLUME /opt/meshcentral/meshcentral-backup CMD ["bash", "/opt/meshcentral/startup.sh"] diff --git a/docker/config.json.template b/docker/config.json.template index cef4ad33..e463ef4c 100644 --- a/docker/config.json.template +++ b/docker/config.json.template @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json", + "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json", "settings": { "plugins":{"enabled": false}, "_mongoDb": null, @@ -21,9 +21,9 @@ "": { "_title": "MyServer", "_title2": "Servername", - "minify": false, + "minify": true, "NewAccounts": true, - "localSessionRecording": true, + "localSessionRecording": false, "_userNameIsEmail": true, "_certUrl": "my.reverse.proxy" } diff --git a/docker/docker.build.sh b/docker/docker.build.sh index e025ea35..ddbc1b12 100644 --- a/docker/docker.build.sh +++ b/docker/docker.build.sh @@ -2,9 +2,9 @@ MSG=""; PRUNE="false"; -OVERRIDE_TAGS="false"; -ENABLE_LOG="false"; -LOG_FILE="$(dirname -- "$( readlink -f -- "$0"; )")/build.log"; + +LOG_FILE="" +#LOG_FILE="$(dirname -- "$( readlink -f -- "$0"; )")/build.log"; function appendOutput() { @@ -12,35 +12,23 @@ function appendOutput() ARGS=$@; LINE="${ARGS}\n"; - if [ -z "${ENABLE_LOG}" ] || [ "${ENABLE_LOG}" != "true" ]; then echo -e "${LINE}" > /dev/tty; else echo -e "${LINE}" 2>&1 | tee -a ${LOG_FILE}; fi + if [ -z "${LOG_FILE}" ]; then echo -e "${LINE}" > /dev/tty; else echo -e "${LINE}" &>> "${LOG_FILE}"; fi MSG="${MSG}${LINE}"; } function runDockerBuild() { - if [ "${PRUNE}" == "true" ]; then - if [ -z "${ENABLE_LOG}" ] || [ "${ENABLE_LOG}" != "true" ]; then docker system prune -a -f; - else docker system prune -a -f | tee -a ${LOG_FILE}; fi - fi + if [ "${PRUNE}" == "true" ]; then docker system prune -a -f; fi STARTTS=$(date +%s); ARGS=$@; - APP_VERSION=$(grep -o '"version":\s*"[^"]*"' ./package.json | cut -f4- -d\" | tr -d '"'); - BASE_TAGS=""; - if [ -z "${OVERRIDE_TAGS}" ] || [ "${OVERRIDE_TAGS}" != "true" ]; then - BASE_TAGS="-t meshcentral:latest -t meshcentral:${APP_VERSION}"; - fi - - BUILD_CMD="docker build -f docker/Dockerfile --force-rm --no-cache ${ARGS} ${BASE_TAGS} ."; + BUILD_CMD="docker build -f docker/Dockerfile --force-rm --no-cache ${ARGS} -t meshcentral ."; appendOutput "Current build: ${BUILD_CMD}"; - if [ -z "${ENABLE_LOG}" ] || [ "${ENABLE_LOG}" != "true" ]; then ${BUILD_CMD}; else ${BUILD_CMD} | tee -a ${LOG_FILE}; fi + if [ -z "${LOG_FILE}" ]; then ${BUILD_CMD}; else ${BUILD_CMD} &>> "${LOG_FILE}"; fi if [ $? -ne 0 ]; then exit $?; fi - - IMAGEID=$(docker images --format "{{.ID}} {{.CreatedAt}}" | sort -rk 2 | awk 'NR==1{print $1}'); - appendOutput "\tImageId: ${IMAGEID}"; ENDTS=$(date +%s); DIFSEC=$((${ENDTS}-${STARTTS})); @@ -56,7 +44,7 @@ function runDockerBuild() else appendOutput "\tBuild time: ${TMPMIN} min ${TMPSEC} sec"; fi else appendOutput "\tBuild time: ${DIFSEC} sec"; fi - IMG_SIZE=$(docker image inspect ${IMAGEID} | grep -o '"Size":\s*[^,]*' | cut -f2- -d ':' | tr -d ' '); + IMG_SIZE=$(docker image inspect meshcentral | grep -e "\"Size\"" | tr -d '",' | sed -E "s/\s*Size:\s*//"); expr $IMG_SIZE + 0 > /dev/null; appendOutput "\tImage size: ${IMG_SIZE} ($((${IMG_SIZE}/1024/1024))M)\n"; @@ -69,64 +57,19 @@ if [ "${parent_path}" != "$(pwd -P)" ]; then cd "${parent_path}"; fi -if ! [ -z $1 ]; then - for arg in "$@" - do - case "${arg}" in - --prune) - PRUNE="true"; - shift 1; - ;; - --log) - ENABLE_LOG="true"; - shift 1; - ;; - --no-tags) - OVERRIDE_TAGS="true"; - shift 1; - ;; - --help) - __usage="\n - Usage: ./$(basename ${0}) [OPTIONS] [BUILD ARGUMENTS]\n - \n - Options:\n - \t--log \t\twrite output to build.log file\n - \t--no-tags \tdo not use default tags (meshcentral:latest and meshcentral:%VERSION%)\n - \t--prune \tWARNING: This will remove:\n - \t\t\t - all stopped docker containers\n - \t\t\t - all docker networks not used by at least one container\n - \t\t\t - all docker images without at least one container associated to them\n - \t\t\t - all docker build cache\n - \n - Build arguments: \tAll build arguments are forwarded to the docker build command, so you can use any option accepted by 'docker build'\n - \t\t\t(https://docs.docker.com/engine/reference/commandline/build/#options)\n\n - \t--build-arg INCLUDE_MONGODBTOOLS=yes \tIncludes mongodb-tools (mongodump, ...) in the image\n - \t--build-arg DISABLE_MINIFY=yes \t\tDisables minification of files\n - \t--build-arg DISABLE_TRANSLATE=yes \tDisables translation of files\n - "; - echo -e $__usage; - exit 0; - ;; - *) - break; - ;; - esac - done -fi +if ! [ -z $1 ] && [ "${1}" == "prune" ]; then PRUNE="true"; fi -MAINARGS=$@; +#runDockerBuild --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes; +#runDockerBuild --build-arg DISABLE_TRANSLATE=yes; +#runDockerBuild --build-arg DISABLE_MINIFY=yes; +runDockerBuild; -#runDockerBuild --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes ${MAINARGS}; -#runDockerBuild --build-arg DISABLE_TRANSLATE=yes ${MAINARGS}; -#runDockerBuild --build-arg DISABLE_MINIFY=yes ${MAINARGS}; -runDockerBuild ${MAINARGS}; - -#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes ${MAINARGS}; -#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_TRANSLATE=yes ${MAINARGS}; -#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes ${MAINARGS}; -#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes ${MAINARGS}; +#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes; +#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_TRANSLATE=yes; +#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes; +#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes; echo ""; -if [ -z "${ENABLE_LOG}" ] || [ "${ENABLE_LOG}" != "true" ]; then echo -e "${MSG}"; else echo -e "${MSG}" 2>&1 | tee -a ${LOG_FILE}; fi +echo -e "${MSG}"; exit 0; diff --git a/docker/readme.md b/docker/readme.md index 06bb43d1..c79d538b 100644 --- a/docker/readme.md +++ b/docker/readme.md @@ -1,3 +1,33 @@ + +# How to create a docker image for meshcentral + +``` +> git clone https://github.com/Ylianst/MeshCentral.git +> cd MeshCentral + +> docker build -f docker/Dockerfile --force-rm -t meshcentral . + +# alternative, if you want to include the mongodb-tools (mongodump, ...), you can add the 'INCLUDE_MONGODBTOOLS=yes' build argument +> docker build -f docker/Dockerfile --force-rm --build-arg INCLUDE_MONGODBTOOLS=yes -t meshcentral . + +# (optional) cleanup after docker build: +> cd .. +> rm -rf MeshCentral/ +``` + +> | Argument | Description | +> | :--- | :--- | +> | -f docker/Dockerfile | Path/Name of the Dockerfile | +> | --force-rm | Always remove intermediate containers | +> | -t meshcentral | Name and optionally a tag in the 'name:tag' format | + +### Optional build arguments +> | Argument | Description | +> | :--- | :--- | +> | INCLUDE_MONGODBTOOLS=yes | Includes mongodb-tools (mongodump, ...) in the image | +> | DISABLE_MINIFY=yes | Disables the minification of files | +> | DISABLE_TRANSLATE=yes | Disables the translation of files | + # Create folder-structure and files ``` @@ -10,18 +40,12 @@ | - docker-compose.yml ``` -# Templates - -## .env -You can place the `config.json` file directly under `./meshcentral/data/`, or use the following `.env` file instead. - +# Templates: +## .env: ```ini NODE_ENV=production -USE_MONGODB=false -# set already exist mongo connection string url here -MONGO_URL= -# or set following init params for new mongodb, use it with docker-compose file with mongodb version +# initial mongodb-variables MONGO_INITDB_ROOT_USERNAME=mongodbadmin MONGO_INITDB_ROOT_PASSWORD=mongodbpasswd @@ -30,14 +54,15 @@ MONGO_INITDB_ROOT_PASSWORD=mongodbpasswd # your hostname HOSTNAME=my.domain.com -# set to your reverse proxy IP if you want to put meshcentral behind a reverse proxy +USE_MONGODB=false +# set to your reverse proxy IP if you want to put meshcentral behind a reverse proxy REVERSE_PROXY=false REVERSE_PROXY_TLS_PORT= # set to true if you wish to enable iframe support IFRAME=false # set to false if you want disable self-service creation of new accounts besides the first (admin) ALLOW_NEW_ACCOUNTS=true -# set to true to enable WebRTC - per documentation it is not officially released with meshcentral and currently experimental. Use with caution +# set to true to enable WebRTC - per documentation it is not officially released with meshcentral, but is solid enough to work with. Use with caution WEBRTC=false # set to true to allow plugins ALLOWPLUGINS=false @@ -45,12 +70,9 @@ ALLOWPLUGINS=false LOCALSESSIONRECORDING=false # set to enable or disable minification of json, reduces traffic MINIFY=true -# set this value to add extra arguments to meshcentral on startup (e.g --debug ldap) -ARGS= ``` -## docker-compose.yml - +## docker-compose.yml: ```yaml version: '3' @@ -58,8 +80,7 @@ services: meshcentral: restart: always container_name: meshcentral - # use the official meshcentral container - image: ghcr.io/ylianst/meshcentral:latest + image: meshcentral ports: # MeshCentral will moan and try everything not to use port 80, but you can also use it if you so desire, just change the config.json according to your needs - 8086:443 @@ -71,13 +92,12 @@ services: # where file uploads for users live - ./meshcentral/user_files:/opt/meshcentral/meshcentral-files # location for the meshcentral-backups - this should be mounted to an external storage - - ./meshcentral/backup:/opt/meshcentral/meshcentral-backups + - ./meshcentral/backup:/opt/meshcentral/meshcentral-backup # location for site customization files - ./meshcentral/web:/opt/meshcentral/meshcentral-web ``` -## docker-compose.yml mongodb - +## docker-compose.yml mongodb: ```yaml version: '3' @@ -101,8 +121,7 @@ services: meshcentral: restart: always container_name: meshcentral - # use the official meshcentral container - image: ghcr.io/ylianst/meshcentral:latest + image: meshcentral depends_on: - mongodb ports: @@ -116,7 +135,7 @@ services: # where file uploads for users live - ./meshcentral/user_files:/opt/meshcentral/meshcentral-files # location for the meshcentral-backups - this should be mounted to an external storage - - ./meshcentral/backup:/opt/meshcentral/meshcentral-backups + - ./meshcentral/backup:/opt/meshcentral/meshcentral-backup # location for site customization files - ./meshcentral/web:/opt/meshcentral/meshcentral-web networks: diff --git a/docker/startup.sh b/docker/startup.sh index da3f0b34..2510d033 100644 --- a/docker/startup.sh +++ b/docker/startup.sh @@ -1,34 +1,36 @@ #!/bin/bash -if [ -f "meshcentral-data/${CONFIG_FILE}" ]; then - node meshcentral/meshcentral --configfile "${CONFIG_FILE}" ${ARGS} -else - cp config.json.template meshcentral-data/"${CONFIG_FILE}" - if [ -n "$USE_MONGODB" ] && [ "$USE_MONGODB" == "true" ]; then - if [ -z "$MONGO_URL" ]; then - prefix="" - if [ -n "$MONGO_INITDB_ROOT_USERNAME" ] && [ -n "$MONGO_INITDB_ROOT_PASSWORD" ]; then - prefix="$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@" - fi - MONGO_URL="${prefix}mongodb:27017" +export NODE_ENV=production + +export HOSTNAME +export REVERSE_PROXY +export REVERSE_PROXY_TLS_PORT +export IFRAME +export ALLOW_NEW_ACCOUNTS +export WEBRTC +export MONGO_INITDB_ROOT_USERNAME +export MONGO_INITDB_ROOT_PASSWORD +export USE_MONGODB + +if [ -f "meshcentral-data/config.json" ] + then + node meshcentral/meshcentral + else + cp config.json.template meshcentral-data/config.json + if ! [ -z "$USE_MONGODB" ] && [ "$USE_MONGODB" == "true" ]; then + sed -i "s/\"_mongoDb\": null/\"mongoDb\": \"mongodb:\/\/$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017\"/" meshcentral-data/config.json fi - sed -i "s/\"_mongoDb\": null/\"mongoDb\": \"mongodb:\/\/$MONGO_URL\"/" meshcentral-data/"${CONFIG_FILE}" - fi - sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/"${CONFIG_FILE}" - sed -i "s/\"NewAccounts\": true/\"NewAccounts\": $ALLOW_NEW_ACCOUNTS/" meshcentral-data/"${CONFIG_FILE}" - sed -i "s/\"enabled\": false/\"enabled\": $ALLOWPLUGINS/" meshcentral-data/"${CONFIG_FILE}" - sed -i "s/\"localSessionRecording\": false/\"localSessionRecording\": $LOCALSESSIONRECORDING/" meshcentral-data/"${CONFIG_FILE}" - sed -i "s/\"minify\": false/\"minify\": $MINIFY/" meshcentral-data/"${CONFIG_FILE}" - sed -i "s/\"WebRTC\": false/\"WebRTC\": $WEBRTC/" meshcentral-data/"${CONFIG_FILE}" - sed -i "s/\"AllowFraming\": false/\"AllowFraming\": $IFRAME/" meshcentral-data/"${CONFIG_FILE}" - if [ -z "$SESSION_KEY" ]; then - SESSION_KEY="$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 48 | head -n 1)" - fi - sed -i "s/\"_sessionKey\": \"MyReallySecretPassword1\"/\"sessionKey\": \"$SESSION_KEY\"/" meshcentral-data/"${CONFIG_FILE}" - if [ "$REVERSE_PROXY" != "false" ]; then - sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/"${CONFIG_FILE}" - node meshcentral/meshcentral --configfile "${CONFIG_FILE}" ${ARGS} - exit - fi - node meshcentral/meshcentral --configfile "${CONFIG_FILE}" --cert "$HOSTNAME" ${ARGS} -fi + sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/config.json + sed -i "s/\"NewAccounts\": true/\"NewAccounts\": \"$ALLOW_NEW_ACCOUNTS\"/" meshcentral-data/config.json + sed -i "s/\"enabled\": false/\"enabled\": \"$ALLOWPLUGINS\"/" meshcentral-data/config.json + sed -i "s/\"localSessionRecording\": false/\"localSessionRecording\": \"$LOCALSESSIONRECORDING\"/" meshcentral-data/config.json + sed -i "s/\"minify\": true/\"minify\": \"$MINIFY\"/" meshcentral-data/config.json + sed -i "s/\"WebRTC\": false/\"WebRTC\": \"$WEBRTC\"/" meshcentral-data/config.json + sed -i "s/\"AllowFraming\": false/\"AllowFraming\": \"$IFRAME\"/" meshcentral-data/config.json + if [ "$REVERSE_PROXY" != "false" ]; then + sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/config.json + node meshcentral/meshcentral + exit + fi + node meshcentral/meshcentral --cert "$HOSTNAME" +fi \ No newline at end of file diff --git a/docs/Example configs/haproxy-with-sni-sample.cfg b/docs/Example configs/haproxy-with-sni-sample.cfg deleted file mode 100644 index 456c7466..00000000 --- a/docs/Example configs/haproxy-with-sni-sample.cfg +++ /dev/null @@ -1,55 +0,0 @@ -# Uses proxy protocol in HAProxy in combination with SNI to preserve the original host address -# Update the config.json to work with HAProxy -# Specify the IP addrehostname that the traffic will come from HAProxy (this might not be the address that is bound to the listener) -# "tlsOffload": "10.1.1.10", -# -# Specify the HAPRoxy URL with the hostname to get the certificate -# "certUrl": "https://mc.publicdomain.com:443/" - -frontend sni-front - bind 10.1.1.10:443 - mode tcp - tcp-request inspect-delay 5s - tcp-request content accept if { req_ssl_hello_type 1 } - default_backend sni-back - -backend sni-back - mode tcp - acl gitlab-sni req_ssl_sni -i gitlab.publicdomain.com - acl mc-sni req_ssl_sni -i mc.publicdomain.com - use-server gitlabSNI if gitlab-sni - use-server mc-SNI if mc-sni - server mc-SNI 10.1.1.10:1443 send-proxy-v2-ssl-cn - -frontend cira-tcp-front - bind 10.1.1.10:4433 - mode tcp - option tcplog - tcp-request inspect-delay 5s - default_backend mc-cira-back - -backend cira-tcp-back - mode tcp - server mc-cira 10.1.1.30:4433 - -frontend mc-front-HTTPS - mode http - option forwardfor - bind 10.1.1.10:1443 ssl crt /etc/haproxy/vm.publicdomain.net.pem accept-proxy - http-request set-header X-Forwarded-Proto https - option tcpka - default_backend mc-back-HTTP - -backend mc-back-HTTPS - mode http - option forwardfor - http-request add-header X-Forwarded-Host %[req.hdr(Host)] - option http-server-close - server mc-01 10.1.1.30:443 check port 443 verify none - -# In the event that it is required to have TLS between HAProxy and Meshcentral, -# Remove the tls_Offload line and replace with trustedProxy -# Specify the IP addrehostname that the traffic will come from HAProxy (this might not be the address that is bound to the listener) -# "trustedProxy": "10.1.1.10", -# and change the last line of backend mc-back-HTTPS to use HTTPS by adding the ssl keyword -# server mc-01 10.1.1.30:443 check ssl port 443 verify none diff --git a/docs/docs/design/index.md b/docs/docs/design/index.md index 8ce7f819..6c90729a 100644 --- a/docs/docs/design/index.md +++ b/docs/docs/design/index.md @@ -2,7 +2,7 @@ ![](images/2022-05-15-12-57-36.png) -Design and Architecture Guide [as .pdf](https://meshcentral.com/docs/MeshCentral2DesignArchitecture.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCentral Design & Architecture v0.0.4.odt?raw=true) +Design and Architecture Guide [as .pdf](https://meshcentral.com/info/docs/MeshCentral2DesignArchitecture.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCentral Design & Architecture v0.0.4.odt?raw=true) ## Video Walkthru
@@ -108,46 +108,29 @@ Someone would think the server is rather simple when taking a look at the MeshCe ### Code files ``` - amtevents.js | Used to decode Intel AMT WSMAN events. - amtmanager.js | Used to handle Intel AMT/CIRA things. - amtprovisioningserver.js | Used to Provision Intel AMT on a Local Network. - amtscanner.js | Used to scan a local network for Intel AMT machines. - amtscript.js | Used to run Intel AMT scripts from MeshCommander. - certoperations.js | Used to generate and perform certificate operations. - common.js | Various commonly used methods. - crowdsec.js | Used to handle all crowdsec security features - db.js | Used to access the MongoDB or NeDB database. - exeHandler.js | Used to modify windows executables. - firebase.js | Used to handle Google Firebase things. - interceptor.js | Used to insert credentials in an HTTP stream. - letsencrypt.js | Used to obtain and use a Let’s Encrypt certificate. - mcrec.js | Standalone Session Recording Indexer. - meshaccelerator.js | Used to offload RSA sign to other CPU cores. - meshagent.js | Used to communicate to agents. - meshbot.js | Sample bot to connect to meshcentral and preform various tasks - meshcentral.js | The is the main module, gets the server started. - meshctrl.js | MeshCtrl performs command line actions on a MeshCentral server. - meshcore.js | Main Agent Code that runs on your remote devices. - meshdesktopmultiplex.js | Used to handle remote desktop multiplexing. - meshdevicefile.js | Used to handle file download requests. - meshipkvm.js | Used to handle IP KVM integration - meshmail.js | Used to send SMTP mails. - meshmessaging.js | Used to handle all users messaging methods like 2FA. - meshrelay.js | Used to relay agent and browser web socket connections. - meshscanner.js | MeshCentral server discovery when in LAN mode. - meshsms.js | Used to handle all users sms methods. - meshuser.js | Used to communicate with browsers. - mpsserver.js | Used to communicate to Intel® AMT CIRA. - mqttbroker.js | Used to create/handle an MQTT broker (beta) - multiserver.js | Used for server-to-server communication. - pass.js | Performs password hash + salt. - redirserver.js | Used to handle HTTP traffic. - swarmserver.js | Used to upgrade legacy MeshCentralv1 agents. - webauthn.js | Handles all WebAuthN things. - webrelayserver.js | Used for all HTTP/HTTPS web relaying from agents. - webserver.js | Handles HTTPS traffic. - winservice.js | Server background install on Windows. - + amtevents.js | Used to scan a local network for Intel AMT machines. + amtscanner.js | Used to run Intel AMT scripts from MeshCommander. + amtscript.js | Used to generate and perform certificate operations. + certoperations.js | Various commonly used methods. + common.js | Used to access the MongoDB or NeDB database. + db.js | Used to modify windows executables. + exeHandler.js | Used to insert credentials in an HTTP stream. + interceptor.js | Used to obtain and use a Let’s Encrypt certificate. + letsencrypt.js | Used to offload RSA sign to other CPU cores. + meshaccelerator.js | Used to communicate to agents. + meshagent.js | The is the main module, gets the server started. + meshcentral.js | Used to send SMTP mails. + meshmail.js | Used to relay agent and browser web socket connections. + meshrelay.js | MeshCentral server discovery when in LAN mode. + meshscanner.js | Used to communicate with browsers. + meshuser.js | Used to communicate to Intel® AMT CIRA. + mpsserver.js | Used for server-to-server communication. + multiserver.js | Performs password hash + salt. + pass.js | Used to handle HTTP traffic. + redirserver.js | Used to upgrade legacy MeshCentralv1 agents. + swarmserver.js | Handles HTTPS traffic. + webserver.js | Server background install on Windows. + winservice.js | Server background install on Windows. ``` At a high level, the MeshCentral.js file will get the server started. By default, it will start the webserver.js on port 443, redirectserver.js on port 80 and mpssrver.js on port 4433. The webserver.js file will create a meshuser.js or meshagent.js instance each time a user or agent connects. The other files support various usages, but this is the basic working on the server. diff --git a/docs/docs/how-to-contribute/images/translation-msg-output.png b/docs/docs/how-to-contribute/images/translation-msg-output.png deleted file mode 100644 index ab94a484..00000000 Binary files a/docs/docs/how-to-contribute/images/translation-msg-output.png and /dev/null differ diff --git a/docs/docs/how-to-contribute/index.md b/docs/docs/how-to-contribute/index.md deleted file mode 100644 index ed3d87aa..00000000 --- a/docs/docs/how-to-contribute/index.md +++ /dev/null @@ -1,56 +0,0 @@ -# Contribute to MeshCentral - -## Contributing to MeshCentral via GitHub Pull Request - -If you're looking to contribute beyond translations, such as updating documentation or enhancing the software by adding features or fixing bugs, the process involves several key steps: - -1. **Fork the Repository:** Start by forking the [MeshCentral](https://github.com/Ylianst/MeshCentral) repository on GitHub. This creates a copy of the repository under your own GitHub account, allowing you to make changes without affecting the original project. - -2. **Make Your Changes** - - In your forked repository, create a new branch to keep your changes organized. This helps in managing different contributions separately. - - Make the necessary changes in your repository. This could involve updating documentation files or modifying code to add new features or fix bugs. - -3. **Review Your Changes:** Before submitting your work, carefully review the changes you’ve made. Check the "Files Changed" section on GitHub to ensure that all modifications are intended and correctly implemented. - -4. **Submit a Pull Request** - - Once your changes are ready and reviewed, submit a pull request (PR) from your branch to the `master` branch of the main MeshCentral repository. - - When creating the pull request, provide a clear and detailed description of what changes have been made and why. This helps maintainers understand the purpose of your contributions. - -5. **Wait for Review:** After submitting your pull request, wait for a project maintainer to review your contribution. Review time can vary depending on the complexity of the changes and the availability of the maintainers. - -6. **Respond to Feedback:** The maintainer may request further modifications or provide feedback on your pull request. Be prepared to make additional changes based on their suggestions to ensure that your contribution meets the project’s standards and requirements. - -7. **Final Steps:** Once your pull request is approved and merged by a maintainer, your contributions will be incorporated into the MeshCentral project. Congratulations, and thank you for helping improve MeshCentral! - ---- - -## Contribute to MeshCentral's Multilingual Support - -To make MeshCentral multilingual, your contributions are crucial. Follow these steps to translate the interface into various languages. - -1. **Remove Local Translations:** Delete `translate.json` from your `meshcentral-data` folder. This file contains your local copy of translations, which may become outdated as new features and texts are added. - -2. **Access MeshCentral:** Ensure you are logged into MeshCentral. -3. **Open Translation Tool:** Visit `https://YOURMESHCENTRALSERVER.COM/translator.htm` to access the translation interface. -4. **Choose a Language:** Select the language you wish to translate from the list provided. - -5. **Translate Text:** Use the search function or scroll through the list to find text segments you want to translate. Utilize the "show no translations only" checkbox to filter untranslated texts. -6. **Enter Translations:** For each text segment, enter your translation in the bottom box (not the top one) and click `SET (F1)`. -7. **Repeat Translation:** Continue translating by repeating steps 5 and 6 for other texts as desired. - -8. **Save and Apply Translations** - - Click `SAVE TO SERVER (F3)` to save your translations to `meshcentral-data/translate.json` locally in your MeshCentral server. - - Optionally, click `SAVE TO FILE (F4)` to download the `translate.json` file for offline review or sharing. - -9. **Deploy Translations:** Click `TRANSLATE SERVER` and allow some time for the process to complete (approximately 5-15 minutes depending on server specifications). This command line output will indicate when the translation is complete. -![](images/translation-msg-output.png) - -10. **Finalize Changes:** It’s crucial to restart MeshCentral to ensure that the translated files are picked up correctly. -11. **Share your translations:** Once a language translation is complete, take the latest `translation.json` and share it by emailing it to the maintainer (Ylianst, `ylianst@gmail.com`) or by submitting it to the MeshCentral GitHub repository via a pull request. - ---- - -#### Additional Information: - - If you make any changes to `default.handlebars`, run the translate server to propagate these modifications to the language-specific handlebar files located in `node_modules/meshcentral/views/translations`. - -By following these steps, you help MeshCentral support any language you choose, making it more accessible worldwide. By sharing your translations with us, you also help make these languages available to other users, improving the community and extending the software's reach. diff --git a/docs/docs/images/2022-08-04-18-19-19.png b/docs/docs/images/2022-08-04-18-19-19.png deleted file mode 100644 index f2e6b19f..00000000 Binary files a/docs/docs/images/2022-08-04-18-19-19.png and /dev/null differ diff --git a/docs/docs/index.md b/docs/docs/index.md index fabdc903..c9b2b71b 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -4,6 +4,8 @@ MeshCentral is a full computer management web site. With MeshCentral, you can run your own web server to remotely manage and control computers on a local network or anywhere on the internet. Once you get the server started, create device group and download and install an agent on each computer you want to manage. A minute later, the new computer will show up on the web site and you can take control of it. MeshCentral includes full web-based remote desktop, terminal and file management capability. +To try out this software on the public server, please visit [MeshCentral.com/login](https://meshcentral.com/login). Be mindful that the public MeshCentral server comes with no guaranties, most should setup their own server. + For more information, [visit MeshCentral.com](https://www.meshcentral.com/). ## Social Media @@ -12,17 +14,17 @@ For more information, [visit MeshCentral.com](https://www.meshcentral.com/). [Reddit](https://www.reddit.com/r/MeshCentral/) -[BlueSky](https://bsky.app/profile/meshcentral.bsky.social) +[Twitter](https://twitter.com/MeshCentral) [BlogSpot](https://meshcentral2.blogspot.com/) ## Documentation -The [User's Guide](meshcentral) contains information every administrator should know including usage, the server configuration file, databases, TLS offloading, Lets Encrypt, IP Filtering, Email setup, embedding, server port aliasing, reverse proxy setup, multi factor authentication, branding & terms of use, HashiCorp Vault support, and SSO. +The [User's Guide](https://info.meshcentral.com/downloads/MeshCentral2/MeshCentral2UserGuide.pdf) contains information every adminstrator should know including usage, the server configuration file, databases, TLS offloading, Lets Encrypt, IP Filtering, Email setup, embedding, server port aliasing, reverse proxy setup, multi factor authentication, branding & terms of use, HashiCorp Vault support, and SSO. -The [Installation Guide](install/install2.md) has detailed instructions for installing the MeshCentral Server on Windows 8.1, Windows 10, Windows 2012 R2, Amazon Linux 2, Raspberry Pi, Microsoft Azure, Google Cloud, Ubuntu 18, Ubuntu 16 and OpenBSD. +The [Installation Guide](https://info.meshcentral.com/downloads/MeshCentral2/MeshCentral2InstallGuide.pdf) has detailed instructions for installing the MeshCentral Server on Windows 8.1, Windows 10, Windows 2012 R2, Amazon Linux 2, Raspberry Pi, Microsoft Azure, Google Cloud, Ubuntu 18, Ubuntu 16 and OpenBSD. -The [Design and Architecture Guide](design) is a short document that includes information on the design overview, dependencies, source code descriptions of each file, certificates, TLS security, the agent to server handshake, browser to agent relay and WebRTC and the messenger service. +The [Design and Architecture Guide](https://info.meshcentral.com/downloads/MeshCentral2/MeshCentral2DesignArchitecture.pdf) is a short document that includes information on the design overview, dependencies, source code descriptions of each file, certificates, TLS security, the agent to server handshake, browser to agent relay and WebRTC and the messenger service. ## Video Tutorials diff --git a/docs/docs/install/index.md b/docs/docs/install/index.md index 988cf099..f278b4b9 100644 --- a/docs/docs/install/index.md +++ b/docs/docs/install/index.md @@ -9,11 +9,11 @@ npm install meshcentral node node_modules/meshcentral ``` -That's it. MeshCentral will set itself up and start managing computers on your local network. By default it will be setup in LAN mode and agents you install will multicast on the local network to find the server. To setup the server so that agents use a well known DNS name and to start customizing your server, go in the "meshcentral-data" folder and edit the config.json file. The configuration file must be valid JSON, you can use this [link](https://duckduckgo.com/?va=j&t=hc&q=json+lint&ia=answer) to validate the file format. +That's it. MeshCentral will set itself up and start managing computers on your local network. By default it will be setup in LAN mode and agents you install will multicast on the local network to find the server. To setup the server so that agents use a well known DNS name and to start customizing your server, go in the "meshcentral-data" folder and edit the config.json file. The configuration file must be valid JSON, you can use this link to validate the file format. For Windows users, you can download the MeshCentral Installer that will automate installation of NodeJS and provide basic configuration of the server. This option is not recommended for advanced users. -[Win32 MeshCentral Installer](https://meshcentral.com/tools/MeshCentralInstaller.exe) +[Win32 MeshCentral Installer](https://meshcentral.com/info/tools/MeshCentralInstaller.exe) By default, MeshCentral will use NeDB as this is the built-in database. For more advanced users, it's recommended to switch to using MongoDB. MeshCentral can be installed on a very small server. A [Raspberry Pi](https://www.raspberrypi.org/) or [AWS t3.nano running Amazon Linux 2 instance](https://aws.amazon.com/ec2/pricing/on-demand/) for 5$ a month will do just fine for managing up to a few hundred devices. @@ -23,10 +23,10 @@ You can run the MeshCentral Server with --help to get options for background ins Once you get MeshCentral installed, the first user account that is created will be the server administrator. So, don't delay and navigate to the login page and create a new account. You can then start using your server right away. A lot of the fun with MeshCentral is the 100's of configuration options that are available in the config.json file. You can put your own branding on the web pages, setup a SMTP email server, SMS services and much more. -You can look [here for simple config.json](https://raw.githubusercontent.com/Ylianst/MeshCentral/master/sample-config.json), [here for a more advanced configuration](https://raw.githubusercontent.com/Ylianst/MeshCentral/master/sample-config-advanced.json) and [here for all possible configuration options](https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json). You can also take a look at the [tutorial videos](https://www.youtube.com/@MeshCentral/videos) for additional help. +You can look [here for simple config.json](https://raw.githubusercontent.com/Ylianst/MeshCentral/master/sample-config.json), [here for a more advanced configuration](https://raw.githubusercontent.com/Ylianst/MeshCentral/master/sample-config-advanced.json) and [here for all possible configuration options](https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json). You can also take a look at the [MeshCentral User's Guide](https://meshcentral.com/info/docs/MeshCentral2InstallGuide.pdf) and [tutorial videos](https://meshcentral.com/info/tutorials.html) for additional help. ## Video Walkthru
-
+
\ No newline at end of file diff --git a/docs/docs/install/install2.md b/docs/docs/install/install2.md index 39312467..ec915393 100644 --- a/docs/docs/install/install2.md +++ b/docs/docs/install/install2.md @@ -4,45 +4,6 @@ This guide is specifically intended to help users install MeshCentral from start to finish. Once installed, you can take a look at the MeshCentral user’s guide for information on how to configure MeshCentral for your specific use. In this document, we will look at installing MeshCentral on AWS Linux, Raspberry Pi and Ubuntu. -## Docker - - - -``` -docker pull ghcr.io/ylianst/meshcentral:master -``` - -!!!warning - Do not use the built in mesh update function. Update docker the docker way. - -### Docker Compose - -``` -version: '3' -services: - meshcentral: - restart: unless-stopped # always restart the container unless you stop it - image: ghcr.io/ylianst/meshcentral:1.1.27 # 1.1.27 is a version number OR use master for the master branch of bug fixes - ports: - - 80:80 # HTTP - - 443:443 # HTTPS - - 4433:4433 # AMT (Optional) - volumes: - - data:/opt/meshcentral/meshcentral-data # config.json and other important files live here - - user_files:/opt/meshcentral/meshcentral-files # where file uploads for users live - - backup:/opt/meshcentral/meshcentral-backups # location for the meshcentral backups - this should be mounted to an external storage - - web:/opt/meshcentral/meshcentral-web # location for site customization files -volumes: - data: - driver: local - user_files: - driver: local - backup: - driver: local - web: - driver: local -``` - ## Quick Start For some who want to skip this document entirely, there are quick install scripts that will get a MeshCentral2 instance up and running on Linux in a few minutes. These scripts will pretty much do what this document explains very rapidly. Right now, there are two such scripts available: @@ -52,7 +13,7 @@ For some who want to skip this document entirely, there are quick install script For Amazon EC2 users, that want to manage 100 devices or less. Launch a t3.nano or t3.micro EC2 instance with Amazon Linux 2 with TCP ports 22 (SSH), 80 (HTTP), 443 (HTTPS) and 4433 (CIRA) open. Then login as `ec2-user` and enter the following commands: ``` -wget https://meshcentral.com/scripts/mc-aws-linux2.sh +wget http://info.meshcentral.com/scripts/mc-aws-linux2.sh chmod 755 mc-aws-linux2.sh ./mc-aws-linux2.sh ``` @@ -60,7 +21,7 @@ chmod 755 mc-aws-linux2.sh This will download the fast install script and once run, will install nodejs, meshcentral, setup systemd and start the server. For a larger instance like a t3.small, t3.medium or larger you can run the following that does the same but also installs MongoDB. ``` -wget https://meshcentral.com/scripts/mc-aws-linux2-mongo.sh +wget http://info.meshcentral.com/scripts/mc-aws-linux2-mongo.sh chmod 755 mc-aws-linux2-mongo.sh ./mc-aws-linux2-mongo.sh ``` @@ -72,29 +33,13 @@ After these scripts are run, try accessing the server using a browser. MeshCentr For 100 devices or less, launch an instance of Ubuntu 18.04 using a small B1s instance. Set the username to `default` in all lower case and open ports 22, 80, 443 and 3389 using the basic network profile. Then start the instance and run the following lines. ``` -wget https://meshcentral.com/scripts/mc-azure-ubuntu1804.sh +wget http://info.meshcentral.com/scripts/mc-azure-ubuntu1804.sh chmod 755 mc-azure-ubuntu1804.sh ./mc-azure-ubuntu1804.sh ``` In this situation, port 3389 will be used to receive Intel AMT CIRA connections instead of port 4433. After these scripts are run, try accessing the server using a browser. MeshCentral will take a minute or two to create certificates after that, the server will be up. The first account to be created will be the site administrator – so don’t delay and create an account right away. Once running, move on to the MeshCentral’s user’s guide to configure your new server. -### Elestio - -You can deploy MeshCentral on Elestio using one-click deployment. Elestio handles version updates, maintenance, securtiy, backups, etc. Additionally, Elestio supports MeshCentral by providing revenue share so go ahead and click below to deploy and start using. - -[![Deploy on Elestio](https://elest.io/images/logos/deploy-to-elestio-btn.png)](https://elest.io/open-source/meshcentral) - -## Server Security - Adding Crowdsec - -MeshCentral has built-in support for a CrowdSec bouncer. This allows MeshCentral to get threat signals from the community and block or CAPTCHA requests coming from known bad IP addresses. - -## Video Walkthru - -
- -
- ## Windows Installation MeshCentral is constructed entirely with NodeJS, an asynchronous event driven JavaScript runtime (https://nodejs.org/). A basic understanding on NodeJS may be preferable but not compulsory. MeshCentral server which heavily relies on NodeJS runtime will be able run on almost any computing platform with contemporary operating systems including Windows*, Linux* and macOS*. @@ -929,7 +874,7 @@ The last line will run MeshCentral manually and allow it to install any missing ``` sudo chown -R meshcentral:meshcentral /opt/meshcentral -sudo chmod -R 755 /opt/meshcentral/meshcentral-* +sudo chmod 755 –R /opt/meshcentral/meshcentral-* ``` To make this work, you will need to make MeshCentral work with MongoDB because the /meshcentral-data folder will be read-only. In addition, MeshCentral will not be able to update itself since the account does not have write access to the /node_modules files, so the update will have to be manual. First used systemctl to stop the MeshCentral server process, than use this: @@ -946,7 +891,7 @@ This will perform the update to the latest server on NPM and re-set the permissi MeshCentral allows users to upload and download files stores in the server’s `meshcentral-files` folder. In an increased security setup, we still want the server to be able to read and write files to this folder and we can allow this with: ``` -sudo chmod -R 755 /opt/meshcentral/meshcentral-files +sudo chmod 755 –R /opt/meshcentral/meshcentral-files ``` If you plan on using the increased security installation along with MeshCentral built-in Let’s Encrypt support you will need to type the following commands to make the `letsencrypt` folder in `meshcentral-data` writable. @@ -954,19 +899,11 @@ If you plan on using the increased security installation along with MeshCentral ``` sudo mkdir /opt/meshcentral/meshcentral-data sudo mkdir /opt/meshcentral/meshcentral-data/letsencrypt -sudo chmod -R 755 /opt/meshcentral/meshcentral-data/letsencrypt +sudo chmod 755 –R /opt/meshcentral/meshcentral-data/letsencrypt ``` This will allow the server to get and periodically update its Let’s Encrypt certificate. If this is not done, the server will generate an `ACCES: permission denied` exception. -### Restore backup in Ubuntu - -- Stop Meshcentral service `sudo systemctl stop meshcentral.service` -- In your old server, get your backup : meshcentral-data folder, and mongodump-xxxx.archive -- In the new server, replace the actual meshcentral-data with your backup (it will handle your LestEncrypt cert also) -- Restore mongodb : mongorestore --archive=mongodump-xxxx.archive -- Restart meshcentral.service `sudo systemctl start meshcentral.service` - ## Microsoft Azure In this section, we will look installing MeshCentral on Microsoft Azure. Microsoft Azure offers many operating system options and we will be selecting `Ubuntu Server` as our choice. From the Azure portal, we select `Virtual machines` on the left and `Add`. diff --git a/docs/docs/intelamt/images/amtprovisioningserver.png b/docs/docs/intelamt/images/amtprovisioningserver.png deleted file mode 100644 index fd64e618..00000000 Binary files a/docs/docs/intelamt/images/amtprovisioningserver.png and /dev/null differ diff --git a/docs/docs/intelamt/index.md b/docs/docs/intelamt/index.md index ad3c4986..67b3f74d 100644 --- a/docs/docs/intelamt/index.md +++ b/docs/docs/intelamt/index.md @@ -7,7 +7,6 @@ Intel AMT Guide [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/doc
-
## Abstract @@ -49,16 +48,6 @@ Intel® AMT If you are looking into managing remote computers that would be difficult to physically get access to for remote support or maintenance, one should probably look at getting a PC with Intel AMT. -## Bare-Metal Activation Server - -The `AmtProvisioningServer` section in the `settings` section of the config.json will enable this feature. MeshCentral will then listen for activation requests, match against your ACM activation certificates and if everything goes well, will activate and add the device to a Intel AMT only device group. No agent or MeshCMD is involved. - -This bare-metal activation server is not enabled by default and only makes sense when activating devices on the local network. - -Once enabled, Intel AMT can send “hello” data to the MeshCentral provisioning server on port 9971 and MeshCentral will respond by connecting back, authenticating, and activating Intel AMT. MeshCentral will then log the event, add the device to a pre-defined agent-less device group and complete any remaining configuration. A trusted CA certificate is required to perform this operation fully automatically. - -![baremetal](images/amtprovisioningserver.png) - ## MeshCentral Group Types Once MeshCentral is installed, a user will typically create a new device group. Here is the first hint that MeshCentral supports Intel AMT. Device groups come in two types. You can manage using a software agent, or using Intel AMT only. @@ -185,22 +174,12 @@ Once setup, Intel AMT will not automatically activate to Intel AMT unless the ri - The name “meshcentral.com” by have been set as “Trusted FQDN” in MEBx. - The name “meshcentral.com” must have been set using a USB key with a setup.bin file. -
- -
- Once Intel AMT is in a situation where ACM activation can occur, the activation command line can be run or the Mesh Agent will detect this situation and ask the server to perform activation. ![](images/2022-05-16-23-16-05.png) The best way to test this feature is to create an “Intel AMT only” device group and run the MeshCMD command on the remote system to perform activation. If there is a problem, this process should clearly display why ACM activation fails. -!!!note - Activation over wifi has some additional issues.
- First you need to add your WiFi access point to that wifi configuration to allow CSME to take over WiFi when OS is not functioning. Then it should work.
- Please also make sure you install Intel WiFi driver and Intel LMS package. It should work. You can detach the ethernet and then try connecting to that device using the IP address acquired by WiFi interface. - See [Open AMT Cloud Toolkit](https://www.intel.com/content/www/us/en/developer/topic-technology/edge-5g/tools/open-amt-cloud-toolkit.html) project - a close relative to this project. It has an AMT activation component and newer remote provisioning client can activate locally and also can manage Wi-Fi profile. - ## Intel AMT MEI and LMS Intel Active Management Technology (Intel AMT) can communicate to the local platform using the Management Engine Interface (MEI). We show how your can use that to get Intel AMT information. For more advanced usages, you need to connect using TCP and TLS which requires Intel Local Manageability Service (LMS). We show how MeshCentral's Mesh Agent and MeshCMD have a small version of LMS built-in and how it works diff --git a/docs/docs/meshcentral/SSLnletsencrypt.md b/docs/docs/meshcentral/SSLnletsencrypt.md deleted file mode 100644 index fe8d3f78..00000000 --- a/docs/docs/meshcentral/SSLnletsencrypt.md +++ /dev/null @@ -1,37 +0,0 @@ -# SSL/Letsencrypt - -## MeshCentral supports SSL using self generated certs, your own certs or Letsencrypt - -### Enabling letsencrypt - -Make sure you match and/or adjust all the following settings appropriately in your config.json file: - -```json -{ - "settings": { - "redirPort" - "cert": "yourdomain.com" - }, - "domains": { - "letsencrypt": { - "__comment__": "Requires NodeJS 8.x or better, Go to https://letsdebug.net/ first before trying Let's Encrypt.", - "email": "myemail@myserver.com", - "names": "myserver.com,customer1.myserver.com", - "skipChallengeVerification": false, - "production": true - }, - } -} -``` - -If you need further clarification to know what each of these settings are, check out [the config schema](https://github.com/Ylianst/MeshCentral/blob/master/meshcentral-config-schema.json). - -Then restart meshcentral and it will get a cert for you, the process will need to restart to apply the cert. - -### Useful resources/troubleshooting - -To check letsencrypt is working properly please use https://letsdebug.net/. We are using the [HTTP-O1 challenge](https://letsencrypt.org/docs/challenge-types/#http-01-challenge) method with these instructions. - -Also make sure you have port 80 open and pointing to your meshcentral server, **IT WILL NOT WORK** if port 80 isn't open and it **HAS** to be port 80. - -You can read more about Letsencrypt and meshcentral [here](https://ylianst.github.io/MeshCentral/meshcentral/#lets-encrypt-support). diff --git a/docs/docs/meshcentral/agents.md b/docs/docs/meshcentral/agents.md deleted file mode 100644 index 6cba2f14..00000000 --- a/docs/docs/meshcentral/agents.md +++ /dev/null @@ -1,362 +0,0 @@ -# Mesh Agents - -## Windows - -Default Install Path: `c:\Program Files\Mesh Agent` - -Application Path: `c:\Program Files\Mesh Agent\meshagent.exe` - -Application database Path: `c:\Program Files\Mesh Agent\meshagent.db` - -Application Log Path: `c:\Program Files\Mesh Agent\meshagent.log` - -xxx Path: `c:\Program Files\Mesh Agent\meshagent.msh` - -=== ":material-console-line: Status" - - - Start: `net start "mesh agent"` - - Stop: `net stop "mesh agent"` - - Restart: `net restart "mesh agent"` - - Status: Needs info - -=== ":material-console-line: Troubleshooting" - - Troubleshooting steps: Needs info - -## Linux / BSD - -Uninstall: `sudo /usr/local/mesh_services/meshagent/[agent-name]/meshagent -fulluninstall` - -## Apple macOS Binary Installer - -Default Install Path: `/usr/local/mesh_services/meshagent/meshagent` - -Launches from `/Library/LaunchAgents/meshagent.plist` - -Controlling agent - -```bash -launchctl stop meshagent -launchctl start meshagent -``` - -Install: - -Uninstall: `sudo /usr/local/mesh_services/meshagent/[agent-name]/meshagent -fulluninstall` - -## Apple macOS Universal - -For OSx 11+ including Big Sur, Monterey and later - -## Apple macOS - -For macOS 10.x including Catalina, Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks, Mountain Lion and earlier. - -## Mobile Device (Android) - -## MeshCentral Assistant - -See [Assistant](assistant.md) - -## Apple MacOS Binary Installer - -## Agent Commands - -**agentmsg** -: Add/Remove badged messages to the device's web ui -``` - agentmsg add "[message]" [iconIndex] - agentmsg remove [index] - agentmsg list -``` -**agentsize** -: Returns the binary size of the agent - -**agentupdate** -: Manually trigger an agent self-update - -**alert** -: Display an alert dialog on the logged in session -``` -alert TITLE, CAPTION [, TIMEOUT] -``` - -**amt** - -**amtconfig** - -**amtevents** - -**apf** - -**args** - -**av** -: Displays Antivirus State - -**coredump** - -**coreinfo** - -**cpuinfo** - -**cs** -: Display Windows Connected Standby State - -**dbcompact** -: Compacts the agent database - -**dbget** - -**dbkeys** - -**dbset** - -**dnsinfo** -: Display DNS server info - -**domain** -: Display domain metadata - -**errorlog** - -**eval** -: executes javascript on the agent -``` -eval [code] -``` - -**fdcount** -: Returns the number of active descriptors in the event loop - -**fdsnapshot** -: Returns detailed descriptor/handle/timer metadata - -**getclip** -: Fetches clipboard data from agent - -**getscript** - -**help** -: Returns the list of supported console commands - -**httpget** - -**info** -: Returns general information about the agent, such as connected state, loaded modules, LMS state, etc - -**kill** -: Sends a SIGKILL signal to the specified PID -``` -kill [pid] -``` - -**kvmmode** -: Displays the KVM Message Format - -**location** -: Displays saves location information about the connected agent - -**lock** - -**log** -: Writes a message to the logfile -``` -log [message] -``` - -**ls** -: Enumerates the files in the agent's install folder - -**mousetrails** -: Enables/Disables Mouse Trails Accessibility on Windows. To change setting, specify a positive integer representing the number of latent cursors, where 0 is disable -``` -mousetrails [n] -``` - -**msh** -: Displays the loaded msh settings file - -**netinfo** -: Displays network interface information - -**notify** -: Display a notification on the web interface - -**openurl** - -**osinfo** -: Displays OS information - -**parseuri** -: Parses the specified URI, and displays the parsed output -``` -parseuri [uri] -``` - -**plugin** -: Invokes a plugin -``` -plugin [pluginName] [args] -``` - -**power** -: Performs the specified power action -``` -power [action] - LOGOFF = 1 - SHUTDOWN = 2 - REBOOT = 3 - SLEEP = 4 - HIBERNATE = 5 - DISPLAYON = 6 - KEEPAWAKE = 7 - BEEP = 8 - CTRLALTDEL = 9 - VIBRATE = 13 - FLASH = 14 -``` - -**print** - -**privacybar** -: Sets/Gets the default pinned state of the Privacy Bar on windows -``` -privacybar [PINNED|UNPINNED] -``` - -**ps** -: Enumerates processes on the agent - -**rawsmbios** -: Fetches the raw smbios table - -**safemode** -: Sets/Gets the SAFEMODE configuration of the agent, as well as the next boot state. -``` -safemode (ON|OFF|STATUS) -``` - -**scanwifi** -: Scans the available Wifi access points, and displays the SSID and Signal Strength - -**service** -: Shortcut to be able to restart the agent service -``` -service status|restart -``` - -**setclip** -: Sets clipboard data to the agent -``` -setclip [text] -``` - -**setdebug** -: Sets the location target for debug messages -``` -setdebug [target] -0 = Disabled -1 = StdOut -2 = This Console -* = All Consoles -4 = WebLog -8 = Logfile -``` - -**smbios** -: Displays the parsed SMBIOS metadata - -**startupoptions** -: Displays the command-line options that the agent was started with - -**sysinfo** -: Collects and displays telemetry on the platform - -**task** - -**taskbar** -: Hides or shows the Windows System task bar, optionally on the specified Terminal Server Session ID -``` -taskbar HIDE|SHOW [TSID] -``` - -**timerinfo** -: Displays metadata about any configured timers on the event loop - -**toast** -: Displays a toast message on the logged in user's session -``` -toast [message] -``` - -**translations** -: Shows the currently configured translations - -**type** -``` -type (filepath) [maxlength] -``` - -**uac** -: Get/Sets the Windows UAC mode -``` -uac [get|interactive|secure] -``` - -**unzip** -``` -unzip input, destination -``` -: Unzips the specified file - -**users** -: Enumerates the logged in users on the system - -**versions** -: Displays version information about the agent - -**vm** -: Detects if the system is a Virtual Machine - -**volumes** -: Displays volume information reported by the OS - -**wakeonlan** -: Sends wake-on-lan packets to the specified MAC address -``` -wakeonlan [mac] -``` - -**wallpaper** -: Gets/Toggles the logged in user's desktop background image -``` -wallpaper (GET|TOGGLE) -``` - -**wpfhwacceleration** -: Enable/Disable WPF HW Acceleration on Windows -``` -wpfhwacceleration (ON|OFF|STATUS) -``` - -**wsclose** - -**wsconnect** - -**wslist** - -**wssend** - -**zip** -``` -zip (output file name), input1 [, input n] -``` - -## Agent msh options - -You can find a full list of options for the agent [here](https://github.com/Ylianst/MeshAgent?tab=readme-ov-file#msh-format) - -`skipmaccheck=1`: Will not regenerate the agents nodeid and cause duplication of the agent when the MAC address changes. - -You can add options to your .msh on agent install with [this](https://github.com/Ylianst/MeshCentral/blob/15ff7d12a1e4e5d78936b473ea207b7e02b8ff26/meshcentral-config-schema.json#L2504) diff --git a/docs/docs/meshcentral/assistant.md b/docs/docs/meshcentral/assistant.md index 0462df3e..9c27b5ac 100644 --- a/docs/docs/meshcentral/assistant.md +++ b/docs/docs/meshcentral/assistant.md @@ -14,30 +14,12 @@ ![agent invite code](images/assistant_agent_code.png) -## Agent Invitation -Click on the 'Invite' button next to the device group name to access it. -### Link Invitation -For link invitation web page customization: +## Agent Invitation Link + +For web page customization: 1. Alongside `meshcentral-data` create a folder called `meshcentral-web` 2. Create a `views` folder in it and copy the file `node_modules/meshcentral/views/invite.handlebars` into it. -3. That copy will be served instead of the default one, so you can customize it as you want. +3. That copy will be served instead of the default one, you can customize as you want. ![agent invite code](images/assistant_invitation_link.png) - -### Email Invitation -This option will show up if you have an SMTP email server set up with MeshCentral. - -For invitation email customization: - -1. Alongside `meshcentral-data` create a folder called `meshcentral-web` -2. Create an `emails` folder in it and copy the files `node_modules/meshcentral/emails/mesh-invite.txt` and `node_modules/meshcentral/emails/mesh-invite.html` into it. -3. These copies will be used instead of the default ones, so you can customize them as you want. - -![email-invitation](images/email-invitation.png) - -## Email notification - -You can also get an email notification when someone clicks the "Request Help" button in the Assistant agent. - -![](images/2022-09-06-16-38-57.png) diff --git a/docs/docs/meshcentral/codesigning.md b/docs/docs/meshcentral/codesigning.md index 25e7a37a..5cd7404a 100644 --- a/docs/docs/meshcentral/codesigning.md +++ b/docs/docs/meshcentral/codesigning.md @@ -20,42 +20,34 @@ Usage: node authenticode.js [command] [options] Commands: info: Show information about an executable. - --exe [file] Required executable to view information. - --json Show information in JSON format. + --exe [file] Required executable to view information. + --json Show information in JSON format. sign: Sign an executable. - --exe [file] Required executable to sign. - --out [file] Resulting signed executable. - --pem [pemfile] Certificate & private key to sign the executable with. - --desc [description] Description string to embbed into signature. - --url [url] URL to embbed into signature. - --hash [method] Default is SHA384, possible value: MD5, SHA224, SHA256, SHA384 or SHA512. - --time [url] The time signing server URL. - --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http:// + --exe [file] Required executable to sign. + --out [file] Resulting signed executable. + --pem [pemfile] Certificate & private key to sign the executable with. + --desc [description] Description string to embbed into signature. + --url [url] URL to embbed into signature. + --hash [method] Default is SHA384, possible value: MD5, SHA224, SHA256, SHA384 or SHA512. + --time [url] The time signing server URL. + --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http:// unsign: Remove the signature from the executable. - --exe [file] Required executable to un-sign. - --out [file] Resulting executable with signature removed. + --exe [file] Required executable to un-sign. + --out [file] Resulting executable with signature removed. createcert: Create a code signging self-signed certificate and key. - --out [pemfile] Required certificate file to create. - --cn [value] Required certificate common name. - --country [value] Certificate country name. - --state [value] Certificate state name. - --locality [value] Certificate locality name. - --org [value] Certificate organization name. - --ou [value] Certificate organization unit name. - --serial [value] Certificate serial number. + --out [pemfile] Required certificate file to create. + --cn [value] Required certificate common name. + --country [value] Certificate country name. + --state [value] Certificate state name. + --locality [value] Certificate locality name. + --org [value] Certificate organization name. + --ou [value] Certificate organization unit name. + --serial [value] Certificate serial number. timestamp: Add a signed timestamp to an already signed executable. - --exe [file] Required executable to sign. - --out [file] Resulting signed executable. - --time [url] The time signing server URL. - --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http:// - icons: Show the icon resources in the executable. - --exe [file] Input executable. - saveicons: Save an icon group to a .ico file. - --exe [file] Input executable. - --out [file] Resulting .ico file. - --icongroup [groupNumber] Icon groupnumber to save to file. - --removeicongroup [number] - --icon [groupNumber],[filename.ico] + --exe [file] Required executable to sign. + --out [file] Resulting signed executable. + --time [url] The time signing server URL. + --proxy [url] The HTTP proxy to use to contact the time signing server, must start with http:// Note that certificate PEM files must first have the signing certificate, followed by all certificates that form the trust chain. @@ -73,29 +65,11 @@ When doing sign/unsign, you can also change resource properties of the generated ## Automatic Agent Code Signing -If you want to self-sign the mesh agent so you can whitelist the software in your AV, as well as lock it to your server and organization: +If you want to self-sign the mesh agent so you can whitelist the software in your AV, and lock it to your server and organization.
!!!note - If you generate your private key on windows with use `BEGIN PRIVATE KEY` and openssl needs `BEGIN RSA PRIVATE KEY` you can convert your private key to rsa private key using `openssl rsa -in server.key -out server_new.key` - -## Setting Agent File info - -Now that MeshCentral customizes and signs the agent, you can set that value to anything you like. - -```json -"domains": { - "agentFileInfo": { - "filedescription": "sample_filedescription", - "fileversion": "0.1.2.3", - "internalname": "sample_internalname", - "legalcopyright": "sample_legalcopyright", - "originalfilename": "sample_originalfilename", - "productname": "sample_productname", - "productversion": "v0.1.2.3" - } -} -``` + If you generate your private key on windows with use `BEGIN PRIVATE KEY` and openssl needs `BEGIN RSA PRIVATE KEY` you can convert your private key to rsa private key using `openssl rsa -in server.key -out server_new.key` \ No newline at end of file diff --git a/docs/docs/meshcentral/config.md b/docs/docs/meshcentral/config.md index 92824f63..6f398352 100644 --- a/docs/docs/meshcentral/config.md +++ b/docs/docs/meshcentral/config.md @@ -1,42 +1,1219 @@ # Configuration Options -There are MANY configuration options available with meshcentral, search this file for options: +All possible configuration of MeshCentral can be found in this file: -Some options you can find relate to: +See description for information about each item. -* DNS -* HTTPS -* MPS (Management Presence Server) -* MongoDB -* MariaDB -* SQLite3 -* MySQL -* PostgreSQL -* AceBase -* WAN (Wide Area Network) -* LAN (Local Area Network) -* Maintenance Mode -* Session Cookie -* Database Encryption -* Web Relay -* Agent Connection -* TLS (Transport Layer Security) -* WebRTC -* Web Push Notifications -* Auto Backup -* Crowdsec -* IP KVM (Keyboard, Video, Mouse over IP) -* Mesh Router -* Syslog -* WebDAV -* Certificates and Authentication -* MeshCentral Server Settings -* Device Management -* User Permissions -* Remote Desktop Configuration - -and more! - -![Server Options]() - -![Domain Options]() \ No newline at end of file +```json +{ + "id": "https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "MeshCentral configuration file schema", + "type": "object", + "properties": { + "settings": { + "type": "object", + "properties": { + "cert": { "type": "string", "description": "Set this to the primary DNS name of this MeshCentral server." }, + "mongoDb": { "type": "string", "default": null }, + "mongoDbName": { "type": "string" }, + "mongoDbChangeStream": { "type": "boolean", "default": false }, + "mongoDbBulkOperations": { "type": "boolean", "default": false }, + "mariaDB": { + "type": "object", + "description": "Add this section to connect MeshCentral to a MariaDB database instance.", + "properties": { + "host": { "type": "string", "description": "MariaDB hostname" }, + "user": { "type": "string", "description": "MariaDB username" }, + "port": { "type": "number", "description": "MariaDB port number" }, + "password": { "type": "string", "description": "MariaDB password" }, + "connectionLimit": { "type": "number", "description": "MariaDB connection limit" }, + "database": { "type": "string", "default": "meshcentral", "description": "Name of MariaDB database used" }, + "awsrds": { "type": "boolean", "default": false, "description": "Set true to resolve LOCK TABLE permissions on AWS RDS." }, + "ssl": { + "type": "object", + "description": "SSL Options. Set to true (boolean) for default options.", + "properties": { + "caCertPath": { "type": "string", "description": "Absolute path to the CA certificate. Required for self-signed certificates" }, + "clientCertPath": { "type": "string", "description": "Absolute path to the client certificate. Required for two-way SSL Authentication" }, + "clientKeyPath": { "type": "string", "description": "Absolute path to the client key. Required for two-way SSL Authentication" }, + "dontCheckServerIdentity": { "type": "boolean", "description": "Set true to not check the server hostname during verification" } + } + } + } + }, + "mySQL": { + "type": "object", + "description": "Add this section to connect MeshCentral to a MySQL database instance.", + "properties": { + "host": { "type": "string", "description": "MySQL hostname" }, + "port": { "type": "number", "description": "MySQL port number" }, + "user": { "type": "string", "description": "MySQL username" }, + "password": { "type": "string", "description": "MySQL password" }, + "database": { "type": "string", "default": "meshcentral", "description": "Name of MySQL database used" }, + "awsrds": { "type": "boolean", "default": false, "description": "Set true to resolve LOCK TABLE permissions on AWS RDS." }, + "ssl": { + "type": "object", + "description": "SSL Options. Set to true (boolean) for default options.", + "properties": { + "caCertPath": { "type": "string", "description": "Absolute path to the CA certificate. Required for self-signed certificates" }, + "clientCertPath": { "type": "string", "description": "Absolute path to the client certificate. Required for two-way SSL Authentication" }, + "clientKeyPath": { "type": "string", "description": "Absolute path to the client key. Required for two-way SSL Authentication" }, + "dontCheckServerIdentity": { "type": "boolean", "description": "Set true to not check the server hostname during verification" } + } + } + } + }, + "postgres": { + "type": "object", + "description": "Add this section to connect MeshCentral to a PostgreSQL database instance.", + "properties": { + "host": { "type": "string", "description": "PostgreSQL hostname" }, + "user": { "type": "string", "description": "PostgreSQL username" }, + "port": { "type": "number", "description": "PostgreSQL port number" }, + "password": { "type": "string", "description": "PostgreSQL password" }, + "database": { "type": "string", "default": "meshcentral", "description": "Name of PostgreSQL database used" } + } + }, + "WANonly": { "type": "boolean", "default": false, "description": "When enabled, only MeshCentral WAN features are enabled and agents will connect to the server using a well known DNS name." }, + "LANonly": { "type": "boolean", "default": false, "description": "When enabled, only MeshCentral LAN features are enabled and agents will find the server using multicast LAN packets." }, + "maintenanceMode": { "type": "boolean", "default": false, "description": "When enabled the server is in maintenance mode, only administrators can login. Use the maintenance command in server console to change." }, + "certificatePrivateKeyPassword": { "type": "array", "default": null, "description": "List of passwords used to decrypt PKCK#8 .key files that are in the meshcentral-data folder." }, + "sessionTime": { "type": "integer", "default": 60, "description": "Duration of a session cookie in minutes. Changing this affects how often the session needs to be automatically refreshed." }, + "sessionKey": { "type": "string", "default": null, "description": "Password used to encrypt the MeshCentral web session cookies. If null, a random one is generated each time the server starts." }, + "sessionSameSite": { "type": "string", "default": "lax", "enum": ["strict", "lax", "none"] }, + "dbEncryptKey": { "type": "string" }, + "dbRecordsEncryptKey": { "type": "string", "default": null }, + "dbRecordsDecryptKey": { "type": "string", "default": null }, + "dbExpire": { + "type": "object", + "properties": { + "events": { "type": "integer", "default": 1728000, "description": "Amount of time in seconds that events are kept in the database." }, + "powerevents": { "type": "integer", "default": 864000, "description": "Amount of time in seconds that device power events are kept in the database." }, + "statsevents": { "type": "integer", "default": 2592000, "description": "Amount of time in seconds that server statistics are kept in the database." } + } + }, + "port": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "portBind": { "type": "string", "description": "When set, bind the HTTPS main port to a specific network address." }, + "aliasPort": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "redirPort": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "redirPortBind": { "type": "string", "description": "When set, bind the HTTP redirection port to a specific network address." }, + "redirAliasPort": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "agentPort": { "type": "integer", "minimum": 1, "maximum": 65535, "description": "When set, enabled a new HTTPS server port that only accepts agent connections." }, + "agentPortBind": { "type": "string", "description": "When set, binds the agent port to a specific network interface." }, + "agentAliasPort": { "type": "integer", "minimum": 1, "maximum": 65535, "description": "When set, indicates the actual publically visible agent-only port. If not set, the AgentPort value is used." }, + "agentAliasDNS": { "type": "string", "format": "hostname", "description": "When set, specified the DNS name used by agents to connect to the agent-only port." }, + "agentPortTls": { "type": "boolean", "default": true, "description": "Indicates if the agent-only port must perform TLS, this should be set to false if TLS is performed in front of this server." }, + "agentLogDump": { "type": "boolean", "default": false, "description": "Automatically downloads all agent error logs into meshcentral-data/agenterrorlogs.txt." }, + "agentCoreDump": { "type": "boolean", "default": false, "description": "Automatically activates and transfers any agent crash dump files to the server in meshcentral-data/coredumps." }, + "agentCoreDumpUsers": { "type": "array", "description": "List of non-administrator users that have access to mesh agent crash dumps." }, + "agentSignLock": { "type": "boolean", "default": false, "description": "When code signing an agent using authenticode, lock the agent to only allow connection to this server. (This is in testing, the default value will change to true in the future)." }, + "ignoreAgentHashCheck": { "type": [ "boolean", "string" ], "default": false, "description": "When true, the agent no longer checked the TLS certificate of the server. This should be used for debugging only. You can also set this to a comma seperated list of IP addresses to ignore, for example: \"192.168.2.100,192.168.1.0/24\"." }, + "exactPorts": { "type": "boolean", "default": false }, + "allowLoginToken": { "type": "boolean", "default": false }, + "StrictTransportSecurity": { "type": ["boolean", "string"], "default": null, "description": "Controls the Strict-Transport-Security header, default is 1 year. Set to false to remove, true to force enable, or string to set a custom value. If set to null, MeshCentral will enable if a trusted certificate is set." }, + "allowFraming": { "type": "boolean", "default": false, "description": "When enabled, the MeshCentral web site can be embedded within another website's iframe." }, + "cookieIpCheck": { "type": [ "string", "boolean" ], "default": "lax", "enum": ["strict", "lax", "none"] }, + "cookieEncoding": { "type": "string", "enum": [ "hex", "base64" ], "default": "base64", "description": "Encoding format of cookies in the HTTP headers, this is typically Base64 but some reverse proxies will require HEX." }, + "webRTC": { "type": "boolean", "default": false, "description": "When enabled, allows use of WebRTC to allow direct network traffic between the agent and browser." }, + "nice404": { "type": "boolean", "default": true, "description": "By default, a nice looking 404 error page is displayed when needed. Set this to false to disable it." }, + "selfUpdate": { "type": "boolean", "default": false, "description": "When true, this server will attempt to self-update everyday after midnight." }, + "cleanNpmCacheOnUpdate": { "type": "boolean", "default": false, "description": "When true, run \"npm cache clean --force\" to reclame disk space." }, + "browserPing": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the browser at x seconds interval and expects a response from the browser." }, + "browserPong": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the browser at x seconds interval." }, + "agentsInRam": { "type": "boolean", "default": false, "description": "Loads all agent binaries in RAM for faster agent updates." }, + "agentPing": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the agent at x seconds interval and expects a response from the agent." }, + "agentPong": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the agent at x seconds interval." }, + "amtManager": { "type": "boolean", "default": true, "description": "When enabled, MeshCentral will automatically monitor and manage Intel AMT devices." }, + "orphanAgentUser": { "type": "string", "default": null, "description": "If an agent attempts to connect to a unknown device group, automatically create a new device group and grant access to the specified user. Example: admin" }, + "agentIdleTimeout": { "type": "integer", "minimum": 1, "default": 150 ,"description": "How much time in seconds with no traffic from an agent before dropping the agent connection." }, + "webPageLengthRandomization": { "type": "boolean", "default": true, "description": "Adds a random length string to generated web pages to mitigate a BREACH attack." }, + "compression": { "type": "boolean", "default": true, "description": "Enables GZIP compression for web requests." }, + "wsCompression": { "type": "boolean", "default": false, "description": "Enables server-side, websocket per-message deflate compression." }, + "agentWsCompression": { "type": "boolean", "default": true, "description": "Enables agent-side, websocket per-message deflate compression. wscompression must also be true for this to work." }, + "noAgentUpdate": { "type": "integer", "default": 0, "description": "Set to 1 to present the server from updating any agent." }, + "agentUpdateSystem": { "type": "integer", "default": 1, "description": "When set to 2, all agents that need to be updated will use the meshcore.js update system. With the default value of 1, the native update system is used." }, + "temporaryAgentUpdate": { "type": "boolean", "default": true, "description": "Set to false to not allow temporary agents to be updated." }, + "amtScanner": { "type": "boolean", "default": true, "description": "Set to false to disable Intel AMT scanning on the local network, this is already disabled in WAN mode." }, + "meshScanner": { "type": "boolean", "default": true, "description": "Set to false to disable agent multicast scanning on the local network, this is already disabled in WAN mode." }, + "meshErrorLogPath": { "type": "string" }, + "npmPath": { "type": "string" }, + "npmProxy": { "type": "string", "format": "uri" }, + "allowHighQualityDesktop": { "type": "boolean", "default": true, "description": "When false, users will only be able to set remote desktop image quality to 60%, this can reduce server bandwidth usage." }, + "webPush": { + "type": "object", + "description": "When set with a valid email address, enables the MeshCentral web push notification feature. Allows administrators to send browser notifications to users even if they are not looking at the MeshCentral web site.", + "additionalProperties": false, + "properties": { + "email": { "type": "string", "description": "Server administrator email given to the FireFox and Chrome push notification services." } + }, + "required": [ "email" ] + }, + "RunOnServerStarted": { "type": "boolean", "default": null, "description": "Execute this when the server startup is completed. The first parameter will be the server version." }, + "RunOnServerUpdated": { "type": "boolean", "default": null, "description": "Execute this when the server has been updated. The first parameter will be the server version." }, + "RunOnServerError": { "type": "boolean", "default": null, "description": "Execute this when the server has to restart due to an error. The first parameter will be the server version." }, + "publicPushNotifications": { "type": "boolean", "default": false, "description": "When true, this server uses MeshCentral.com a push notification relay for Android notifications. Push notifications work even if the Android app is not open." }, + "desktopMultiplex": { "type": "boolean", "default": false, "description": "When true, enabled a server modules that efficiently splits a remote desktop stream to multiple browsers. Also allows slow browsers to not slow down the session for fast ones, this comes at the cost of extra server memory and processing for all remote desktop sessions." }, + "ipBlockedUserRedirect" : { "type": "string", "default": null, "description": "If set, a user from a banned IP address will be redirected to this URL." }, + "userAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only users from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "userBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, users from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only agents from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, agents from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "authLog": { "type": "string", "default": null, "description": "File path and name of the authentication log to be created. This log can be parsed by Fail2ban." }, + "InterUserMessaging": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Users in this list are allowed to send and receive inter-user messages. This can be used to implement bots or other software where MeshCentral is used as data transport. See \"interuser\" websocket command in the code." }, + "manageAllDeviceGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Users in this list are allowed to see and manage all device groups within their domain." }, + "manageCrossDomain": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Users in this list are allowed to manage all users in all domains." }, + "localDiscovery": { + "type": "object", + "description": "When this server is in LAN mode, you may discover this server using a multicast discovery tool. When discovery happens, the name and info fields are sent back to the discovery tool.", + "additionalProperties": false, + "properties": { + "name": { "type": "string" }, + "info": { "type": "string" }, + "key": { "type": "string", "description": "When set, encrypts all LAN discovery traffic to agents and tools using this key. This is only useful in LAN/Hybrid mode when agents and tools user multicast to find the server." } + }, + "required": [ "name", "info" ] + }, + "tlsOffload": { "type": [ "boolean", "string" ], "default": false, "description": "When true, indicates that a TLS offloader is in front of the MeshCentral server. More typically, set this to the IP address of the reverse proxy or TLS offloader so that IP forwarding headers will be trusted. For example: \"127.0.0.1,192.168.1.100\"." }, + "trustedProxy": { "type": "string", "default": null, "description": "Trust forwarded headers from these IPs or domains. Providing the magic string \"CloudFlare\" will cause the server to download the IP address list of trusted CloudFlare proxies directly from CloudFlare on each server start. For example: \"127.0.0.1,proxy.example.com,CloudFlare\"." }, + "mpsPort": { "type": "integer", "minimum": 0, "maximum": 65535, "default": 4433, "description": "The Management Presence Server (MPS), this is the server that received Intel AMT Client Initiated Remote Access (CIRA) connections." }, + "mpsPortBind": { "type": "string", "default": null }, + "mpsAliasPort": { "type": "integer", "minimum": 1, "maximum": 65535, "default": null }, + "mpsAliasHost": { "type": "string", "default": null }, + "mpsTlsOffload": { "type": "boolean", "default": false, "description": "When set to true, indicate that TLS is being performed by a device in front of MeshCentral." }, + "mpsHighSecurity": { "type": "boolean", "default": false, "description": "When set to true, the MPS server will only accept TLS 1.2 and 1.3 connections. Older Intel AMT devices will not be able to connect." }, + "no2FactorAuth": { "type": "boolean", "default": false }, + "log": { "type": "string", "default": null }, + "syslog": { "type": "string", "default": null }, + "syslogauth": { "type": "string", "default": null }, + "syslogjson": { "type": "string", "default": null }, + "syslogtcp": { "type": "string", "default": null, "description": "Send syslog events over the network (RFC3164) to a target hostname:port. For example: localhost:514" }, + "webrtcConfig": { + "type": "object", + "additionalProperties": false, + "description": "The STUN servers used for WebRTC, if not specified the Google and Mozilla servers and used when the server is not in LAN mode.", + "properties": { + "iceServers": { "type": "array", "uniqueItems": true, "items": { "type": "object", "additionalProperties": false, "properties": { "urls": { "type": "string" } }, "required": [ "urls" ] } } + }, + "required": [ "iceServers" ] + }, + "autoBackup": { + "type": "object", + "properties": { + "mongoDumpPath": { "type": "string" }, + "mysqlDumpPath": { "type": "string"}, + "backupIntervalHours": { "type": "integer" }, + "keepLastDaysBackup": { "type": "integer" }, + "zipPassword": { "type": "string" }, + "backupPath": { "type": "string" }, + "googleDrive": { + "type": "object", + "description": "Enabled automated upload of the server backups to a Google Drive account, once enabled you need to go in \"My Server\" tab as administrator to associate the account.", + "properties": { + "folderName": { + "type": "string", + "default": "MeshCentral-Backups", + "description": "The name of the folder to create in the Google Drive account." + }, + "maxFiles": { + "type": "integer", + "default": null, + "description": "The maximum number of files to keep in the Google Drive folder, older files will be removed if needed." + } + } + }, + "webDAV": { + "type": "object", + "description": "Enabled automated upload of the server backups to a WebDAV account.", + "properties": { + "url": { + "type": "string", + "description": "WebDAV account URL." + }, + "username": { + "type": "string", + "description": "WebDAV account username." + }, + "password": { + "type": "string", + "description": "WebDAV account password." + }, + "folderName": { + "type": "string", + "default": "MeshCentral-Backups", + "description": "The name of the folder to create in the WebDAV account." + }, + "maxFiles": { + "type": "integer", + "default": null, + "description": "The maximum number of files to keep in the WebDAV folder, older files will be removed if needed." + } + } + } + } + }, + "redirects": { "type": "object" }, + "maxInvalidLogin": { + "type": "object", + "additionalProperties": false, + "description": "This section described a policy for how many times an IP address is allowed to attempt to login incorrectly. By default it's 10 times in 10 minutes, but this can be changed here.", + "properties": { + "exclude": { "type": "string", "default": null, "description": "Ranges of IP addresses that are not subject to invalid login limitations. For example: 192.168.1.0/24,172.16.0.1"}, + "time": { "type": "integer", "default": 10, "description": "Time in minutes over which the a maximum number of invalid login attempts is allowed from an IP address." }, + "count": { "type": "integer", "default": 10, "description": "Maximum number of invalid login attempts from an IP address in the time period." }, + "coolofftime": { "type": "integer", "default": null, "description": "Additional time in minute that login attempts will be denied once the invalid login limit is reached." } + } + }, + "maxInvalid2fa": { + "type": "object", + "additionalProperties": false, + "description": "This section described a policy for how many times an IP address is allowed to attempt to perform two-factor authentication (2FA) incorrectly. By default it's 10 times in 10 minutes, but this can be changed here.", + "properties": { + "exclude": { "type": "string", "default": null, "description": "Ranges of IP addresses that are not subject to invalid 2FA limitations. For example: 192.168.1.0/24,172.16.0.1"}, + "time": { "type": "integer", "default": 10, "description": "Time in minutes over which the a maximum number of invalid 2FA attempts is allowed from an IP address." }, + "count": { "type": "integer", "default": 10, "description": "Maximum number of invalid 2FA attempts from an IP address in the time period." }, + "coolofftime": { "type": "integer", "default": null, "description": "Additional time in minute that 2FA attempts will be denied once the invalid 2FA limit is reached." } + } + }, + "amtProvisioningServer": { + "type": "object", + "additionalProperties": false, + "required": [ "deviceGroup", "newMebxPassword", "trustedFqdn", "ip" ], + "description": "When present, this section will enable the Intel AMT provisioning server on the local network. This is used for Intel AMT bare-metal ACM activation.", + "properties": { + "port": { + "type": "number", + "default": 9971, + "description": "Port number that provisioning server will listen to." + }, + "deviceGroup": { + "type": "string", + "description": "The agent-less device group to add Intel AMT devices to once they are activated. Must be of format: mesh/domain/id" + }, + "newMebxPassword": { + "type": "string", + "description": "The MEBX password to set during activation. This password must be at least 8 characters long and have 1 lower, 1 upper, 1 alpha-numeric and 1 non-alpha numeric character." + }, + "trustedFqdn": { + "type": "string", + "description": "The trusted FQDN or provisioning server value the remote device will have. This can be set in MEBx or using the DHCP server option 15 on the local network." + }, + "ip": { + "type": "string", + "description": "The IP address of this server. This address will be used when creating the USB setup.bin file to indicate what IP address to send the hello data to." + } + } + }, + "plugins": { + "type": "object", + "properties": { "enabled": { "type": "boolean" } }, + "required": [ "enabled" ] + } + } + }, + "domaindefaults": { "$ref": "#/properties/domains/items" }, + "domains": { + "type": "object", + "items": { + "type": "object", + "properties": { + "siteStyle": { "type": "integer", "default": 2, "description": "Valid numbers are 1 and 2, changes the style of the login page and some secondary pages." }, + "title": { "type": "string", "default": "MeshCentral", "description": "The title of this web site. All web pages will have this title." }, + "title2": { "type": "string", "default": null, "description": "Secondary title text that is placed on the upper right on the title on many web pages." }, + "titlePicture": { "type": "string", "default": null, "description": "Web site .png logo file that is 450x66 in size placed in meshcentral-data that is used on the top of many pages." }, + "loginPicture": { "type": "string", "default": null, "description": "Web site .png logo file placed in meshcentral-data that used on the login page when sitestyle is 2." }, + "rootRedirect": { "type": "string", "default": null, "description": "Redirects HTTP root requests to this URL. When in use, direct users to /login to see the normal login page." }, + "mobileSite": { "type": "boolean", "default": true, "description": "When set to false, this setting will disable the mobile site." }, + "unknownUserRootRedirect": { "type": "string", "default": null, "description": "Redirects HTTP root requests to this URL only where user is not already logged in. When in use, direct users to /login to see the normal login page." }, + "nightMode": { "type": "integer", "default": 0, "description": "0 = User selects day/night mode, 1 = Always night mode, 2 = Always day mode" }, + "userQuota": { "type": "integer" }, + "meshQuota": { "type": "integer" }, + "loginKey": { "type": [ "string", "array" ], "items": { "type": "string" }, "default": null, "description": "Requires that users add the value ?key=xxx in the URL in order to see the web site." }, + "agentKey": { "type": [ "string", "array" ], "items": { "type": "string" }, "default": null, "description": "Requires that agents add the value ?key=xxx in the URL in order to connect. This is not automatic and needs to be manually added in the meshagent.msh file." }, + "ipkvm": { "type": "boolean", "default": false, "description": "Set to true to enable IP KVM device support in this domain." }, + "minify": { "type": "boolean", "default": false, "description": "When enabled, the server will send reduced sided web pages." }, + "newAccounts": { "type": "boolean", "default": false, "description": "When set to true, allow new user accounts to be created from the login page." }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "userNameIsEmail": { "type": "boolean", "default": false, "description": "When enabled, the username of each account is also the email address of the account." }, + "newAccountEmailDomains": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "newAccountsRights": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "welcomeText": { "type": "string", "description": "Text that will be shown on the login screen." }, + "welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." }, + "welcomePictureFullScreen": { "type": "boolean", "default": false, "description": "When enabled, the welcomePicture will show as a fullscreen background on the login screen." }, + "meshMessengerTitle": { "type": "string", "default": "MeshMessenger", "description": "Text that will be displayed on the top of the messenger window when no username or device name is displayed." }, + "meshMessengerPicture": { "type": "string", "default": null, "description": "Name of a .png image file that is placed in meshcentral-data that is displayed on the top of the messenger web page. When null, the default image is displayed." }, + "hide": { "type": "integer", "default": 0, "description": "Sum of: 1 = Hide header, 2 = Hide tab, 4 = Hide footer, 8 = Hide title, 16 = Hide left bar, 32 = Hide back buttons" }, + "footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." }, + "loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." }, + "allowSavingDeviceCredentials": { "type": "boolean", "default": true, "description": "Allow users to save SSH, RDP, VNC device credentials on the server that can be used by any other user." }, + "guestDeviceSharing": { + "type": [ "boolean", "object" ], + "default": true, + "description": "When set to false, the desktop/terminal sharing link feature is not available.", + "properties": { + "maxSessionTime": { "type": "number", "description": "When set, limits the maximum length of a guest session, in minutes." } + } + }, + "autoRemoveInactiveDevices": { "type": "integer", "default": 0, "minimum": 0, "maximum": 2000, "description": "Number of days a device can be inactive before it's removed. 0 disables this feature. Device group setting will override this value." }, + "deviceSearchBarServerAndClientName": { "type": "boolean", "default": false, "description": "When set to true, the devices search box will match on both the server name and client name of a device." }, + "agentSelfGuestSharing": { + "type": [ "boolean", "object" ], + "default": false, + "description": "When set to true, MeshCentral Asssitant can create it's own guest sharing links.", + "properties": { + "expire": { "type": "number", "description": "When set, limits the self-created guest sharing link to this number of minutes." } + } + }, + "preConfiguredRemoteInput": { + "type": "array", + "default": null, + "description": "When set, you can right click on the input button in the desktop tab and instantly remotely type one of these pre-configured strings.", + "items": { + "type": "object", + "required": [ "name", "value" ], + "properties": { + "name": { + "description": "Name of the text string.", + "type": "string" + }, + "value": { + "description": "Text string that will be remotely typed when selected.", + "type": "string" + } + } + } + }, + "altMessenging": { + "type": "object", + "properties": { + "name": { "type": "string", "description": "Name of the alternative messaging service, for example: \"Jitsi\" " }, + "url": { "type": "string", "description": "URL to the alternative messaging services, for example: \"https://meet.jit.si/myserver-{0}\"" }, + "localurl": { "type": "string", "description": "If specified, this is the URL that is used on the administrator side, for example: \"https://meet.jit.si/myserver-{0}\"" } + }, + "required": [ "name", "url" ] + }, + "deviceMeshRouterLinks": { + "rdp": { "type": "boolean", "default": true, "description": "Display a RDP link in the device tab when supported." }, + "ssh": { "type": "boolean", "default": true, "description": "Display a SSH link in the device tab when supported." }, + "scp": { "type": "boolean", "default": true, "description": "Display a SCP link in the device tab when supported." }, + "extralinks": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "name", "protocol", "port" ], + "properties": { + "name": { + "description": "Name of the link to be displayed on the web site.", + "type": "string" + }, + "protocol": { + "description": "Protocol. Valid values are: custom,http,https,rdp,ssh,scp,mcrdesktop,mcrfiles.", + "type": "string" + }, + "port": { + "description": "The port on the remote device.", + "default": 0, + "minimum": 0, + "maximum": 65535, + "type": "integer" + }, + "ip": { + "description": "Target IP address. If not specified, the target of the connection is the remote device running the MeshAgent.", + "type": "string" + }, + "localport": { + "description": "The local port MeshCentral Router would bind to. By default, a random available port is used.", + "default": 0, + "minimum": 0, + "maximum": 65535, + "type": "integer" + }, + "filter": { + "description": "Array of node// or mesh// or tag: strings. When set, the link will only show up for the specified devices, device groups or device tag.", + "type": "array", + "items": { "type": "string" } + } + } + } + } + }, + "certUrl": { + "type": "string", + "format": "uri", + "description": "https url when to get the TLS certificate that MeshAgent's will see when connecting to this server. This setting is used when a reverse proxy like NGINX is used in front of MeshCentral." + }, + "myServer": { + "type": [ "object", "boolean" ], + "additionalProperties": false, + "properties": { + "Backup": { "type": "boolean", "default": true, "description": "Allows administrators to backup the server from the My Server tab." }, + "Restore": { "type": "boolean", "default": true, "description": "Allows administrators to restore the server from the My Server tab." }, + "Upgrade": { "type": "boolean", "default": true, "description": "Allows administrators to update the server from the My Server tab." }, + "ErrorLog": { "type": "boolean", "default": true, "description": "Allows administrators to see the server crash log the server from the My Server tab." }, + "Console": { "type": "boolean", "default": true, "description": "Allows administrators to access the server console from the My Server tab." }, + "Trace": { "type": "boolean", "default": true, "description": "Allows administrators to access the server trace tab from from the My Server tab." } + } + }, + "passwordRequirements": { + "type": "object", + "properties": { + "min": { "type": "integer", "description": "Minimum number of characters allowed for the account password." }, + "max": { "type": "integer", "description": "Maximum number of characters allowed for the account password." }, + "upper": { "type": "integer", "description": "Minimum number of upper case characters required in the password." }, + "lower": { "type": "integer", "description": "Minimum number of lower case characters required in the password." }, + "numeric": { "type": "integer", "description": "Minimum number of numeric characters required in the password." }, + "nonalpha": { "type": "integer", "description": "Minimum number of non-alpha-numeric characters required in the password." }, + "reset": { "type": "integer", "description": "Number of days after which the user is required to change the account password." }, + "email2factor": { "type": "boolean", "default": true, "description": "Set to false to disable email 2FA." }, + "sms2factor": { "type": "boolean", "default": true, "description": "Set to false to disable SMS 2FA." }, + "push2factor": { "type": "boolean", "default": true, "description": "Set to false to disable push notification 2FA." }, + "otp2factor": { "type": "boolean", "default": true, "description": "Set to false to disable one-time-password 2FA." }, + "backupcode2factor": { "type": "boolean", "default": true, "description": "Set to false to disable 2FA backup codes." }, + "single2factorWarning": { "type": "boolean", "default": true, "description": "Set to false to disable single 2FA warning." }, + "lock2factor": { "type": "boolean", "default": false, "description": "When set to true, prevents any changes to 2FA." }, + "force2factor": { "type": "boolean", "default": false, "description": "Requires that all accounts setup 2FA." }, + "skip2factor": { "type": "string", "description": "IP addresses where 2FA login is skipped, for example: 127.0.0.1,192.168.2.0/24" }, + "oldPasswordBan": { "type": "integer", "description": "Number of old passwords the server should remember and not allow the user to switch back to." }, + "banCommonPasswords": { "type": "boolean", "default": false, "description": "Uses WildLeek to block use of the 10000 most commonly used passwords." }, + "loginTokens": { "type": [ "boolean", "array" ], "default": true, "description": "Allows users to create alternative username/passwords for their account. Set to false to disallow all users, or set to a userid array to only all some users." }, + "twoFactorTimeout": { "type": "integer", "default": 300, "description": "Maximum about of time the to wait for a 2FA token on the login page in seconds." }, + "autofido2fa": { "type": "boolean", "default": false, "description": "If true and user account has FIDO key setup, 2FA login screen will automatically request FIDO 2FA." }, + "maxfidokeys": { "type": "integer", "default": null, "description": "Maximum number of FIDO/YubikeyOTP hardware 2FA keys that can be setup in a user account." }, + "allowaccountreset": { "type": "boolean", "default": true, "description": "If set to false, the account reset option on the login screen will not be available to users." } + } + }, + "twoFactorCookieDurationDays": { "type": "integer", "default": 30, "description": "Number of days that a user is allowed to remember this device for when completing 2FA. Set this to 0 to remove this option." }, + "auth": { "type": "string", "default": null, "enum": [null, "sspi", "ldap"], "description": "Type of user authentication to use, this can be SSPI on Windows or LDAP. If not set, username/password is used." }, + "ldapUserKey": { "type": "string" }, + "ldapUserName": { "type": "string" }, + "ldapUserEmail": { "type": "string" }, + "ldapUserRealName": { "type": "string" }, + "ldapUserPhoneNumber": { "type": "string" }, + "ldapOptions": { "type": "object", "description": "LDAP options passed to ldapauth-fork" }, + "agentInviteCodes": { "type": "boolean", "default": false, "description": "Enabled a feature where you can set one or more invitation codes in a device group. You can then give a invitation link to users who can use it to download the agent." }, + "agentNoProxy": { "type": "boolean", "default": false, "description": "When enabled, all newly installed MeshAgents will be instructed to no use a HTTP/HTTPS proxy even if one is configured on the remote system" }, + "agentTag": { + "type": "object", + "description": "This section is used to indicate if parts of the meshagent.tag file should be used to set server-side device properties.", + "additionalProperties": false, + "properties": { + "ServerName": { "type": "integer", "default": 0, "description": "Action taken if one of the lines in meshagent.tag contains ~ServerName:name. 0=Ignore, 1=Set." }, + "ServerDesc": { "type": "integer", "default": 0, "description": "Action taken if one of the lines in meshagent.tag contains ~ServerDesc:desc. 0=Ignore, 1=Set, 2=SetIfEmpty." }, + "ServerTags": { "type": "integer", "default": 0, "description": "Action taken if one of the lines in meshagent.tag contains ~ServerTags:tag1,tag2,tag3. 0=Ignore, 1=Set, 2=SetIfEmpty, 3=Append." } + } + }, + "geoLocation": { "type": "boolean", "default": false, "description": "Enables the geo-location feature and device location map in the user interface, this feature is not being worked on." }, + "novnc": { "type": "boolean", "default": true, "description": "When enabled, activates the built-in web-based VNC client." }, + "mstsc": { "type": "boolean", "default": false, "description": "When enabled, activates the built-in web-based RDP client." }, + "ssh": { "type": "boolean", "default": false, "description": "When enabled, activates the built-in web-based SSH client." }, + "webEmailsPath": { "type": "string", "description": "Path where to find custom email templates for this domain." }, + "customUI": { "type": "object" }, + "consentMessages": { + "type": "object", + "description": "This section is used to customize user consent prompts, these show up when asking if a remote session is allowed or not.", + "additionalProperties": false, + "properties": { + "Title": { "type": "string" }, + "Desktop": { "type": "string" }, + "Terminal": { "type": "string" }, + "Files": { "type": "string" }, + "consentTimeout": { "type": "integer", "default": 30, "description": "How long in seconds to show the user consent dialog box." }, + "autoAcceptOnTimeout": { "type": "boolean", "default": false, "description": "If true, user consent is accepted after the timeout." } + } + }, + "notificationMessages": { + "type": "object", + "additionalProperties": false, + "description": "This section is user to customize user notifications when a remote desktop, terminal or file session is connected to a remote system.", + "properties": { + "Title": { "type": "string" }, + "Desktop": { "type": "string" }, + "Terminal": { "type": "string" }, + "Files": { "type": "string" } + } + }, + "agentCustomization": { + "type": "object", + "additionalProperties": false, + "description": "Use this section to customize the agent branding.", + "properties": { + "displayName": { "type": "string", "default": "MeshCentral Agent", "description": "The name of the agent as displayed to the user." }, + "description": { "type": "string", "default": "Mesh Agent background service", "description": "The description of the agent as displayed to the user." }, + "companyName": { "type": "string", "default": "Mesh Agent", "description": "This will be used as the path to install the agent, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's." }, + "serviceName": { "type": "string", "default": "Mesh Agent", "description": "The name of the background service, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's but should be set to an all lower case, no space string." }, + "installText": { "type": "string", "default": null, "description": "Text string to show in the agent installation dialog box." }, + "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in the MeshCentral Agent installation dialog, image should be square and from 64x64 to 200x200." }, + "fileName": { "type": "string", "default": "meshagent", "description": "The agent filename." }, + "foregroundColor": { "type": "string", "default": null, "description": "Foreground text color, valid values are RBG in format 0,0,0 to 255,255,255 or format #000000 to #FFFFFF." }, + "backgroundColor": { "type": "string", "default": null, "description": "Background color, valid values are RBG in format 0,0,0 to 255,255,255 or format #000000 to #FFFFFF." } + } + }, + "assistantCustomization": { + "type": "object", + "additionalProperties": false, + "description": "Use this section to customize the MeshCentral Assistant.", + "properties": { + "title": { "type": "string", "default": "MeshCentral Assistant", "description": "Name to show as MeshCentral Assistant dialog title." }, + "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Assistant, image should be square and from 64x64 to 128x128." }, + "fileName": { "type": "string", "default": "meshagent", "description": "The MeshCentral Assistant filename." } + } + }, + "androidCustomization": { + "type": "object", + "additionalProperties": false, + "description": "Use this section to customize the MeshCentral Agent for Android.", + "properties": { + "title": { "type": "string", "default": "MeshCentral Agent", "description": "Displayed on top of the MeshCentral Agent for Android." }, + "subtitle": { "type": "string", "default": null, "description": "Subtitle displayed until the title on the toolbar." }, + "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Agent for Android, image should be square and from 64x64 to 128x128." } + } + }, + "ipBlockedUserRedirect" : { "type": "string", "default": null, "description": "If set, a user from a banned IP address will be redirected to this URL." }, + "userRequiredHttpHeader": { "type": "object", "default": null, "description": "When set, requires that a browser request have set HTTP header to allow user login. Example: \"{ \"Sec-Fetch-Dest\": \"iframe\" }\"" }, + "userAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only users from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "userBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, users from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only agents from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, agents from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "userSessionIdleTimeout": { "type": "integer", "default": null, "description": "When set, idle users will be disconnected after a set amounts of minutes." }, + "userConsentFlags": { + "type": "object", + "additionalProperties": false, + "description": "Use this section to require user consent for this domain.", + "properties": { + "desktopnotify": { "type": "boolean", "default": false, "description": "Enable desktop notification for this domain." }, + "terminalnotify": { "type": "boolean", "default": false, "description": "Enable terminal notification for this domain." }, + "filenotify": { "type": "boolean", "default": false, "description": "Enable files notification for this domain." }, + "desktopprompt": { "type": "boolean", "default": false, "description": "Enable desktop prompt for this domain." }, + "terminalprompt": { "type": "boolean", "default": false, "description": "Enable terminal user prompt for this domain." }, + "fileprompt": { "type": "boolean", "default": false, "description": "Enable files prompt for this domain." }, + "desktopprivacybar": { "type": "boolean", "default": false, "description": "Enable remote desktop privacy bar for this domain." } + } + }, + "urlSwitching": { "type": "boolean", "default": true, "description": "When users navigate thru the web interface, the URL on top will change to point to the current screen. This allows a user to refresh or bookmark the URL and come back to the correct screen. Setting false here will disable this feature." }, + "desktopPrivacyBarText": { "type": "string", "description": "This is the text that will be shown in the remote desktop privacy bar. You can use {0} to display the account realname or {1} to display the account identifier in the string." }, + "limits": { + "type": "object", + "additionalProperties": false, + "properties": { + "MaxDevices": { "type": "integer", "default": null, "description": "Maximum number of devices in this domain." }, + "MaxUserAccounts": { "type": "integer", "default": null, "description": "Maximum number of devices in this domain." }, + "MaxUserSessions": { "type": "integer", "default": null, "description": "Maximum number of user sessions that can connect to this server for this domain." }, + "MaxAgentSessions": { "type": "integer", "default": null, "description": "Maximum number of agents that can connect to this server for this domain." }, + "MaxSingleUserSessions": { "type": "integer", "default": null, "description": "Maximum number of sessions a single user can have. Each time a user opens a new browser tab or opens a new browser on a different computer, a new user session is created." } + } + }, + "terminal": { + "type": "object", + "description": "Values that affect the terminal feature", + "properties": { + "linuxShell": { + "type": "string", + "enum": [ "any", "root", "user", "login" ], + "default": "any", + "description": "Indicate what terminal options are available when the user clicks the right mouse button on the terminal connect button." + }, + "launchCommand": { + "type": "object", + "description": "Indicate what string the agent must write to the shell after starting a terminal session", + "linux": { "type": "string", "default": " alias ls=\\'ls --color=auto\\';clear\\n", "description": "String to write after opening a Linux terminal." }, + "darwin": { "type": "string", "default": null, "description": "String to write after opening a macOS terminal." }, + "freebsd": { "type": "string", "default": null, "description": "String to write after opening a FreeBSD terminal." } + } + } + }, + "desktop": { + "type": "object", + "description": "Values that affect the remote desktop feature", + "properties": { + "viewonly": { + "type": "boolean", + "description": "When set to true, the remote desktop feature is view only.", + "default": "false" + } + } + }, + "amtScanOptions": { + "description": "List of local network Intel AMT scanning options offered in the user interface. For example [\"LabNetwork 192.168.15.0/23\", \"SalesNetwork 192.168.8.0/24\"].", + "type": "array", + "default": null, + "items": { "type": "string" } + }, + "amtManager": { + "type": "object", + "additionalProperties": false, + "description": "Information passed to the AMT manager module that impacts all Intel AMT device managed within this domain.", + "properties": { + "TlsConnections": { "type": "boolean", "default": true, "description": "When set to false, MeshCentral will use TLS to connect to Intel AMT, this is not recommanded." }, + "TlsAcmActivation": { "type": "boolean", "default": false, "description": "When set to false, MeshCentral will not attempt a TLS ACM activation on Intel AMT v14+" }, + "AdminAccounts": { + "description": "List of username and passwords to try when connecting to Intel AMT.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "pass" ], + "properties": { + "user": { + "description": "Intel AMT administrator username.", + "type": "string", + "default": "admin" + }, + "pass": { + "description": "Intel AMT administrator password.", + "type": "string" + } + } + } + }, + "EnvironmentDetection": { + "description": "List of up to 4 domain suffixes to configure in Intel AMT when activating CIRA.", + "type": "array", + "items": { + "type": "string", + "minItems": 1, + "maxItems": 4, + "uniqueItems": true + } + }, + "TlsRootCert": { + "description": "Specifies a certificate and private key to use to issue Intel AMT TLS certificates. By default the MeshCentral self-signed root certificate is used.", + "type": "object", + "properties": { + "certpfx": { + "description": "Name of the certificate file that is in .p12 or .pfx format in meshcentral-data, use this with certpfxpass.", + "type": "string" + }, + "certpfxpass": { + "description": "Password for the file specified in certpfx.", + "type": "string" + }, + "certfile": { + "description": "Name of the certificate file in PEM format located in meshcentral-data. Using this with keyfile.", + "type": "string" + }, + "keyfile": { + "description": "Name of the private key file in PEM format located in meshcentral-data. Using this with certfile.", + "type": "string" + } + } + }, + "WifiProfiles": { + "description": "List of WIFI profiles to setup in any managed Intel AMT device with a WIFI network interface.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "ssid" ], + "properties": { + "name": { + "description": "WIFI profile name, if not specified the SSID is used.", + "type": "string" + }, + "ssid": { + "description": "SSID of the WIFI station.", + "type": "string" + }, + "authentication": { + "description": "WIFI authentication.", + "type": "string", + "enum": [ "wpa-psk", "wpa2-psk", "wpa-8021x", "wpa2-802.1x", "wpa3-sae-802.1x", "wpa3-owe-802.1x" ], + "default": "wpa2-psk" + }, + "encryption": { + "description": "WIFI encryption.", + "type": "string", + "enum": [ "ccmp-aes", "tkip-rc4" ], + "default": "ccmp-aes" + }, + "password": { + "description": "Password on the WIFI station", + "type": "string", + "minLength": 8, + "maxLength": 63 + }, + "802.1x": { + "description": "802.1x settings for this WIFI profile. Only required if the WIFI authentication type has 802.1x", + "default": null, + "type": "object", + "additionalProperties": false, + "required": [ "authenticationProtocol" ], + "properties": { + "authenticationProtocol": { + "description": "Identifies the authentication protocol used to authenticate the access requestor to the AAA server.", + "type": [ "integer", "string" ], + "enum": [ "EAP-TLS", "EAP-TTLS/MSCHAPv2", "PEAPv0/EAP-MSCHAPv2", "PEAPv1/EAP-GTC", "EAP-FAST/MSCHAPv2", "EAP-FAST/GTC", "EAP-MD5", "EAP-PSK", "EAP-SIM", "EAP-AKA", "EAP-FAST/TLS", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + }, + "serverCertificateNameComparison": { + "type": [ "integer", "string" ], + "default": "FullName", + "description": "Determines the comparison algorithm used between the ServerCertificateName value and the subject name field of the certificate presented by the AAA server.", + "enum": [ "FullName", "DomainSuffix", 2, 3 ] + }, + "serverCertificateName": { + "type": "string", + "default": null, + "description": "The name compared against the subject name field in the certificate provided by the AAA server.", + "maxLength": 80 + }, + "availableInS0": { + "type": "boolean", + "default": true, + "description": "Indicates the activity setting of the 802.1X module in H0 state" + }, + "protectedAccessCredentialHex": { + "type": "string", + "default": null, + "description": "A credential used by the supplicant and AAA server to establish a mutually authenticated encrypted tunnel for confidential user authentication.", + "maxLength": 64 + }, + "pacPassword": { + "type": "string", + "default": null, + "description": "Optional password to extract the PAC (Protected Access Credential) information from the PAC data.", + "maxLength": 256 + }, + "domain": { + "type": "string", + "default": null, + "description": "The domain within which Username is unique.", + "maxLength": 128 + }, + "username": { + "type": "string", + "default": null, + "description": "Within the domain specified by Domain, Identifies the user that is requesting access to the network.", + "maxLength": 128 + }, + "password": { + "type": "string", + "default": null, + "description": "The password associated with the user identified by Username and Domain.", + "maxLength": 32 + }, + "roamingIdentity": { + "type": "string", + "default": null, + "description": "A string presented to the authentication server in 802.1x protocol exchange", + "maxLength": 80 + }, + "pxeTimeoutInSeconds": { + "type": "integer", + "default": 120, + "description": "Timeout in seconds, in which the Intel(R) AMT will hold an authenticated 802.1X session." + } + } + } + } + } + }, + "802.1x": { + "description": "802.1x settings for the Intel AMT Wired interface. If set to false, any existing 802.1x wired profile will be removed from Intel AMT.", + "default": null, + "type": [ "object", "boolean" ], + "additionalProperties": false, + "required": [ "authenticationProtocol" ], + "properties": { + "authenticationProtocol": { + "description": "Identifies the authentication protocol used to authenticate the access requestor to the AAA server.", + "type": [ "integer", "string" ], + "enum": [ "EAP-TLS", "EAP-TTLS/MSCHAPv2", "PEAPv0/EAP-MSCHAPv2", "PEAPv1/EAP-GTC", "EAP-FAST/MSCHAPv2", "EAP-FAST/GTC", "EAP-MD5", "EAP-PSK", "EAP-SIM", "EAP-AKA", "EAP-FAST/TLS", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + }, + "serverCertificateNameComparison": { + "type": [ "integer", "string" ], + "description": "Determines the comparison algorithm used between the ServerCertificateName value and the subject name field of the certificate presented by the AAA server.", + "enum": [ "FullName", "DomainSuffix", 2, 3 ] + }, + "serverCertificateName": { + "type": "string", + "default": null, + "description": "The name compared against the subject name field in the certificate provided by the AAA server.", + "maxLength": 80 + }, + "availableInS0": { + "type": "boolean", + "default": true, + "description": "Indicates the activity setting of the 802.1X module in H0 state" + }, + "protectedAccessCredentialHex": { + "type": "string", + "default": null, + "description": "A credential used by the supplicant and AAA server to establish a mutually authenticated encrypted tunnel for confidential user authentication.", + "maxLength": 64 + }, + "pacPassword": { + "type": "string", + "default": null, + "description": "Optional password to extract the PAC (Protected Access Credential) information from the PAC data.", + "maxLength": 256 + }, + "domain": { + "type": "string", + "default": null, + "description": "The domain within which Username is unique.", + "maxLength": 128 + }, + "username": { + "type": "string", + "default": null, + "description": "Within the domain specified by Domain, Identifies the user that is requesting access to the network.", + "maxLength": 128 + }, + "password": { + "type": "string", + "default": null, + "description": "The password associated with the user identified by Username and Domain.", + "maxLength": 32 + }, + "roamingIdentity": { + "type": "string", + "default": null, + "description": "A string presented to the authentication server in 802.1x protocol exchange", + "maxLength": 80 + }, + "pxeTimeoutInSeconds": { + "type": "integer", + "default": 120, + "description": "Timeout in seconds, in which the Intel(R) AMT will hold an authenticated 802.1X session." + } + } + } + } + }, + "amtAcmActivation": { + "type": "object", + "additionalProperties": false, + "properties": { + "log": { "type": "string" }, + "certs": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "properties": { + "certfiles": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "keyfile": { "type": "string" } + }, + "required": [ "certfiles", "keyfile" ] + } + } + }, + "required": [ "certs" ] + }, + "redirects": { + "type": "object", + "additionalProperties": { "type": "string" }, + "description": "This is used to create HTTP redirections. For example setting \"redirects\": { \"example\":\"https://example.com\" } will make it so that anyone accessing /example on the server will get redirected to the specified URL." + }, + "yubikey": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { "type": "string" }, + "secret": { "type": "string" }, + "proxy": { "type": "string", "format": "uri" } + }, + "required": [ "id", "secret" ] + }, + "httpHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, + "agentConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshAgent .msh file" }, + "assistantConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshCentral Assistant .msh file" }, + "clipboardGet": { "type": "boolean", "default": true, "description": "When false, users can't set the clipboard of a remove device." }, + "clipboardSet": { "type": "boolean", "default": true, "description": "When false, users can't get the clipboard of a remove device." }, + "localSessionRecording": { "type": "boolean", "default": true, "description": "When false, removes the local recording feature on remote desktop." }, + "sessionRecording": { + "type": "object", + "additionalProperties": false, + "properties": { + "onlySelectedUsers": { "type": "boolean", "default": false, "description": "When enabled, only device users with the session recording feature turned on will be recorded. When false, all users are recorded." }, + "onlySelectedUserGroups": { "type": "boolean", "default": false, "description": "When enabled, only device user groups with the session recording feature turned on will be recorded. When false, all users are recorded." }, + "onlySelectedDeviceGroups": { "type": "boolean", "default": false, "description": "When enabled, only device groups with the session recording feature turned on will be recorded. When false, all devices are recorded." }, + "filepath": { "type": "string", "description": "The file path where recording files are kept." }, + "index": { "type": "boolean", "default": false, "description": "If true, automatically index remote desktop recordings so that the plays can skip to any place in the file." }, + "maxRecordings": { "type": "integer", "default": null, "description": "Maximum number of recording files to keep." }, + "maxRecordingDays": { "type": "integer", "default": null, "description": "Maximum number of days to keep a recording." }, + "maxRecordingSizeMegabytes": { "type": "integer", "default": null, "description": "Maximum number of recordings in megabytes. Once exceed, remove the oldest recordings." }, + "protocols": { "type": "array", "uniqueItems": true, "items": { "type": "integer" }, "description": "This is an array: 1 = Terminal, 2 = Desktop, 5 = Files, 100 = Intel AMT WSMAN, 101 = Intel AMT Redirection, 200 = Messenger" } + }, + "required": [ "protocols" ] + }, + "showPasswordLogin": { "type": "boolean", "default": true, "description": "When set to false, hides the username and password prompt on login screen." }, + "sendgrid": { + "title" : "SendGrid.com Email server", + "description": "Connects MeshCentral to the SendGrid email server, allows MeshCentral to send email messages for 2FA or user notification.", + "type": "object", + "properties": { + "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, + "apikey": { "type": "string", "description": "The SendGrid API key." }, + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." } + }, + "required": [ "from", "apikey" ] + }, + "smtp": { + "title" : "SMTP email server", + "description": "Connects MeshCentral to a SMTP email server, allows MeshCentral to send email messages for 2FA or user notification.", + "type": "object", + "properties": { + "name": { + "type": "string", + "format": "hostname", + "description": "Optional hostname of the client, this defaults to the hostname of the machine. This is useful for SMTP relays." + }, + "host": { + "type": "string", + "format": "hostname", + "description": "Hostname of the SMTP server." + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535, + "description": "SMTP server port number." + }, + "from": { + "type": "string", + "format": "email", + "description": "Email address used in the messages from field." + }, + "tls": { "type": "boolean" }, + "auth": { + "type": "object", + "properties": { + "clientId": { "type": "string" }, + "clientSecret": { "type": "string" }, + "refreshTfoken": { "type": "string" } + }, + "required": [ "clientId", "clientSecret", "refreshToken" ] + }, + "tlscertcheck": { "type": "boolean" }, + "tlsstrict": { "type": "boolean" }, + "verifyemail": { + "type": "boolean", + "default": true, + "description": "When set to false, the email format and DNS MX record are not checked." + } + }, + "required": [ "from" ] + }, + "sendmail": { + "title" : "Send email using the sendmail command", + "description": "Makes MeshCentral send emails using the Unix sendmail command. Allows MeshCentral to send email messages for 2FA or user notification.", + "type": "object", + "properties": { + "newline": { "type": "string", "default": "unix", "description": "Possible values are unix or windows" }, + "path": { "type": "string", "default": "sendmail", "description": "Path to the sendmail command" }, + "args": { "type": "array", "items": { "type": "string" }, "default": null, "description": "Array or arguments to pass to sendmail" } + } + }, + "authStrategies": { + "type": "object", + "additionalProperties": false, + "properties": { + "twitter": { + "type": "object", + "additionalProperties": false, + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "clientid", "clientsecret" ] + }, + "google": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "clientid", "clientsecret" ] + }, + "github": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "clientid", "clientsecret" ] + }, + "reddit": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "clientid", "clientsecret" ] + }, + "azure": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "tenantid": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "clientid", "clientsecret", "tenantid" ] + }, + "jumpcloud": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "entityid": { "type": "string" }, + "idpurl": { "type": "string", "format": "uri" }, + "cert": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "entityid", "idpurl", "cert" ] + }, + "saml": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "disableRequestedAuthnContext": { "type": "boolean" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "newAccountsRights": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "entityid": { "type": "string" }, + "idpurl": { "type": "string", "format": "uri" }, + "cert": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "entityid", "idpurl", "cert" ] + }, + "oidc": { + "type": "object", + "properties": { + "authorizationURL": { "type": "string", "format": "uri", "description": "If set, this will be used as the authorization URL. (If set tokenURL and userInfoURL need set also)" }, + "callbackURL": { "type": "string", "format": "uri", "description": "Required, this is the URL that your SSO provider sends auth approval to." }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "issuer": { "type": "string", "format": "uri", "description": "Full URL of SSO portal" }, + "tokenURL": { "type": "string", "format": "uri", "description": "If set, this will be used as the token URL. (If set authorizationURL and userInfoURL need set also)" }, + "userInfoURL": { "type": "string", "format": "uri", "description": "If set, this will be used as the user info URL. (If set authorizationURL and tokenURL need set also)" }, + "logouturl": { "type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link." }, + "newAccounts": { "type": "boolean", "default": true } + }, + "required": [ "issuer", "clientid", "clientsecret", "callbackURL" ] + } + } + } + } + } + }, + "letsEncrypt": { + "title" : "Built-in Let's Encrypt support", + "description": "If your server has a proper DNS name and it public facing on the Internet with a public facing HTTP server on port 80, you can get a free TLS certificate.", + "type": "object", + "additionalProperties": false, + "properties": { + "email": { "type": "string", "format": "email", "description": "Email address of the administrator of this server. Make sure this is a valid email address otherwise the certificate request will fail." }, + "names": { "type": "string" }, + "skipChallengeVerification": { "type": "boolean", "default": false, "description": "By default, MeshCentral will perform a self-test to make sure HTTP port 80 can respond correctly before making a request to Let's Encrypt. In some cases, this self-test can't work and must be skipped." }, + "production": { "type": "boolean", "default": false, "description": "By default a test certificate will be obtained from Let's Encrypt. Always start by getting a test certificate and make sure that works before setting this to true and obtaining a production certificaite. Making too many bad requests for a production certificate will get you banned for a long period of time." } + }, + "required": [ "email", "names" ] + }, + "peers": { + "title" : "Server peering", + "description": "Setup peer server for load-balancing between many servers.", + "type": "object", + "minProperties": 1, + "propertyNames": { "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" }, + "additionalProperties": false, + "properties": { + "serverId": { "type": "string" }, + "servers": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { "url": { "type": "string", "format": "uri" } }, + "required": [ "url" ] + } + } + }, + "required": [ "serverId", "servers" ] + }, + "sendgrid": { + "title" : "SendGrid.com Email server", + "description": "Connects MeshCentral to the SendGrid email server, allows MeshCentral to send email messages for 2FA or user notification.", + "type": "object", + "properties": { + "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, + "apikey": { "type": "string", "description": "The SendGrid API key." }, + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." } + }, + "required": [ "from", "apikey" ] + }, + "smtp": { + "title" : "SMTP email server", + "description": "Connects MeshCentral to a SMTP email server, allows MeshCentral to send email messages for 2FA or user notification.", + "type": "object", + "properties": { + "host": { "type": "string", "format": "hostname" }, + "port": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, + "tls": { "type": "boolean" }, + "tlscertcheck": { "type": "boolean" }, + "tlsstrict": { "type": "boolean" }, + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." } + }, + "required": [ "host", "port", "from", "tls" ] + }, + "sms": { + "title" : "SMS provider", + "description": "Connects MeshCentral to a SMS text messaging provider, allows MeshCentral to send SMS messages for 2FA or user notification.", + "oneOf": [ + { + "type": "object", + "properties": { + "provider": { "type": "string", "enum": [ "twilio" ] }, + "sid": { "type": "string" }, + "auth": { "type": "string" }, + "from": { "type": "string" } + }, + "required": [ "provider", "sid", "auth", "from" ] + }, + { + "type": "object", + "properties": { + "provider": { "type": "string", "enum": [ "plivo" ] }, + "id": { "type": "string" }, + "token": { "type": "string" }, + "from": { "type": "string" } + }, + "required": [ "provider", "id", "token", "from" ] + }, + { + "type": "object", + "properties": { + "provider": { "type": "string", "enum": [ "telnyx" ] }, + "apikey": { "type": "string" }, + "from": { "type": "string" } + }, + "required": [ "provider", "apikey", "from" ] + } + ] + } + }, + "required": [ "settings", "domains" ] +} +``` \ No newline at end of file diff --git a/docs/docs/meshcentral/customization.md b/docs/docs/meshcentral/customization.md deleted file mode 100644 index 654bb0bf..00000000 --- a/docs/docs/meshcentral/customization.md +++ /dev/null @@ -1,105 +0,0 @@ -# Customization - -Whitelabeling your MeshCentral installation to personalize it to your company's brand, as well as having your own terms of use is one of the first things many people do after installation. - -
- -
- -## Web Branding - -You can put your own logo on the top of the web page. To get started, get the file “logoback.png” from the folder “node_modules/meshcentral/public/images” and copy it to your “meshcentral-data” folder. In this example, we will change the name of the file “logoback.png” to “title-mycompany.png”. Then use any image editor to change the image and place your logo. - -![](images/2022-05-19-00-38-51.png) - -Once done, edit the config.json file and set one or all of the following values: - -```json -"domains": { - "": { - "Title": "", - "Title2": "", - "TitlePicture": "title-sample.png", - "loginPicture": "logintitle-sample.png", - "welcomeText": "This is sample text", - "welcomePicture": "mainwelcome-04.jpg", - "welcomePictureFullScreen": true, - "siteStyle": "1", - "nightMode": "1", - "meshMessengerTitle": "Mesh Chat", - "meshMessengerPicture": "chatimage.png", - "footer": "This is a HTML string displayed at the bottom of the web page when a user is logged in.", - "loginfooter": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." - }, -``` - -This will set the title and sub-title text to empty and set the background image to the new title picture file. You can now restart the server and take a look at the web page. Both the desktop and mobile sites will change. - -![](images/2022-05-19-00-39-35.png) - -![](images/2022-05-19-00-39-42.png) - -The title image must a PNG image of size 450 x 66. - -You can also customize the server icon in the “My Server” tab. By default, it’s a picture of a desktop with a padlock. - -![](images/2022-05-19-00-40-00.png) - -If, for example, MeshCentral is running on a Raspberry Pi. You may want to put a different picture at this location. Just put a “server.jpg” file that is 200 x 200 pixels in the “meshcentral-data” folder. The time MeshCentral page is loaded, you will see the new image. - -![](images/2022-05-19-00-40-13.png) - -This is great to personalize the look of the server within the web site. - -### Customizing Web Icons -MeshCentral lets you change the icons for different devices shown in the Web User Interface. To do this the proper way, you should make a new folder called `meshcentral-web` in the main directory, where you find other folders like `meshcentral-data`, `meshcentral-backup`, `meshcentral-files`, and `node-modules`. Inside `meshcentral-web`, make another folder named `public` and copy the entire `node_modules/meshcentral/public/images` folder into this new `meshcentral-web/public` folder and then edit the files in `meshcentral-web/public/images/`. This step is suggested because if MeshCentral updates, it might delete any changes in `node_modules`. But, changes in `meshcentral-web` will stay safe, and MeshCentral will use these files instead of the originals in `node_modules`. - -To update device icons, you need to edit these files: `meshcentral-web/public/images/webp/iconsXX.webp` (`icons16.webp`, `icons32.webp`, `icons50.webp`, `icons100.webp`), and `meshcentral-web/public/images/iconsXX.png` (`icons16.png`, `icons32.png`, `icons50.png`, `icons64.png`, `icons100.png`) and the corresponding `meshcentral-web/public/images/icons256-X-1.png`. Make sure to keep the resolution of these files as it is. - -By following these steps, you can customize any icon in MeshCentral. Just find and change the corresponding image files in the `meshcentral-web/public/images` folder. Similarly, you can also move other folders from `node_modules/meshcentral` to `meshcentral-web` while keeping the original folder structure. This allows you to modify other parts of MeshCentral too, like the `.handlebars` templates for the web interface. Simply copy files from `node_modules/meshcentral/views` to `meshcentral-web/views` and make your changes in `meshcentral-web`. This lets you match MeshCentral's look to your company's brand or your own style. -![](images/custom-web-icons.png) - -### Customizing Agent Invitation -Agents can be invited by public link or via email. [Click Here](assistant.md#agent-invitation) to see details. - -## Agent Branding - -You can customize the Agent to add your own logo, change the title bar, install text, the service name, or even colors! - -!!!note - The Customization must be done FIRST and BEFORE you deploy your agents! Once the agents have been deployed, any customization made afterwards, will not sync! This is because the setup files are customized on the fly, then when you install the agents, the exe and .msh file with the customizations in are copied over to the required folder, so you will need to reinstall the agent for agent customizations to take effect. - -![](images/2022-08-24-06-42-40.png) - -```json -"domains": { - "": { - "agentCustomization": { - "displayName": "MeshCentral Agent", - "description": "Mesh Agent background service", - "companyName": "Mesh Agent Company", - "serviceName": "Mesh Agent Service", - "installText": "Text string to show in the agent installation dialog box", - "image": "mylogo.png", - "fileName": "meshagent", - "foregroundColor": "#FFA500", - "backgroundColor": "#EE82EE" - } - } -} -``` - -![agent icon](images/agentico.png) - -## Terms of use - -You can change the terms of use of the web site by adding a “terms.txt” file in the “meshcentral-data” folder. The file can include HTML markup. Once set, the server does not need to be restarted, the updated terms.txt file will get used the next time it’s requested. - -For example, placing this in “terms.txt” - -``` -
-This is a test file. -``` - -Will show this on the terms of use web page. diff --git a/docs/docs/meshcentral/debugging.md b/docs/docs/meshcentral/debugging.md index 68a3725e..ab6faa82 100644 --- a/docs/docs/meshcentral/debugging.md +++ b/docs/docs/meshcentral/debugging.md @@ -21,124 +21,10 @@ Make sure you understand how MeshCentral works with your browser using chrome de "AgentWsCompression": false, ``` -### Understanding node and paths - -Note that when running MeshCentral, you should always run from the path that is parent to node_modules, so you do this: - -``` -cd C:\Program Files\Open Source\MeshCentral -node node_modules\meshcentral -``` - -You do NOT do this: - -``` -cd C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral -node meshcentral -``` - -The problem with the second command is that NPM may install missing modules in the incorrect location. - -Also, in general I recommend not using the MeshCentral MSI Installer and just install manually unless you are very scared of the command prompt. Anyone that knows a bit about the shell should install MeshCentral like this: - -``` -mkdir c:\meshcentral -cd c:\meshcentral -npm install meshcentral -node node_modules\meshcentral -(ctrl-c when done installing optional modules) -node node_modules\meshcentral --install -``` - -This way, you have a lot more control over what is going on. In my opinion, the MSI installer basically does the same thing and installs NodeJS for you. - -### Unable to update server - -Generally the problem is that MeshCentral can't find the npm tool and therefore, can't run it to see if there is a new version. You can fix this by setting the path to npm in the config.json like this: - -```json -{ - "settings": { - "npmPath": "c:\\npm.exe", - "npmProxy": "http://1.2.3.4:80" - } -} -``` - -The problem could also be that you need a proxy, the configuration line to that is above. - -You can also manually update. Just stop your server and so this: - -```bash -mv node_modules node_modules_bak -npm install meshcentral -node node_modules/meshcentral -``` - -Then wait for all optional modules to install, then once the server starts hit ctrl-c and start up the server again. You can also use the following to help you start/stop the server: - -```bash -node node_modules/meshcentral --install -node node_modules/meshcentral --uninstall -node node_modules/meshcentral --start -node node_modules/meshcentral --stop -``` - -### Port Troubleshooting on server - -If you're getting a `port 4433 is not available` error, this is because another process is using this port, very likely another instance of MeshCentral. If your MeshCentral server is bound to ports 81/444 MeshCentral could not get port 80/443 and got the next available ones. - -In general the problem is that you are running two MeshCentral instances at the same time. Probably one as a background Windows Service and one in the command line. Which ever instance can grab port 4433 will have a running MPS and CIRA should work, but the second instance will not have port 4433 and CIRA will not work. - -### Running Meshcentral server in debug mode - -Debug more will cause MeshCentral to output a lot of debug messages to the console. To display all debug messages, run MeshCentral like this: - -```bash -node node_modules/meshcentral --debug -``` - -A more practical way to run the debug command it to specify what messages you want printed out using a comma seperated list, for example: - -```bash -node node_modules/meshcentral --debug web,amt,mps -``` - -Here is the list of all debug options: - -``` -cookie - Cookie encoder -dispatch - Message Dispatcher -main - Main Server Messages -peer - MeshCentral Server Peering -agent - MeshAgent traffic -agentupdate - MeshAgent update -cert - Server Certificate -db - Server Database -email - Email/SMS/Push Traffic -web - Web Server -webrequest - Web Server Requests -relay - Web Socket Relay -httpheaders - Web Server HTTP Headers -authlog - User Authentication Log -amt - Intel AMT -webrelay - Connection Relay -mps - CIRA Server -mpscmd - CIRA Server Commands -``` - -You can also specify the `debug` option in the config.json file in the `settings` section. For example: - -``` -"settings": { - "debug": "web,amt,mps" -} -``` - - ### Enabling trace in your browser Dev Tools -You can enable browser console tracing by adding `trace=1` as a parameter to the URL of the MeshCentral main web page. For example `https://myserver.com/?trace=1`. Once present, open the browser's console window to see all web client tracing messages. +`Trace=1` as a parameter in chrome dev tools for debugging + To log all database queries, change log_statement in /etc/postgresql/13/main/postgresql.conf @@ -163,14 +49,6 @@ If you want to change node to meshcentral in journalctl, add this to /etc/system SyslogIdentifier=meshcentral ``` -### Finding agent problems - -Using the servers `My Server > console` - -* `agentstatus` - Gives you summary counts of problems -* `agentissues` - Gives IP:port and what error -* `dupagents` - Gives duplicateAgent IP's, counts and names - ### Logging it all To log everything that's possible, prepare the log directory. @@ -248,12 +126,6 @@ service meshcentral restart ## MeshAgent -Troubleshooting agent - -```bash -./meshagent -state -``` - ### Agent Debug Logs to server This automatically downloads all agent error logs into `meshcentral-data/agenterrorlogs.txt` @@ -335,47 +207,3 @@ Then open your browser to http://localhost:9999 or whatever port you used. !!!note If you pause the debugger, and happen to forget about it, the agent will automatically kill itself and restart because it will think that a thread is stuck. Default debugger timeout is 10 minutes, you may find a log entry saved to disk saying "Microstack Thread STUCK", or something similar. -### Troubleshooting Agent connectivity - -If an agent keeps disconnecting and reconnecting, add this line to the "settings" section of the config.json: - -``` -"agentping": 30 -``` - -This will cause MeshCentral to "ping" the agent every 30 seconds and the agent to respond with a "pong" each time. That usually solves the issue however, it does generate more traffic. If that works, you can remove the line and try this line instead: - -``` -"agentpong": 30 -``` - -This will cause MeshCentral to "pong" the agent every 30 seconds, the agent will not respond. This usually fixes the issue, but you have half the traffic. I would also increase the time like: - -``` -"agentpong": 90 -``` - -This is the best, you have one way traffic to all agents every 90 seconds. The larger the number you can get away with the better. - -If you ever get the same problem but on the browser side, you can also use one of these: - -``` -"browserping": 30 -"browserpong": 30 -``` - -Same idea, browser side instead of agent side. - -## Intel AMT - -To debug issues, confirm that Intel AMT is active and there MeshCentral is not showing any red errors on the "Intel AMT" line: - -![](images/amt_troubleshoot1.png) - -Next, you can go in the "My Server / Trace" tab and enable tracing on the "Intel AMT Manager" like this: - -![](images/amt_troubleshoot2.png) - -You can then open another tab and select to power off or power on Intel AMT, you should see "performPowerAction" with 2 or 8 depending on power on/off. - -![](images/amt_troubleshoot3.png) diff --git a/docs/docs/meshcentral/devicetabs.md b/docs/docs/meshcentral/devicetabs.md index 8e4f4169..4373a399 100644 --- a/docs/docs/meshcentral/devicetabs.md +++ b/docs/docs/meshcentral/devicetabs.md @@ -1,270 +1,26 @@ # Device Tabs -## Search or Filter - -You can search your list of agents using any of these criteria using the filter box (also viewable in the tooltip of the Filter box): - -user:xxx or u:xxx -ip:xxx -group:xxx or g:xxx -tag:xxx or t:xxx -atag:xxx or a:xxx -os:xxx -amt:xxx -desc:xxx -wsc:ok -wsc:noav -wsc:noupdate -wsc:nofirewall -wsc:any - ## General -For viewing general information about the agent - -* Group -* Description -* IP-KVM Port Number -* IP-KVM Port Type -* Intel AMT -* Intel AMT Tag -* Mesh Agent -* Operating System -* Windows Security -* Antivirus -* Active User -* User Consent -* Notifications -* Tags - -### Fields - -### Buttons - -Actions -Notes -Log Event -Message -PDU On/Off/Control -Chat - ### 7 Day Power State -![](images/7daypowerstate.png) - Legend -* **_Black color_**: Device is Powered On on (Intel AMT & agents) -* **_Purple color_**: Device is in sleep state such as Hibernating (Intel AMT agents only) -* **_Teal color_**: Device is connected through AMT/CIRA, but the Power State is UNKNOWN (Intel AMT agents only) -* **_DarkGreen color_**: Device is connected through AMT/CIRA and is in Soft-Off Power State (Intel AMT agents only) -* **_Grey color_**: Device is Powered Off/Not Connected To MeshCentral (Intel AMT & agents) +1. Black color: device is powered om +2. purple color: device is in sleep state +3. blue/green color : device is connected trough amt/cira, but not powered on +4. grey color: device is powered off -### Text Links - -You can set alternate port in the link if it's not default by right-clicking. - -![](images/general_alternateports.png) - -* Interfaces -* Location -* MeshCmd -* RDP -* Web-VNC -* Web-RDP -* Web-SSH -* XTerm -* HTTP -* HTTPS -* SSH -* SCP -* MQTT Login +![](images/7daypowerstate.png) ## Desktop -For connecting to the machines KVM interface. - -### Connect Button - -Right-clicking on Connect button will give you additional options: - -* Ask Consent + Bar -* Ask Consent -* Privacy Bar - -![](images/desktop_connectbutton.png) - -### RDP Connect Button - -Right-clicking on RDP Connect button allows you to specify Alternate Port. - -![](images/desktop_rdpconnectbutton.png) - -### Intel AMT Connect Button - -Uses Intel AMT to control video output of the hardware video card. - -### During a desktop session - -**Bottom left include:** - -![desktop bottom left](images/desktop_buttonsbottomleft.png) - -* Sending special Keys - -**Top Right include:** - -Actions - -![](images/desktop_buttonstopright_actions.png) - -* Wake Up -* Run Commands -* Sleep -* Reset -* Power Off -* Uninstall Agent - -Settings - -![](images/desktop_settings.png) - -* Quality -* Scaling -* Frame rate -* Swap Mouse Buttons -* Reverse Mouse Wheel -* Use Remote Keyboard Map -* Automatic Clipboard -* Lock on Disconnect - -![](images/desktop_buttonstopright_other.png) - -* Session recording indicator -* Screen rotating -* switching view mode -* full screen - -Bottom right include: - -![](images/desktop_buttonsbottomright.png) - -* Session Sharing with Guest -* Toggling keyboard lockout on guest -* Refresh Desktop view -* Upload Clipboard -* Download Clipboard -* Record Session to file -* Take screenshot -* Toggle Remote Desktop Background -* Open URL on remote desktop -* Lock the Remote computer -* Display a notification on the remote computer -* Open Chat Window - ## Terminal -For connecting to a command line based interface on the agent - -Right-clicking on Connect button allows you to: - -!!!note - Linux and Windows have different options: - -* Admin Shell (Windows) -* Admin Powershell (Windows) -* User Shell (Windows) -* User Powershell (Windows) -* SSH (Linux) - -![](images/terminal_connectbutton.png) - ## Files -For transferring files to and from the agent. - ## Events -Mesh Events related to the agent. This is your audit log to see what actions have been taken on the agent from the MeshCentral server. - ## Details -Agent information that includes: - -* OS -* Agent Info -* Network Info -* BIOS -* Motherboard -* Memory -* Storage -* Intel AMT - -Note you can show CPU and Memory usage info by clicking the icon in the top right corner - -![](images/details_cpuram.png) - -## Intel AMT - -## Console - -For debugging and communicating with the mesh agent. - -It allows JS commands to be issued to the device but also run extra commands from the meshcore. Type `help` for all available options - -- 2falock -- acceleratorsstats -- agentissues -- agentstats -- amtacm -- amtmanager -- amtpasswords -- amtstats -- args -- autobackup -- backupconfig -- bad2fa -- badlogins -- certexpire -- certhashes -- closeusersessions -- cores -- dbcounters -- dbstats -- dispatchtable -- dropallcira -- dupagents -- email -- emailnotifications -- firebase -- heapdump -- heapdump2 -- help -- info -- le -- lecheck -- leevents -- maintenance -- migrationagents -- mps -- mpsstats -- msg -- nodeconfig -- print -- relays -- removeinactivedevices -- resetserver -- serverupdate -- setmaxtasks -- showpaths -- sms -- swarmstats -- tasklimiter -- trafficdelta -- trafficstats -- updatecheck -- usersessions -- versions -- watchdog -- webpush -- webstats +## Console \ No newline at end of file diff --git a/docs/docs/meshcentral/faq.md b/docs/docs/meshcentral/faq.md deleted file mode 100644 index 1c5b2404..00000000 --- a/docs/docs/meshcentral/faq.md +++ /dev/null @@ -1,83 +0,0 @@ -# FAQ - -## json config files - -Any item in the config.json file starting with an underscore character are ignored. - -Ignored - -```json -"_title": "MyServer" -``` - -Valid setting - -```json -"title": "MyServer" -``` - -json requires correct formatting, if in doubt copy/paste your json config into a web based format checker to make sure you have it right: - -## Help! I've been hacked there are weird agents appearing in my MeshCentral Console - -No, you haven't. - -1. Your agent installer was scanned by an antivirus. - -2. It didn't recognize the exe. - -3. You have the option enabled to submit unknown applications for analysis. - - ![AV Option1](images/faq_av_option1.png) - -4. They ran it against their virtualization testing cluster. - -5. You allow anyone to connect to your server (you should look into techniques to hide your server from the internet). - -6. Here are some examples of what that looks like. - -## Can't login on server after first setup - -You're sure you're typing in everything right, giving it 2FA code and can't login - -[TOTP](https://en.wikipedia.org/wiki/Time-based_one-time_password) is time sensitive, check your time/NTP and make sure it's right (on server and TOTP app device)! :) - -![](images/2022-08-04-18-19-19.png) - -## Branding and Customization - -You can brand and customize MeshCentral almost as much as you like without delving into the code, a few changes in the config.json file and uploading images can change the way your system looks. Read more [here](https://ylianst.github.io/MeshCentral/meshcentral/#branding-terms-of-use) - -!!!note - You will need to reinstall the agent for agent customizations to take effect. - -## Mac Clients - -You have to manually grant Mac permissions outside of the agent install process due to the MacOS security system under Security & Privacy > Privacy - -To see the screen (otherwise you just see the menu bar, and otherwise blank) - -![](images/2023-11-29-12-57-15.png) - -To be able to transfer files - -![](images/2023-11-29-12-58-05.png) - -To be able to control keyboard and mouse - -![](images/2023-11-29-12-58-36.png) - -## I'm using CloudFlare and I'm getting a black screen but the mouse moves? - -If you are using CloudFlare for your DNS hosting and your remote screen is black, DONT PANIC! - -Unfortunately, MeshCentral doesn't always work with CloudFlare's Proxy DNS Mode. - -The fix is to simply set the 'Proxy Status' to OFF inside your DNS A Record, within the CloudFlare control panel. - -Simply follow the steps [here](https://developers.cloudflare.com/fundamentals/setup/manage-domains/pause-cloudflare/#disable-proxy-on-dns-records) - -Once done, open your firewall for the `port` and `agentPort` ports of where your meshcentral is hosted, then restart your MeshCentral Server - -There is currently a PINNED GitHub issue about this [here](https://github.com/Ylianst/MeshCentral/issues/5302) - diff --git a/docs/docs/meshcentral/images/2022-07-02-06-27-36.png b/docs/docs/meshcentral/images/2022-07-02-06-27-36.png deleted file mode 100644 index de0ba8fc..00000000 Binary files a/docs/docs/meshcentral/images/2022-07-02-06-27-36.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2022-08-24-06-42-40.png b/docs/docs/meshcentral/images/2022-08-24-06-42-40.png deleted file mode 100644 index 7edcf6a2..00000000 Binary files a/docs/docs/meshcentral/images/2022-08-24-06-42-40.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2022-09-06-16-38-57.png b/docs/docs/meshcentral/images/2022-09-06-16-38-57.png deleted file mode 100644 index 4befd73b..00000000 Binary files a/docs/docs/meshcentral/images/2022-09-06-16-38-57.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2023-02-24vscodejsonediting.png b/docs/docs/meshcentral/images/2023-02-24vscodejsonediting.png deleted file mode 100644 index 114e575b..00000000 Binary files a/docs/docs/meshcentral/images/2023-02-24vscodejsonediting.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2023-11-29-12-57-15.png b/docs/docs/meshcentral/images/2023-11-29-12-57-15.png deleted file mode 100644 index 67718be7..00000000 Binary files a/docs/docs/meshcentral/images/2023-11-29-12-57-15.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2023-11-29-12-58-05.png b/docs/docs/meshcentral/images/2023-11-29-12-58-05.png deleted file mode 100644 index f86536c8..00000000 Binary files a/docs/docs/meshcentral/images/2023-11-29-12-58-05.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2023-11-29-12-58-36.png b/docs/docs/meshcentral/images/2023-11-29-12-58-36.png deleted file mode 100644 index deb41c14..00000000 Binary files a/docs/docs/meshcentral/images/2023-11-29-12-58-36.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2023-11-29_140845 - mesh json1.png b/docs/docs/meshcentral/images/2023-11-29_140845 - mesh json1.png deleted file mode 100644 index b000fe1b..00000000 Binary files a/docs/docs/meshcentral/images/2023-11-29_140845 - mesh json1.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/2023-11-29_140845 - mesh json2.png b/docs/docs/meshcentral/images/2023-11-29_140845 - mesh json2.png deleted file mode 100644 index d530454b..00000000 Binary files a/docs/docs/meshcentral/images/2023-11-29_140845 - mesh json2.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/7daypowerstate.png b/docs/docs/meshcentral/images/7daypowerstate.png index c732043e..de545544 100644 Binary files a/docs/docs/meshcentral/images/7daypowerstate.png and b/docs/docs/meshcentral/images/7daypowerstate.png differ diff --git a/docs/docs/meshcentral/images/In-production.png b/docs/docs/meshcentral/images/In-production.png deleted file mode 100644 index c1fc2e64..00000000 Binary files a/docs/docs/meshcentral/images/In-production.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/OAuth-Internal-External.png b/docs/docs/meshcentral/images/OAuth-Internal-External.png deleted file mode 100644 index 13b14c8a..00000000 Binary files a/docs/docs/meshcentral/images/OAuth-Internal-External.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/agentico.png b/docs/docs/meshcentral/images/agentico.png deleted file mode 100644 index dccb2ab1..00000000 Binary files a/docs/docs/meshcentral/images/agentico.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/amt_troubleshoot1.png b/docs/docs/meshcentral/images/amt_troubleshoot1.png deleted file mode 100644 index 6fb86d83..00000000 Binary files a/docs/docs/meshcentral/images/amt_troubleshoot1.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/amt_troubleshoot2.png b/docs/docs/meshcentral/images/amt_troubleshoot2.png deleted file mode 100644 index 69f145fb..00000000 Binary files a/docs/docs/meshcentral/images/amt_troubleshoot2.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/amt_troubleshoot3.png b/docs/docs/meshcentral/images/amt_troubleshoot3.png deleted file mode 100644 index ce2df23e..00000000 Binary files a/docs/docs/meshcentral/images/amt_troubleshoot3.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/custom-web-icons.png b/docs/docs/meshcentral/images/custom-web-icons.png deleted file mode 100644 index 9edb5569..00000000 Binary files a/docs/docs/meshcentral/images/custom-web-icons.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_buttonsbottomleft.png b/docs/docs/meshcentral/images/desktop_buttonsbottomleft.png deleted file mode 100644 index e9367ae2..00000000 Binary files a/docs/docs/meshcentral/images/desktop_buttonsbottomleft.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_buttonsbottomright.png b/docs/docs/meshcentral/images/desktop_buttonsbottomright.png deleted file mode 100644 index e2d1b99d..00000000 Binary files a/docs/docs/meshcentral/images/desktop_buttonsbottomright.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_buttonstopright_actions.png b/docs/docs/meshcentral/images/desktop_buttonstopright_actions.png deleted file mode 100644 index 08c7a58a..00000000 Binary files a/docs/docs/meshcentral/images/desktop_buttonstopright_actions.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_buttonstopright_other.png b/docs/docs/meshcentral/images/desktop_buttonstopright_other.png deleted file mode 100644 index b734aa76..00000000 Binary files a/docs/docs/meshcentral/images/desktop_buttonstopright_other.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_connectbutton.png b/docs/docs/meshcentral/images/desktop_connectbutton.png deleted file mode 100644 index 4f97e8f0..00000000 Binary files a/docs/docs/meshcentral/images/desktop_connectbutton.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_rdpconnectbutton.png b/docs/docs/meshcentral/images/desktop_rdpconnectbutton.png deleted file mode 100644 index 4c338622..00000000 Binary files a/docs/docs/meshcentral/images/desktop_rdpconnectbutton.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/desktop_settings.png b/docs/docs/meshcentral/images/desktop_settings.png deleted file mode 100644 index e03c6080..00000000 Binary files a/docs/docs/meshcentral/images/desktop_settings.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/details_cpuram.png b/docs/docs/meshcentral/images/details_cpuram.png deleted file mode 100644 index 8898f52f..00000000 Binary files a/docs/docs/meshcentral/images/details_cpuram.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/email-invitation.png b/docs/docs/meshcentral/images/email-invitation.png deleted file mode 100644 index db9d2196..00000000 Binary files a/docs/docs/meshcentral/images/email-invitation.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/faq_av_option1.png b/docs/docs/meshcentral/images/faq_av_option1.png deleted file mode 100644 index 718bae37..00000000 Binary files a/docs/docs/meshcentral/images/faq_av_option1.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/gc-newproject.png b/docs/docs/meshcentral/images/gc-newproject.png deleted file mode 100644 index 715b68f9..00000000 Binary files a/docs/docs/meshcentral/images/gc-newproject.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/gc-oauthconsent.png b/docs/docs/meshcentral/images/gc-oauthconsent.png deleted file mode 100644 index a493c589..00000000 Binary files a/docs/docs/meshcentral/images/gc-oauthconsent.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/gc-oauthconsent2.png b/docs/docs/meshcentral/images/gc-oauthconsent2.png deleted file mode 100644 index 10697dd1..00000000 Binary files a/docs/docs/meshcentral/images/gc-oauthconsent2.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/gc-oauthcredentials.png b/docs/docs/meshcentral/images/gc-oauthcredentials.png deleted file mode 100644 index 243928b0..00000000 Binary files a/docs/docs/meshcentral/images/gc-oauthcredentials.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/gc-oauthscopes.png b/docs/docs/meshcentral/images/gc-oauthscopes.png deleted file mode 100644 index 10697dd1..00000000 Binary files a/docs/docs/meshcentral/images/gc-oauthscopes.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/gc-playground.webp b/docs/docs/meshcentral/images/gc-playground.webp deleted file mode 100644 index a0fb99f6..00000000 Binary files a/docs/docs/meshcentral/images/gc-playground.webp and /dev/null differ diff --git a/docs/docs/meshcentral/images/general_alternateports.png b/docs/docs/meshcentral/images/general_alternateports.png deleted file mode 100644 index ab3d0451..00000000 Binary files a/docs/docs/meshcentral/images/general_alternateports.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/ldap_integration.png b/docs/docs/meshcentral/images/ldap_integration.png deleted file mode 100644 index 11f3994f..00000000 Binary files a/docs/docs/meshcentral/images/ldap_integration.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/rate_limiting_logins.png b/docs/docs/meshcentral/images/rate_limiting_logins.png deleted file mode 100644 index 26fe109d..00000000 Binary files a/docs/docs/meshcentral/images/rate_limiting_logins.png and /dev/null differ diff --git a/docs/docs/meshcentral/images/terminal_connectbutton.png b/docs/docs/meshcentral/images/terminal_connectbutton.png deleted file mode 100644 index 52bbb888..00000000 Binary files a/docs/docs/meshcentral/images/terminal_connectbutton.png and /dev/null differ diff --git a/docs/docs/meshcentral/index.md b/docs/docs/meshcentral/index.md index b25ac0f7..9a56067e 100644 --- a/docs/docs/meshcentral/index.md +++ b/docs/docs/meshcentral/index.md @@ -1,8 +1,8 @@ -# MeshCentral Guide +# Meshcentral2 Guide -[MeshCentral Guide](https://meshcentral.com/docs/MeshCentral2UserGuide.pdf) +[MeshCentral2 Guide](https://meshcentral.com/info/docs/MeshCentral2UserGuide.pdf) -MeshCmd Guide [as .pdf](https://meshcentral.com/docs/MeshCmdUserGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCentral User's Guide v0.2.9.odt?raw=true) +MeshCmd Guide [as .pdf](https://meshcentral.com/info/docs/MeshCmdUserGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCentral User's Guide v0.2.9.odt?raw=true) ## Video Walkthru @@ -52,6 +52,10 @@ This is because by default MeshCentral is using a self-signed certificate that i - Click on “Advanced”, “Proceed to (unsafe)” + To proceed on Internet Explorer 11, + +- Click “Continue to this website (not recommended)” + Note: You can also get to a device by specifying the device name in the URL by adding `?viewmode=10&gotodevicename=MyComputer` to the URL of the MeshCentral web page. The new `gotodevicename` will find a device with the specified name and navigate to that device’s page. This is perfect for integrating MeshCentral with other solutions but be aware that a computer name is not a unique identifier and so, `&gotonode=` is always the preferred way to access a device. This feature also works on the mobile web site. ### Create Account @@ -213,7 +217,7 @@ As indicated before, the settings section of the config.json is equivalent to pa | RedirPort | This is the port for redirecting traffic in the web server. When the server is configured with HTTPS, users that uses HTTP will be redirected to HTTPS. Port 80 is the default port. So, redirection will happen from port 80 to port 443. | | MpsPort | Port for Intel" AMT Management Presence Server to receive Intel" AMT CIRA (Client Initiated Remote Access) connections. The default is port 4433. This port is disabled in LAN mode. If user don"t plan on using Intel" AMT for management, this port can be left as-is. | | TLSOffload | By default this option is set to "false". If set to "true", server will run both web port and the Intel AMT MPS port without TLS with the assumption that a TLS offloading is taking care of this task. For further details, see the "TLS Offloading" section. This option can also be set to the IP address of the reverse-proxy in order to indicate to MeshCental to only trust HTTP X-Forwarded headers coming from this IP address. See the "Reverse-Proxy Setup" section for an example. | -| SelfUpdate | When set to "true" the server will check for a new version and attempt to self-update automatically a bit after midnight local time every day. If set to a specific version such as "1.1.21" the server will immediately update to the specified version on startup if it's not already at this version. | +| SelfUpdate | When set to "true" the server will check for a new version and attempt to self-update automatically a bit after midnight local time every day. For this to work, the server needs to run with sufficient permissions to overwrite its own files. If you run the server with more secure, restricted privileges, this option should not be used. If set to a specific version such as "0.2.7-g" when the server will immediately update to the specified version on startup if it"s not already at this version. | | SessionKey | This is the encryption key used to secure the user"s login session. It will encrypt the browser cookie. By default, this value is randomly generated each time the server starts. If many servers are used with a load balancer, all servers should use the same session key. In addition, one can set this key so that when the server restarts, users do not need to re-login to the server. | | Minify | Default value is 0, when set to 1 the server will serve "minified" web pages, that is, web pages that have all comments, white spaces and other unused characters removed. This reduces the data size of the web pages by about half and reduced the number requests made by the browser. The source code of the web page will not be easily readable, adding "&nominify=1" at the end of the URL will override this option. | | User | Specify a username that browsers will be automatically logged in as. Useful to skip the login page and password prompts. Used heavily during development of MeshCentral. | @@ -305,120 +309,6 @@ When the MongoDB is setup for the first time, a unique identifier is generated a Once peered, all of the servers should act like one single host, no matter which server the user(s) are connected to. -## Email Setup - -We highly recommend the use of an email server (SMTP) because we could allow MeshCentral to verify user account’s email address by sending a confirmation request to the user to complete the account registration and for password recovery, should a user forget account password as illustrated below - -A verification email is sent when a new account is created or if the user requests it in the “My Account” tab. - -![](images/2022-05-19-00-00-05.png) - -The password recovery flow when “Reset Account” is triggered at the login page. - -![](images/2022-05-19-00-00-18.png) - -Both account verification and password recovery are triggered automatically once SMTP mail server configuration is included into the config.json file. - -#### SMTP: User/Pass -##### Normal Server - -Update the config.json with “smtp” section as shown below and restart the server. - -```json -{ - "smtp": { - "host": "smtp.server.com", - "port": 25, - "from": "myaddress@server.com", - "user": "myaddress@server.com", # Optional - "pass": "mypassword", # Optional - "tls": false # Optional, default false - } -} -``` - -Please map the host, port values to connect to the right host that provides this SMTP service. For “from” value, administrators may put something like donotreply@server.com, but often times it needs to be a valid address since SMTP server will not send out messages with an invalid reply address. - -Some SMTP servers will require a valid username and password to login to the mail server. This is to prevent unauthorized e-mail correspondence. TLS option can be set to ‘true’ if the SMTP server requires TLS. - -##### Gmail - -One option is to configure MeshCentral work with Google Gmail by setting “host” with smtp.gmail.com, and “port” with 587. In the config.json file, use user’s Gmail address for both “from” and “user” and Gmail password in the “pass” value. You will also need to enable “Less secure app access” in for this Google account. It’s in the account settings, security section: - -![](images/2022-05-19-00-01-19.png) - -If a Google account is setup with 2-factor authentication, the option to allow less secure applications not be available. Because the Google account password is in the MeshCentral config.json file and that strong authentication can’t be used, it’s preferable to use a dedicated Google account for MeshCentral email. - -#### SMTP: OAuth Authentication -##### Gmail - -Google has announced that less secure app access will be phased out. For Google Workspace or G-Suite accounts, the following process can be used to allow OAuth2 based authentication with Google's SMTP server. It is likely a very similar process for regular Gmail accounts. - -Start by visiting the Google API console: - -https://console.developers.google.com/ - -First, you will create a new project. Name it something unique in case you need to create more in the future. In this example, I've named the project "MeshCentral" - -![](images/gc-newproject.png) - -Click on the "OAuth Consent Screen" link, Under "APIs and Services" from the left hand menu: - -![](images/gc-oauthconsent.png) - -If you have a Google Workspace account, you will have the option to choose "Internal" application and skip the next steps. If not, you will be required to provide Google with information about why you want access, as well as verifying domain ownership. - -![](images/OAuth-Internal-External.png) - -Add the Gmail address under which you have created this project to the fields labelled ‘User support email’ and ‘Developer contact information’ so that you will be allowed for authentication. After that, you will want to add a scope for your app, so that your token is valid for gmail: - -![](images/gc-oauthscopes.png) - -Once this is complete, the next step will be to add credentials. - -![](images/gc-oauthcredentials.png) - -Choose OAuth Client - -You will obtain a Client ID and a Client secret once you've completed the process. Be sure to store the secret immediately, as you won't be able to retreive it after you've dismissed the window. - -Next, you will need to visit the Google OAuth Playground: - -https://developers.google.com/oauthplayground - -![](images/gc-playground.webp) - -Enter your Client ID and secret from the last step. On the left side of the page, you should now see a text box that allows you to add your own scopes. Enter https://mail.google.com and click Authorize API. - -You will need to follow the instructions provided to finish the authorization process. Once that is complete, you should receive a refresh token. The refresh token, Client ID and Client Secret are the final items we need to complete the SMTP section of our config.json. It should now look something like this: - -``` -"smtp": { - "host": "smtp.gmail.com", - "port": 587, - "from": "my@googleaccount.com", - "auth": { - "clientId": "", - "clientSecret": "", - "refreshToken": "" - }, - "user": "noreply@authorizedgooglealias.com", - "emailDelaySeconds": 10, - "tls": false, - "verifyEmail": true - } -``` - - -Regardless of what SMTP account is used, MeshCentral will perform a test connection to make sure the server if working as expected when starting. Hence, the user will be notified if Meshcentral and SMTP server has been configured correctly as shown below. - -![](images/2022-05-19-00-01-43.png) - -After successfully configuring the Gmail SMTP server, switch the OAuth 'Publishing Status' from `Testing` to `In Production`. This step prevents the need for frequent refresh token generation. Verification of your project isn't required to make this change. - -![](images/In-production.png) - - ## Database A critical component of MeshCentral is the database. The database stores all of the user account information, groups and node data, historical power and event, etc. By default MeshCentral uses NeDB (https://github.com/louischatriot/nedb) that is written entirely in NodeJS and is setup automatically when MeshCentral is installed with the npm tool. The file “meshcentral.db” will be created in the “meshcentral-data” folder when MeshCentral is first launched. This database works well for small deployments scenarios. @@ -552,14 +442,14 @@ To make this happen, we will be using the following command line options from Me | --dblistconfigfiles | List the names and size of all configuration files in the database. | | --dbshowconfigfile (filename) | Show the content of a specified filename from the database. --configkey is required. | | --dbdeleteconfigfiles | Delete all configuration files from the database. | -| --dbpushconfigfiles '*' or (folder path) | Push a set of configuration files into the database, removing any existing files in the process. When * is specified, the “meshcentral-data” folder up pushed into the database. --configkey is required. | +| --dbpushconfigfiles (*) or (folder path) | Push a set of configuration files into the database, removing any existing files in the process. When * is specified, the “meshcentral-data” folder up pushed into the database. --configkey is required. | | --dbpullconfigfiles (folder path) | Get all of the configuration files from the database and place them in the specified folder. Files in the target folder may be overwritten. --configkey is required. | | --loadconfigfromdb (key) | Runs MeshCentral server using the configuration files found in the database. The configkey may be specified with this command or --configkey can be used. | Once we have MeshCentral running as expected using the “meshcentral-data” folder, we can simply push that configuration into the database and run using the database alone like this: ``` -node ./node_modules/meshcentral --dbpushconfigfiles '*' --configkey mypassword +node ./node_modules/meshcentral --dbpushconfigfiles * --configkey mypassword node ./node_modules/meshcentral --loadconfigfromdb mypassword --mongodb "mongodb://127.0.0.1:27017/meshcentral" ``` @@ -687,42 +577,46 @@ IP addresses are separated by a comma. As a result, only users coming these IP a **Note**: When IP address whitelist is effective, Mesh Agent connection from any IP address will be not affected. -You can also use files for IP lists +## Email Setup + +We highly recommend the use of an email server (SMTP) because we could allow MeshCentral to verify user account’s email address by sending a confirmation request to the user to complete the account registration and for password recovery, should a user forget account password as illustrated below + +A verification email is sent when a new account is created or if the user requests it in the “My Account” tab. + +![](images/2022-05-19-00-00-05.png) + +The password recovery flow when “Reset Account” is triggered at the login page. + +![](images/2022-05-19-00-00-18.png) + +Both account verification and password recovery are triggered automatically once SMTP mail server configuration is included into the config.json file. Update the config.json with “smtp” section as shown below and restart the server. ```json -"userAllowedIp": "file:userallowedips.txt", -"userBlockedIp": "file:userblockedips.txt", -"agentAllowedIp": "file:agentallowedips.txt" +{ + "smtp": { + "host": "smtp.server.com", + "port": 25, + "from": "myaddress@server.com", + "user": "myaddress@server.com",  Optional + "pass": "mypassword",  Optional + "tls": false  Optional, default false + } +} ``` -Place the file in the `meshcentral-data` folder. +Please map the host, port values to connect to the right host that provides this SMTP service. For “from” value, administrators may put something like donotreply@server.com, but often times it needs to be a valid address since SMTP server will not send out messages with an invalid reply address. -All the lines that start with a number or `:` will be used, everything else is ignored. So, you can put comments anyway you like, but probably best to start then with a `#` or something to make it clear. +Some SMTP servers will require a valid username and password to login to the mail server. This is to prevent unauthorized e-mail correspondence. TLS option can be set to ‘true’ if the SMTP server requires TLS. -```txt -# My list of blocked IP's -185.101.70.0/24 -185.46.85.0/24 -37.9.44.0/24 -37.9.45.0/24 -5.189.205.0/24 -5.189.206.0/24 -5.189.207.0/24 -5.62.153.0/24 -5.62.156.0/24 -5.62.158.0/24 +One option is to configure MeshCentral work with Google Gmail* by setting “host” with smtp.gmail.com, and “port” with 587. In the config.json file, use user’s Gmail* address for both “from” and “user” and Gmail* password in the “pass” value. You will also need to enable “Less secure app access” in for this Google account. It’s in the account settings, security section: -# One more list -5.8.44.0/24 -5.8.45.0/24 -5.8.46.0/24 -79.110.28.0/24 -79.110.31.0/24 -91.204.14.0/24 -95.181.218.0/24 -95.85.81.0/24 -``` +![](images/2022-05-19-00-01-19.png) +If a Google account is setup with 2-factor authentication, the option to allow less secure applications not be available. Because the Google account password is in the MeshCentral config.json file and that strong authentication can’t be used, it’s preferable to use a dedicated Google account for MeshCentral email. + +Regardless of what SMTP account is used, MeshCentral will perform a test connection to make sure the server if working as expected when starting. Hence, the user will be notified if Meshcentral and SMTP server has been configured correctly as shown below. + +![](images/2022-05-19-00-01-43.png) ## Embedding MeshCentral @@ -798,7 +692,7 @@ Only the remote desktop viewer will be displayed embedded within an iframe. ## Server port aliasing -In some cases, you may be setting up a server on a private network that uses non-standard ports, but use a router or firewall in front to perform port mapping. So, even if the server privately uses non-standard ports, the public ports are the standard ports 80 and 443. You have to tell MeshCentral to bind to private ports but pretend it’s using the other standard ports when communicating publicly. To make this work, MeshCentral supports port aliasing. +In some cases, you may be setting up a server on a private network that uses non-standard ports, but use a router or firewall in front to perform port mapping. So, even if the server privately uses non-standard ports, the public ports are the standard ports 80 and 443. You have to tell MeshCentral to bind to private ports but pretend it’s using the other standard ports when communicating publically. To make this work, MeshCentral supports port aliasing. For example you can run: @@ -840,16 +734,6 @@ Server2:443 -> 4433 on MeshCentral The routing of IP and ports by the firewall shown on the picture must be configured separately from MeshCentral using separate software. Typically, routers or firewalls have the proper controls to configure this type of traffic routes. -## Web relay using DNS names and multiple web relays - -MeshCentral has a web relay feature that allows a user to access remote web sites thru the MeshCentral server without having to install MeshCentral Router. Web relay also allow you to use an alternate DNS name instead of a different web relay port which has a few advantages. You can also use multiple alternate DNS names which can be used at the same time to provide users with many HTTP/HTTPS relays. -## Video Walkthrus - -
- - -
- ## Device Groups with Relay Agent MeshCentral supports the local device group allowing devices that do not have an agent to be managed thru MeshCentral with regular SSH, SFTP, RDP, VNC protocols. Until now, the MeshCentral server had to be in LAN or Hybrid modes to support his device group and the managed devices had to be on the same network as the MeshCentral server. Starting with v1.0.11, users can create a local device group specifying a MeshAgent as a relay. This makes it possible to manage agent-less devices from anywhere on the Internet even if the server is in WAN mode. Simply install a single device with a MeshAgent on a network and create a local device group with that device as the relay. @@ -901,12 +785,6 @@ In this example, we will: - MeshCentral will read the NGINX web certificate so agents will perform correct server authentication. - NGINX will be setup with long timeouts, because agents have long standard web socket connections. -!!!note - With SELinux, NGINX reverse proxy requires 'setsebool -P httpd_can_network_relay 1' - Caution: httpd_can_network_relay only allows certain ports - Confirm you are using ports from this subset in MeshCentral - If you want to use a different port then you will need to add it to http_port_t - Let’s get started by configuring MeshCentral with the following values in config.json: ```json @@ -1094,7 +972,8 @@ First we will start with the MeshCentral configuration, here is a minimal config }, "domains": { "": { - "certUrl": "https://127.0.0.1:443/" + "certUrl": "https://127.0.0.1:443/", + "agentConfig": [ "webSocketMaskOverride=1" ], } } } @@ -1266,19 +1145,57 @@ To get this features setup, users will need to go to the “My Account” tab or Note that if a user performs a password recovery using email, the 2-step authentication is then turned off and will need to be turned on again. This is not idea as someone being able to intercept the user’s email could still log into the web site. Users should make sure to properly protect their email account. -Another form of MFA or Multi-factor Authentication is hardware based OTP (One Time Password) solution providing 2FA or Two-factor authentication. Yubikey is fully supported in MeshCentral. +## Branding & Terms of use -
- -
+Once MeshCentral is setup, you may want to customize the web site with your own brand and terms of use. This is important to personalize the web site to your organization. We also want to customize the web site in such a way that updating to the latest version will keep the branding as-is. -And taking authentication to the next step is removing the login page entirely. Use LoginKey 3FA with MeshCentral. +### Branding -
- -
+You can put you own logo on the top of the web page. To get started, get the file “logoback.png” from the folder “node_modules/meshcentral/public/images” and copy it to your “meshcentral-data” folder. In this example, we will change the name of the file “logoback.png” to “title-mycompagny.png”. Then use any image editor to change the image and place your logo. -You can also setup [Duo 2FA](https://github.com/Ylianst/MeshCentral/blob/master/docs/docs/meshcentral/security.md#duo-2fa-setup) which is a commertial offering. +![](images/2022-05-19-00-38-51.png) + +Once done, edit the config.json file and set the following values: + +```json +"domains": { + "": { + "Title": "", + "Title2": "", + "TitlePicture": "title-sample.png", + }, +``` + +This will set the title and sub-title text to empty and set the background image to the new title picture file. You can now restart the serve and take a look at the web page. Both the desktop and mobile sites will change. + +![](images/2022-05-19-00-39-35.png) + +![](images/2022-05-19-00-39-42.png) + +The title image must a PNG image of size 450 x 66. + +You can also customize the server icon in the “My Server” tab. By default, it’s a picture of a desktop with a padlock. + +![](images/2022-05-19-00-40-00.png) + +If, for example, MeshCentral is running on a Raspberry Pi. You may want to put a different picture at this location. Just put a “server.jpg” file that is 200 x 200 pixels in the “meshcentral-data” folder. The time MeshCentral page is loaded, you will see the new image. + +![](images/2022-05-19-00-40-13.png) + +This is great to personalize the look of the server within the web site. + +### Terms of use + +You can change the terms of use of the web site by adding a “terms.txt” file in the “meshcentral-data” folder. The file can include HTML markup. Once set, the server does not need to be restarted, the updated terms.txt file will get used the next time it’s requested. + +For example, placing this in “terms.txt” + +``` +
+This is a test file. +``` + +Will show this on the terms of use web page. ## Server Backup & Restore @@ -1312,9 +1229,6 @@ mongorestore --archive=backup.archive This will re-import the database from the backup. You can then start MeshCentral again. -!!!note - The two values for `backup` and `restore` in the json are only valid for databases backed by NeDB - ### Backup to Google Drive ```bash @@ -1474,17 +1388,6 @@ As with any web application deployed in organization, it’s convenient and more Before you get started, your MeshCentral server must be publicly facing on the internet and have a valid TLS certificate. For example, by setting up Let’s Encrypt. After the web site is working correctly user the steps below. - -### LDAP - -
- -
- -You can integrate LDAP using [these](https://github.com/Ylianst/MeshCentral/blob/f05eb9a198bed249c2b1a969ce17a41404ef70a6/meshcentral-config-schema.json#L505-L513) configuration options - -![](images/ldap_integration.png) - ### Twitter Authentication Like many other services, Twitter allows its users to login to other web site using Twitter credentials using OAuth2. Start by creating an account on Twitter and logging in. Then navigate to , this is where you can create new applications that are compatible with Twitter. @@ -1733,41 +1636,6 @@ The callback URL will be of the form “https://(servername)/auth-saml-callback Enabling SAML will require MeshCentral to install extra modules from NPM, so depending on your server configuration, you may need to run MeshCentral once manually. -!!!note - MeshCentral only supports "POST". [For example Authentik's](https://github.com/Ylianst/MeshCentral/issues/4725) default setting is to use "Redirect" as a "Service Provider Binding". - -### Generic OpenID Connect Setup - -Generally, if you are using an IdP that supports OpenID Connect (OIDC), you can use a very basic configuration to get started, and if needed, add more specific or advanced configurations later. Here is what your config file will look like with a basic, generic, configuration. - -``` json -{ - "settings": { - "cert": "mesh.your.domain", - "port": 443, - "sqlite3": true - }, - "domains": { - "": { - "title": "Mesh", - "title2": ".Your.Domain", - "authStrategies": { - "oidc": { - "issuer": "https://sso.your.domain", - "clientid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", - "clientsecret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "newAccounts": true - } - } - } - } -} -``` - -As you can see, this is roughly the same as all the other OAuth2 based authentication strategies. These are the basics you need to get started using OpenID Connect because it's still authenticating with OAuth2. If you plan to take advantage of some of the more advanced features provided by this strategy you should consider reading the [additional strategy documentation](./openidConnectStrategy.md). - -> NOTE: MeshCentral will use `https://mesh.your.domain/auth-oidc-callback` as the default redirect uri. - ## Improvements to MeshCentral In 2007, the first version of MeshCentral was built. We will refer to it as “MeshCentral1”. When MeshCentral1 was designed, HTML5 did not exist and web sockets where not implemented in any of the major browsers. Many design decisions were made at the time that are no longer optimal today. With the advent of the latest MeshCentral, MeshCentral1 is no longer supported and MeshCentral v2 has been significantly redesigned and mostly re-written based of previous version. Here is a list of improvements made in MeshCentral when compared with MeshCentral1: @@ -1776,10 +1644,10 @@ In 2007, the first version of MeshCentral was built. We will refer to it as “M - Cross-Platform Support – Contrary to MeshCentral1 that only runs on Windows*, MeshCentral can run on any environment that supports NodeJS. This includes Windows*, Linux* and OSX*. Because MeshCentral runs on Linux, it often lowers hosting costs and makes it possible to run MeshCentral in a Docker* container environment. - Runs with Little Compute Resources – Typical MeshCentral1 installation requires a large disk space foot print (approx* 30G of disk space) and is compute intensive even for small deployments. MeshCentral requires little resources to host (70MB) and able to deliver reasonable performance on a 900Mhz CPU with 1GB RAM. - Multi-Tenancy and Load Balancing Support – MeshCentral can handle hosting many server instances at once. Each instance or “domain” has it’s own administrators, users and computers to manage. The server can handle each instance using a url path “server.com/customer1” or a DNS name “customer1.server.com”. Many customers can be handled by having all the DNS names point to the same server IP address. MeshCentral will take care of serving the right TLS certificate for each connection. -- Single Executable – MeshCentral is a single-module or single executable server. All of the components of MeshCentral1 including IIS, Swarm, AJAX, Social, Manageability Servers are all build into one single executable. This makes it super easy to setup and run, it also minimizes problems and overhead caused by having many components communicate to each other. When the server is updated, all of the components are updated at once and effective. +- Single Executable – MeshCentral is a single-module or single executable server. All of the components of MeshCentral1 including IIS, Swarm, AJAX, Social, Manageability Servers are all build into one single executable. This makes it super easy to setup and run, it also minimises problems and overhead caused by having many components communicate to each other. When the server is updated, all of the components are updated at once and effective. - Web Application Design – MeshCentral1 has 100’s of web pages and often times a click on a web page causes the browser to load a different web page and this creates more load on the server. With MeshCentral there are only two main web pages: The login page and the main web application. This design is much more responsive since the server now delegates most of the UI workload to the client’s web browser. - Real-Time User Interface – In MeshCentral, the user never has to hit the “refresh” button to update the web page. The web interface is completely real-time and updates as things change. MeshCentral uses websockets to connect to the server and get real-time events. -- Single Programming Language – MeshCentral1 used JavaScript on the browser, C# on the server and C for the agent. Use of 3 different programming languages means that developers wanting to implement a new use-case needs to have sufficient skills to change between these 3 languages during the coding session. Makes the code significantly more difficult to understand and maintain. +- Single Programming Language – MeshCentral1 used JavaScript on the brower, C# on the server and C for the agent. Use of 3 different programming languages means that developers wanting to implement a new use-case needs to have sufficient skills to change between these 3 languages during the coding session. Makes the code significantly more difficult to understand and maintain. - Support for LAN only Mode – MeshCentral is capable of being setup as “LAN only” mode. In fact, this is the default mode when no static name or IP address is provided. In this mode, MeshAgents perform a multicast search on the network for the server making a static DNS/IP unnecessary. - Support for TLS Offloaders – TLS offloaders are now fully supported. This means that MeshCentral can handle way more network connections and traffic significantly. - Support for CIRA User/Pass Login – MeshCentral now supports both Intel AMT CIRA user/pass login and certificate login. Compared to MeshCentral1 that only supported certificate login, user/pass login is easier to setup and it can also be used for TLS offloaders and CIRA authentication. @@ -1901,8 +1769,8 @@ This will run bash in interactive mode and work correctly. #### SSH and SFTP integration to the Terminal -MeshCentral has built-in web-based integration of SSH in the "Terminal" tab and SFTP in the "Files" tab. +MeshCentral has built-in web-based integration of SSH in the "Termina" tab and SFTP in the "Files" tab.
-
+ \ No newline at end of file diff --git a/docs/docs/meshcentral/openidConnectStrategy.md b/docs/docs/meshcentral/openidConnectStrategy.md deleted file mode 100644 index 4b6e4911..00000000 --- a/docs/docs/meshcentral/openidConnectStrategy.md +++ /dev/null @@ -1,671 +0,0 @@ -# Using the OpenID Connect Strategy on MeshCentral - -## Overview - -### Introduction - -There is a lot of information to go over, but first, why OpenID Connect? - -Esentially its because its both based on a industry standard authorization protocol, and is becoming an industry standard authentication protocol. Put simply it's reliable and reusable, and we use OpenID Connect for exactly those reasons, almost every everyone does, and we want to be able to integrate with almost anyone. This strategy allows us to expand the potential of MeshCentral through the potential of OpenID Connect. - -In this document, we will learn about the OpenID Connect specification at a high level, and then use that information to configure the OpenID Connect strategy for MeshCentral using a generic OpenID Connect compatible IdP. After that we will go over some advanced configurations and then continue by explaining how to use the new presets for popular IdPs, specifically Google or Azure. Then we will explore the configuration and usage of the groups feature. - -> ATTENTION: As of MeshCentral `v1.1.22` there are multiple config options being depreciated. Using any of the old configs will only generate a warning in the authlog and will not stop you from using this strategy at this time. If there is information found in both the new and old config locations the new config location will be used. We will go over the specifics later, now lets jump in. - -### Chart of Frequently Used Terms and Acronyms -| Term | AKA | Descriptions | -| --- | --- | --- | -| OAuth 2.0 | OAuth2 | OAuth 2.0 is the industry-standard protocol for user *authorization*. | -| OpenID Connect | OIDC | Identity layer built on top of OAuth2 for user *authentication*. | -| Identity Provider | IdP | The *service used* to provide authentication and authorization. | -| Preset Configs | Presets | Set of *pre-configured values* to allow some specific IdPs to connect correctly. | -| OAuth2 Scope | Scope | A flag *requesting access* to a specific resource or endpoint | -| OIDC Claim | Claim | A *returned property* in the user info provided by your IdP | -| User Authentication | AuthN | Checks if you *are who you say you are*. Example: Username and password authentication | -| User Authorization | AuthZ | Check if you have the *permissions* required to access a specific resource or endpoint | - -### OpenID Connect Technology Overview - -OpenID Connect is a simple identity layer built on top of the OAuth2 protocol. It allows Clients to verify the identity of the End-User based on the authentication performed by an “Authorization Server”, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner. - -OpenID Connect allows clients of all types, including Web-based, mobile, and JavaScript clients, to request and receive information about authenticated sessions and end-users. The specification suite is extensible, allowing participants to use optional features such as encryption of identity data, discovery of OpenID Providers, and logout, when it makes sense for them. - -That description was straight from [OpenID Connect Documentation](https://openid.net/connect/), but basically, OAuth2 is the foundation upon which OpenID Connect was built, allowing for wide ranging compatability and interconnection. OpenID Connect appends the secure user *authentication* OAuth2 is known for, with user *authorization* by allowing the request of additional *scopes* that provide additional *claims* or access to API's in an easily expandable way. - -### Annotations - -#### Own IDP, CA and Docker - -If you operate your own identity provider, your own certification authority and MeshCentral via Docker, it is necessary to provide the complete certificate chain, otherwise NodeJS (in particular the openid-client module) will refuse the connection to the IDP server. - -The following errors can be found in the log file: -> OIDC: Discovery failed. - -> UNABLE_TO_GET_ISSUER_CERT_LOCALLY - -To solve this problem, the certificate chain in PEM format must be placed in the data directory and the following entry must be added to the docker-compose.yml file in the “environment” section: -``` - environment: - - NODE_EXTRA_CA_CERTS=/opt/meshcentral/meshcentral-data/chain.pem -``` - -## Basic Config - -### *Introduction* - -Generally, if you are using an IdP that supports OIDC, you can use a very basic configuration to get started, and if needed, add more specific or advanced configurations later. Here is what your config file will look like with a basic, generic, configuration. - -### *Basic Config File Example* - -``` json -{ - "settings": { - "cert": "mesh.your.domain", - "port": 443, - "sqlite3": true - }, - "domains": { - "": { - "title": "MeshCentral", - "title2": "Your sub-title", - "authStrategies": { - "oidc": { - "issuer": "https://sso.your.domain", - "clientid": "2d5685c5-0f32-4c1f-9f09-c60e0dbc948a", - "clientsecret": "7PiGSLSLL4e7NGi67KM229tfK7Z7TqzQ", - "newAccounts": true - } - } - } - } -} -``` - -As you can see, this is roughly the same as all the other OAuth2 based authentication strategies. These are the basics you need to get started, however, if you plan to take advantage of some of the more advanced features provided by this strategy, you'll need to keep reading. - -In this most basic of setups, you only need the URL of the issuer, as well as a client ID and a client secret. Notice in this example that the callback URL (or client redirect uri) is not configured, thats because MeshCentral will use `https://mesh.your.domain/auth-oidc-callback` as the default. Once you've got your configuration saved, restart MeshCentral and you should see an OpenID Connect Single Sign-on button on the login screen. - -> WARNING: The redirect endpoint must EXACTLY match the value provided to your IdP or your will deny the connection. - -> ATTENTION: You are required to configure the cert property in the settings section for the default domain, and configure the dns property under each additional domain. - -## Advanced Options - -### Overview - -There are plenty of options at your disposal if you need them. In fact, you can configure any property that node-openid-client supports. The openid-client module supports far more customization than I know what to do with, if you want to know more check out [node-openid-client on GitHub](https://github.com/panva/node-openid-client) for expert level configuration details. There are plenty of things you can configure with this strategy and there is a lot of decumentation behind the tools used to make this all happen. I strongly recommend you explore the [config schema](https://github.com/Ylianst/MeshCentral/blob/master/meshcentral-config-schema.json), and if you have a complicated config maybe check out the [openid-client readme](https://github.com/panva/node-openid-client/blob/main/docs/README.md). Theres a list of resources at the end if you want more information on any specific topics. In the meantime, let’s take a look at an example of what your config file could look with a slightly more complicated configuration, including multiple manually defined endpoints. - -#### *Advanced Config File Example* - -``` json -{ - "settings": { - "cert": "mesh.your.domain", - "port": 443, - "redirPort": 80, - "AgentPong": 300, - "TLSOffload": "192.168.1.50", - "SelfUpdate": false, - "AllowFraming": false, - "sqlite3": true, - "WebRTC": true - }, - "domains": { - "": { - "title": "Mesh", - "title2": ".Your.Domain", - "orphanAgentUser": "~oidc:e48f8ef3-a9cb-4c84-b6d1-fb7d294e963c", - "authStrategies": { - "oidc": { - "issuer": { - "issuer": "https://sso.your.domain", - "authorization_endpoint": "https://auth.your.domain/auth-endpoint", - "token_endpoint": "https://tokens.sso.your.domain/token-endpoint", - "end_session_endpoint": "https://sso.your.domain/logout", - "jwks_uri": "https://sso.your.domain/jwks-uri" - }, - "client": { - "client_id": "110d5612-0822-4449-a057-8a0dbe26eca5", - "client_secret": "4TqST46K53o3Z2Q88p39YwR6YwJb7Cka", - "redirect_uri": "https://mesh.your.domain/auth-oidc-callback", - "post_logout_redirect_uri": "https://mesh.your.domain/login", - "token_endpoint_auth_method": "client_secret_post", - "response_types": "authorization_code" - }, - "custom": { - "scope": [ "openid", "profile", "read.EmailAlias", "read.UserProfile" ], - "preset": null - }, - "groups": { - "recursive": true, - "required": ["Group1", "Group2"], - "siteadmin": ["GroupA", "GroupB"], - "revokeAdmin": true, - "sync": { - "filter": ["Group1", "GroupB", "OtherGroup"] - }, - "claim": "GroupClaim", - "scope": "read.GroupMemberships" - }, - "logouturl": "https://sso.your.domain/logout?r=https://mesh.your.domain/login", - "newAccounts": true - }, - {...} - } - } - } -} -``` - -### "Issuer" Options - -#### *Introduction* - -In the advanced example config above, did you notice that the issuer property has changed from a *string* to an *object* compared to the basic example? This not only allows for much a much smaller config footprint when advanced issuer options are not required, it successfully fools you in to a false sense of confidence early on in this document. If you are manually configuring the issuer endpoints, keep in mind that MeshCentral will still attempt to discover **ALL** issuer information. Obviously if you manually configure an endpoint, it will be used even if the discovered information is different from your config. - -> NOTE: If you are using a preset, you dont need to define an issuer. If you do, the predefined information will be ignored. - -#### *Common Config Chart* - -| Name | Description | Default | Example | Required | -| --- | --- | --- | --- | --- | -| `issuer` | The primary URI that represents your Identity Providers authentication endpoints. | N/A | `"issuer": "https://sso.your.domain"`
`"issuer": { "issuer": "https://sso.your.domain" }` | Unless using preset. | - -#### *Advanced Config Example* - -``` json -"issuer": { - "issuer": "https://sso.your.domain", - "authorization_endpoint": "https://auth.your.domain/auth-endpoint", - "token_endpoint": "https://tokens.sso.your.domain/token-endpoint", - "end_session_endpoint": "https://sso.your.domain/logout", - "jwks_uri": "https://sso.your.domain/jwks-uri" -}, -``` - -#### *Required and Commonly Used Configs* - -The `issuer` property in the `issuer` object is the only one required, and its only required if you aren't using a preset. Besides the issuer, these are mostly options related to the endpoints and their configuration. The schema below looks intimidating but it comes down to being able to support any IdP. Setting the issuer, and end_session_endpoint are the two main ones you want to setup. - -#### *Schema* - -``` json -"issuer": { - "type": ["string","object"], - "format": "uri", - "description": "Issuer options. Requires issuer URI (issuer.issuer) to discover missing information unless using preset", - "properties": { - "issuer": { "type": "string", "format": "uri", "description": "URI of the issuer." }, - "authorization_endpoint": { "type": "string", "format": "uri" }, - "token_endpoint": { "type": "string", "format": "uri" }, - "jwks_uri": { "type": "string", "format": "uri" }, - "userinfo_endpoint": { "type": "string", "format": "uri" }, - "revocation_endpoint": { "type": "string", "format": "uri" }, - "introspection_endpoint": { "type": "string", "format": "uri" }, - "end_session_endpoint": { - "type": "string", - "format": "uri", - "description": "URI to direct users to when logging out of MeshCentral.", - "default": "this.issuer/logout" - }, - "registration_endpoint": { "type": "string", "format": "uri" }, - "token_endpoint_auth_methods_supported": { "type": "string" }, - "token_endpoint_auth_signing_alg_values_supported": { "type": "string" }, - "introspection_endpoint_auth_methods_supported": { "type": "string" }, - "introspection_endpoint_auth_signing_alg_values_supported": { "type": "string" }, - "revocation_endpoint_auth_methods_supported": { "type": "string" }, - "revocation_endpoint_auth_signing_alg_values_supported": { "type": "string" }, - "request_object_signing_alg_values_supported": { "type": "string" }, - "mtls_endpoint_aliases": { - "type":"object", - "properties": { - "token_endpoint": { "type": "string", "format": "uri" }, - "userinfo_endpoint": { "type": "string", "format": "uri" }, - "revocation_endpoint": { "type": "string", "format": "uri" }, - "introspection_endpoint": { "type": "string", "format": "uri" } - } - } - }, - "additionalProperties": false -}, -``` - -### "Client" Options - -#### *Introduction* - -There are just about as many option as possible here since openid-client also provides a Client class, because of this you are able to manually configure the client how ever you need. This includes setting your redirect URI to any available path, for example, if I was using the "google" preset and wanted to have Google redirect me back to "https://mesh.your.domain/oauth2/oidc/redirect/givemebackgooglemusicyoujerks", MeshCentral will now fully support you in that. One of the other options is the post logout redirect URI, and it is exactly what it sounds like. After MeshCentral logs out a user using the IdPs end session endpoint, it send the post logout redirect URI to your IdP to forward the user back to MeshCentral or to an valid URI such as a homepage. - -> NOTE: The client object is required, however an exception would be with using old configs, which will be discussed later. - -#### *Common Configs* - -| Name | Description | Default | Example | Required | -| --- | --- | --- | --- | --- | -| `client_id` | The client ID provided by your Identity Provider (IdP) | N/A | `bdd6aa4b-d2a2-4ceb-96d3-b3e23cd17678` | `true` | -| `client_secret` | The client secret provided by your Identity Provider (IdP) | N/A | `vUg82LJ322rp2bvdzuVRh3dPn3oVo29m` | `true` | -| `redirect_uri` | "URI your IdP sends you after successful authorization. | `https://mesh.your.domain/auth-oidc-callback` | `https://mesh.your.domain/oauth2/oidc/redirect` | `false` | -| `post_logout_redirect_uri` | URI for your IdP to send you after logging out of IdP via MeshCentral. | `https://mesh.your.domain/login` | `https://site.your.other.domain/login` | `false` | - -#### *Advanced Config Example* - -``` json -"client": { - "client_id": "00b3875c-8d82-4238-a8ef-25303fa7f9f2", - "client_secret": "7PP453H577xbFDCqG8nYEJg8M3u8GT8F", - "redirect_uri": "https://mesh.your.domain/auth-oidc-callback", - "post_logout_redirect_uri": "https://mesh.your.domain/login", - "token_endpoint_auth_method": "client_secret_post", - "response_types": "authorization_code" -}, -``` - -#### *Required and Commonly Used Configs* - -There are many available options you can configure but most of them go unused. Although there are a few *commonly used* properties. The first two properties, `client_id` and `client_secret` are required. The next one `redirect_uri` is used to setup a custom URI for the redirect back to MeshCentral after being authenicated by your IdP. The `post_logout_redirect_uri` property is used to tell your IdP where to send you after being logged out. These work in conjunction with the issuers `end_session_url` to automatically fill in any blanks in the config. - -#### *Schema* -``` json -"client": { - "type": "object", - "description": "OIDC Client Options", - "properties": { - "client_id": { - "type": "string", - "description": "REQUIRED: The client ID provided by your Identity Provider (IdP)" - }, - "client_secret": { - "type": "string", - "description": "REQUIRED: The client secret provided by your Identity Provider (IdP)" - }, - "redirect_uri": { - "type": "string", - "format": "uri", - "description": "URI your IdP sends you after successful authorization. This must match what is listed with your IdP. (Default is https://[currentHost][currentPath]/auth-oidc-callback)" - }, - "post_logout_redirect_uri": { - "type": "string", - "format": "uri", - "description": "URI for your IdP to send you after logging out of IdP via MeshCentral.", - "default": "https:[currentHost][currentPath]/login" - }, - "id_token_signed_response_alg": { "type": "string", "default": "RS256" }, - "id_token_encrypted_response_alg": { "type": "string" }, - "id_token_encrypted_response_enc": { "type": "string" }, - "userinfo_signed_response_alg": { "type": "string" }, - "userinfo_encrypted_response_alg": { "type": "string" }, - "userinfo_encrypted_response_enc": { "type": "string" }, - "response_types": { "type": ["string", "array"], "default": ["code"] }, - "default_max_age": { "type": "number" }, - "require_auth_time": { "type": "boolean", "default": false }, - "request_object_signing_alg": { "type": "string" }, - "request_object_encryption_alg": { "type": "string" }, - "request_object_encryption_enc": { "type": "string" }, - "token_endpoint_auth_method": { - "type": "string", - "default": "client_secret_basic", - "enum": [ "none", "client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt" ] - }, - "introspection_endpoint_auth_method": { - "type": "string", - "default": "client_secret_basic", - "enum": [ "none", "client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt" ] - }, - "revocation_endpoint_auth_method": { - "type": "string", - "default": "client_secret_basic", - "enum": [ "none", "client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt" ] - }, - "token_endpoint_auth_signing_alg": { "type": "string" }, - "introspection_endpoint_auth_signing_alg": { "type": "string" }, - "revocation_endpoint_auth_signing_alg": { "type": "string" }, - "tls_client_certificate_bound_access_tokens": { "type": "boolean" } - }, - "required": [ "client_id", "client_secret" ], - "additionalProperties": false -}, -``` - -### "Custom" Options - -#### *Introduction* - -These are all the options that dont fit with the issuer or client, including the presets. The presets define more than just the issuer URL used in discovery, they also define API endpoints, and specific ways to assemble your data. You are able to manually override most of the effects of the preset, but not all. You are able to manually configure the *scope* of the authorization request though, as well as choose which claims to use if your IdP uses something other than the defaults. - -> NOTE: The scope must be a string, an array of strings, or a space separated list of scopes as a single string. - -#### *Common Config Chart* - -| Name | Description | Default | Example | Required | -| -------- | ------------------------------------------------ | --------------------------------------------------------- | ----------------------------------- | -------- | -| `scope` | A list of scopes to request from the issuer. | `"openid profile email"` | `["openid", "profile"]` | `false` | -| `claims` | A group of claims to use instead of the defaults | Defauts to name of property except that `uuid` used `sub` | `"claims": {"uuid": "unique_name"}` | `false` | - -#### *Advanced Config Example* - -``` json -"custom": { - "scope": [ "openid", "profile", "read.EmailAlias", "read.UserProfile" ], - "preset": null, - "claims": { - "name": "nameOfUser", - "email": "publicEmail" - } -}, -``` - -> NOTE: You can `preset` to null if you want to explicitly disable presets. - -#### *Required and Commonly Used Configs* - -As should be apparent by the name alone, the custom property does not need to be configured and is used for optional or advanced configurations. With that said, lets look at few common options strategy will default to using the `openid`, `profile`, and `email` scopes to gather the required information about the user, if your IdP doesn't support or require all these, you can set up the scope manually. Combine that with the ability to set the group scope and you can end up with an entirely custom scope being sent to your IdP. Not to mention the claims property, which allows you to pick and choose what claims to use to gather your data in case you have issues with any of the default behaviors of OpenID Connect and your IdP. This is also where you would set the preset and any values required by the presets. - -#### *Schema* -``` json -"custom": { - "type": "object", - "properties": { - "scope": { - "type": ["string", "array"], - "description": "A list of scopes to request from the issuer.", - "default": "openid profile email", - "examples": ["openid", ["openid", "profile"], "openid profile email", "openid profile email groups"] - }, - "claims": { - "type": "object", - "properties": { - "email": { "type": "string" }, - "name": { "type": "string" }, - "uuid": { "type": "string" } - } - }, - "preset": { "type": "string", "enum": ["azure", "google"]}, - "tenant_id": { "type": "string", "description": "REQUIRED FOR AZURE PRESET: Tenantid for Azure"}, - "customer_id": { "type": "string", "description": "REQUIRED FOR GOOGLE PRESET IF USING GROUPS: Customer ID from Google, should start with 'C'."} - }, - "additionalProperties": false -}, -``` - -### "Groups" Options - -#### *Introduction* - -The groups option allows you to use the groups you already have with your IdP in MeshCentral in a few ways. First you can set a group that the authorized user must be in to sign in to MeshCentral. You can also allow users with the right memberships automatic admin privlidges, and there is even an option to revoke privlidges if the user is NOT in the admin group. Besides these filters, you can filter the sync property to mirror only certain groups as MeshCentral User Groups, dynamically created as the user logs in. You can of course simply enable sync and mirror all groups from your IdP as User Groups. Additionally you can define the scope and claim of the groups for a custom setup, again allowing for a wide range of IdPs to be used, even without a preset. - -#### *Common Config Chart* - -| Name | Description | Default | Example | Required | -| --- | --- | --- | --- | --- | -| `sync` | Allows you to mirror user groups from your IdP. | `false` | `"sync": { "filter": ["Group1", "Group2"] }`
`"sync": true` | `false` | -| `required` | Access is only granted to users who are a member
of at least one of the listed required groups. | `undefined` | `"required": ["Group1", "Group2"]` | `false` | -| `siteadmin` | Full site admin priviledges will be granted to users
who are a member of at least one of the listed admin groups | `undefined` | `"siteadmin": ["Group1", "Group2"]` | `false` | -| `revokeAdmin` | If true, admin privileges will be revoked from users
who arent a member of at least one of the listed admin groups. | `true` | `"revokeAdmin": false` | `false` | - -#### *Advanced Config Example* - -``` json -"groups": { - "recursive": true, - "required": ["Group1", "Group2"], - "siteadmin": ["GroupA", "GroupB"], - "revokeAdmin": false, - "sync": { - "filter": ["Group1", "GroupB", "OtherGroup"] - }, - "claim": "GroupClaim", - "scope": "read.GroupMemberships" -}, -``` - -#### *Required and Commonly Used Configs* - -As you can see in the schema below, there aren't any required properties in the groups object, however there are some commonly used ones. The first, and maybe most commonly used one, is the sync property. The sync property mirrors IdP provided groups into MeshCentral as user groups. You can then configure access as required to those groups, and as users log in, they will be added to the now existing groups if they are a member. You also have other options like using a custom *scope* or *claim* to get your IdP communicating with MeshCentral properly, without the use of preset configs. You also can set the required property if you need to limit authorization to users that are a member of at least one of the groups you set. or the siteadmin property to grant admin privilege, with the revokeAdmin property available to allow revoking admin rights also. - -#### *Schema* - -``` json -"groups": { - "type": "object", - "properties": { - "recursive": { - "type": "boolean", - "default": false, - "description": "When true, the group memberships will be scanned recursively." - }, - "required": { - "type": [ "string", "array" ], - "description": "Access is only granted to users who are a member of at least one of the listed required groups." - }, - "siteadmin": { - "type": [ "string", "array" ], - "description": "Full site admin priviledges will be granted to users who are a member of at least one of the listed admin groups." - }, - "revokeAdmin": { - "type": "boolean", - "default": false, - "description": "If true, admin privileges will be revoked from users who are NOT a member of at least one of the listed admin groups." - }, - "sync": { - "type": [ "boolean", "object" ], - "default": false, - "description": "If true, all groups found during user login are mirrored into MeshCentral user groups.", - "properties": { - "filter": { - "type": [ "string", "array" ], - "description": "Only groups listed here are mirrored into MeshCentral user groups." - } - } - }, - "scope": { "type": "string", "default": "groups", "description": "Custom scope to use." }, - "claim": { "type": "string", "default": "groups", "description": "Custom claim to use." } - }, - "additionalProperties": false -} -``` - -## Preset OpenID Connect Configurations - -### Overview - -#### *Introduction* - -Google is a blah and is used by tons of blahs as its so great. Lets move on. - -#### *Common Config Chart* - -> NOTE: All settings directly related to presets are in the custom section of the config. - -| Name | Description | Example | Required | -| --- | --- | --- | --- | -| `preset` | Manually enable the use of a preset. | `"preset": "google"`
`"preset": "azure"` | `false` | -| `customer_id` | Customer ID of the Google Workspaces instace you
plan to use with the groups feature.| `"customer_id": ["Group1", "Group2"]` | If `google` preset is used with `groups` feature | -| `tenant_id` | Tenant ID from Azure AD, this is required to use
the `azure` preset as it is part of the issuer url. | `"siteadmin": ["Group1", "Group2"]` | `false` | - -### Google Preset - -#### *Prerequisites* - -> Check out this [documentation](https://developers.google.com/identity/protocols/oauth2/openid-connect) to get ready before we start. - -#### *Basic Config Example* - -``` json -"oidc": { - "client": { - "client_id": "268438852161-r8xa7qxwf3rr0shp1xnpgmm70bnag21p.apps.googleusercontent.com", - "client_secret": "ETFWBX-gFEaxfPXs1tWmAOkuWDFTgoL3nwh" - } -} -``` - -#### *Specifics* - -If you notice above I forgot to add any preset related configs, however because google tags the client ID we can detect that and automatically use the google preset. The above config is tested, the sentive data has been scrambled of course. That said, you would normally use this preset in more advaced setups, let take a look at an example. - -#### *Advanced Example with Groups* - -``` json -"oidc": { - "client": { - "client_id": "424555768625-k7ub3ovqs0yp7mfo0usvyyx51nfii61c.apps.googleusercontent.com", - "client_secret": "QLBCQY-nRYmjnFWv3nKyHGmwQEGLokP6ldk" - }, - "custom": { - "preset": "google", - "customer_id": "C46kyhmps" - }, - "groups": { - "siteadmin": ["GroupA", "GroupB"], - "revokeAdmin": true, - "sync": true - }, - "callbackURL": "https://mesh.your.domain/auth-oidc-google-callback" -}, -``` - -#### *Customer ID and Groups* - -As always, the client ID and secret are required, the customer ID on the other hand is only required if you plan to take advantage of the groups function *and* the google preset. This also requires you have a customer ID, if you have do, it is available in the Google Workspace Admin Console under Profile->View. Groups work the same as they would with any other IdP but they are pulled from the Workspace groups. - -#### *Schema* - -```json -"custom": { - "type": "object", - "properties": { - "preset": { "type": "string", "enum": ["azure", "google"]}, - "customer_id": { "type": "string", "description": "Customer ID from Google, should start with 'C'."} - }, - "additionalProperties": false -}, -``` - -### Azure Preset - -#### *Prerequisites* - -To configure OIDC-based SSO, you need an Azure account with an active subscription. [Create an account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) for free. The account used for setup must be of the following roles: Global Administrator, Cloud Application Administrator, Application Administrator, or owner the service principal. - -> Check this [documentation](https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/add-application-portal-setup-oidc-sso) for more information. - -#### *Basic Config Example* - -``` json -"oidc": { - "client": { - "client_id": "a1gkl04i-40g8-2h74-6v41-2jm2o2x0x27r", - "client_secret": "AxT6U5K4QtcyS6gF48gndL7Ys22BL15BWJImuq1O" - }, - "custom": { - "preset": "azure", - "tenant_id": "46a6022g-4h33-1451-h1rc-08102ga3b5e4" - } -} -``` - -#### *Specifics* - -As with all other types of configuration for the OIDC strategy, the Azure preset requires a client ID and secret.The tenant ID is used as part of the issuer URI to make even the most basic AuthN requests so it is also required for the azure preset. besides that groups are available to the Azure preset as well as the recursive feature of groups. This allows you to search user groups recursively for groups they have membership in through other groups. - -> NOTE: The Azure AD preset uses the Tenant ID as part of the issuer URI:
`"https://login.microsoftonline.com/"` + `strategy`.custom.tenant_id + `"/v2.0"` - -#### *Advanced Example with Groups* - -``` json -"oidc": { - "client": { - "client_id": "a1gkl04i-40g8-2h74-6v41-2jm2o2x0x27r", - "client_secret": "AxT6U5K4QtcyS6gF48gndL7Ys22BL15BWJImuq1O" - }, - "custom": { - "preset": "azure", - "tenant_id": "46a6022g-4h33-1451-h1rc-08102ga3b5e4" - }, - "groups": { - "recursive": true, - "siteadmin": ["GroupA", "GroupB"], - "revokeAdmin": true, - "sync": true - }, - "callbackURL": "https://mesh.your.domain/auth-oidc-azure-callback" -}, -``` - -#### *Schema* - -```json -"custom": { - "type": "object", - "properties": { - "preset": { "type": "string", "enum": ["azure", "google"]}, - "tenant_id": { "type": "string", "description": "Tenant ID from Azure AD."} - }, - "additionalProperties": false -}, -``` - -## Depreciated Properties - -### Overview - -#### Introduction - -As of MeshCentral `v1.1.22` and the writing of this documentation, the node module that handles everything was changed from [passport-openid-connect](https://github.com/jaredhanson/passport-openidconnect) to [openid-client](https://github.com/panva/node-openid-client). As a result of this change, multiple properties in the config have been depcrecated; this means some options in the strategy arent being used anymore. These are often referred to as "old configs" by this documentation. - -#### *Migrating Old Configs* - -We upgraded but what about all the existing users, we couldn't just invalidate every config pre `v1.1.22`. So in an effort to allow greater flexibility to all users of MeshCentral, and what futures scholars will all agree was an obvious move, all the depreciated configs will continue working as expected. Using any of the old options will just generate a warning in the authlog and will not stop you from using this the OIDC strategy with outdated configs, however if both the equivalent new and old config are set the new config will be used. - -#### *Old Config Example* -```json -"oidc": { - "newAccounts": true, - "clientid": "421326444155-i1tt4bsmk3jm7dri6jldekl86rfpg07r.apps.googleusercontent.com", - "clientsecret": "GNLXOL-kEDjufOCk6pIcTHtaHFOCgbT4hoi" -} -``` - -This example was chosen because I wanted to highlight an advantage of supporting these old configs long term, even in a depreciated status. That is, the ability to copy your existing config from one of the related strategies without making any changes to your config by using the presets. This allows you to test out the oidc strategy without commiting to anything, since the user is always appended with the strategy used to login. In this example, the config was originally a google auth strategy config, changing the `"google"` to `"oidc"` is all that was done to the above config, besides obsfuscation of course. - -#### *Advcanced Old Config Example* - -``` json -"oidc": { - "authorizationURL": "https://sso.your.domain/api/oidc/authorization", - "callbackURL": "https://mesh.your.domain/oauth2/oidc/callback", - "clientid": "tZiPTMDNuSaQPapAQJtwDXVnYjjhQybc", - "clientsecret": "vrQWspJxdVAxEFJdrxvxeQwWkooVcqdU", - "issuer": "https://sso.your.domain", - "tokenURL": "https://sso.your.domain/api/oidc/token", - "userInfoURL": "https://sso.your.domain/api/oidc/userinfo", - "logoutURL": "https://sso.your.domain/logout?rd=https://mesh.your.domain/login", - "groups": { - "recursive": true, - "required": ["Group1", "Group2"], - "siteadmin": ["GroupA", "GroupB"], - "sync": { - "filter": ["Group1", "GroupB", "OtherGroup"] - } - }, - "newAccounts": true -}, -``` - -#### *Upgrading to v1.1.22* - -If you were already using a meticulusly configured oidc strategy, all of your configs will still be used. You will simply see a warning in the logs if any depreciated properties were used. If you check the authLog there are additional details about the old config and provide the new place to put that information. In this advanced config, even the groups will continue to work just as they did before without any user intervention when upgrading from a version of MeshCentral pre v1.1.22. There are no step to take and no action is needed, moving the configs to the new locations is completely optional at the moment. - -# Links - -https://cloud.google.com/identity/docs/reference/rest/v1/groups/list - -https://www.onelogin.com/learn/authentication-vs-authorization - -https://auth0.com/docs/authenticate/protocols/openid-connect-protocol - -https://github.com/panva/node-openid-client - -https://openid.net/connect/ - -> You just read `openidConnectStrategy.ms v1.0.1` by [@mstrhakr](https://github.com/mstrhakr) diff --git a/docs/docs/meshcentral/plugins.md b/docs/docs/meshcentral/plugins.md index 4b85b0c5..e9d664ff 100644 --- a/docs/docs/meshcentral/plugins.md +++ b/docs/docs/meshcentral/plugins.md @@ -1,140 +1,9 @@ -# Plugins - Installation & Usage +# Plugins -!!!note - Plugins as such receive **no support** by the main developers of MeshCentral. If you experience problems with MeshCentral please make sure to **disable all plugins before further troubleshooting**! +## Installation -## Use Cases - -Certain feature requests may not be suitable for all MeshCentral users and thus are available as a plugin. Furthermore users can develop their own plugins - as described further below - to extend functionality or benefit from integrating MeshCentral into their existing application environment. - -## List of publically available plugins - - - -## Installation of a plugin - -1. First please make sure that you enable plugins in the configuration - >"plugins": { - > "enabled": true - >}, -2. Restart MeshCentral if you needed to change the configuration. -2. Log into MeshCentral as full administrator. -3. Go my `My Server` -> `Plugins`, then hit the Download plugin button. -4. A dialog opens requesting a URL, e.g. put in: +1. Enable plugins in the configuration and restart MC as described. +2. Log into MC as full administrator. +3. Go my `My Server` -> `Plugins`, hit the Download plugin button. +4. A dialog opens requesting an URL, put in: 5. The plugin pops up in the plugin list below the download button, you can now configure and enable/disable it. - -# Plugins - Development & Hooks - -!!!note - Plugins as such receive **no support** by the main developers of MeshCentral. If you experience problems with MeshCentral please make sure to **disable all plugins before further troubleshooting**! - -## Overview - -Not all feature requests may be suitable for all MeshCentral users and thus can't be integrated into MeshCentral directly. Hwoever, Instead of maintaining a complete fork of MeshCentral it is much easier to extend MeshCentral's functionality using hooks and writing plugins for it. - -## Anatomy of a plugin: - - - plugin_name/ - -- config.json - -- plugin_name.js - -- modules_meshcore/ // optional - --- plugin_name.js // optional - -## Plugin Configuration File - -A valid JSON object within a file named `config.json` in the root folder of your project. An example: - - { - "name": "Plugin Name", - "shortName": "plugin_name", - "version": "0.0.0", - "author": "Author Name", - "description": "Short Description of the plugin", - "hasAdminPanel": false, - "homepage": "https://www.example.com", - "changelogUrl": "https://raw.githubusercontent.com/User/Project/master/changelog.md", - "configUrl": "https://raw.githubusercontent.com/User/Project/master/config.json", - "downloadUrl": "https://github.com/User/Project/archive/master.zip", - "repository": { - "type": "git", - "url": "https://github.com/User/Project.git" - }, - "versionHistoryUrl": "https://api.github.com/repos/User/Project/tags", - "meshCentralCompat": ">0.4.3" - } - -## Configuration File Properties - -| Field | Required | Type | Description | -| ----------------- | -------- | ----------- | ------------------------------------------------------------ | -| name | Yes | string | a human-readable name for the plugin | -| shortName | Yes | string | an alphanumeric, unique short identifier for the plugin (will be used to access your functions throughout the project | -| version | Yes | string | the current version of the plugin | -| author | No | string | the author's name | -| description | Yes | string | a short, human-readable description of what the plugin does | -| hasAdminPanel | Yes | boolean | `true` or `false`, indicates whether or not the plugin will offer its own administrative interface | -| homepage | Yes | string | the URL of the projects homepage | -| changelogUrl | Yes | string | the URL to the changelog of the project | -| configUrl | Yes | string | the URL to the config.json of the project | -| downloadUrl | Yes | string | the URL to a ZIP of the project (used for installation/upgrades) | -| repository | Yes | JSON object | contains the following attributes | -| repository.type | Yes | string | valid values are `git` and in the future, `npm` will also be supported. | -| repository.url | Yes | string | the URL to the project's repository | -| versionHistoryUrl | No | string | the URL to the project's versions/tags | -| meshCentralCompat | Yes | string | the minimum version string of required compatibility with the MeshCentral server, can be formatted as "0.1.2-c" or ">=0.1.2-c". Currently only supports minimum version, not full semantic checking. | - -## Plugin Hooks - -In essence, hooks are locations in the code which enable developers to tap into a module to either provide alternative behavior or to respond to an event. - -These are separated into the following categories depending on the type of functionality the plugin should offer. - -- Web UI, to modify the MeshCentral admin interface -- Back End, to modify core functionality of the server and communicate with the Web UI layer as well as the Mesh Agent (Node) layer to send commands and data -- Mesh Agent (Node), to introduce functionality to each agent - -### Web UI Hooks - -- `onDeviceRefreshEnd`: called when a device is selected in the MeshCentral web interface -- `registerPluginTab`: callable when a device is selected in the MeshCentral web interface to register a new tab for plugin data, if required. Accepts an object, or function that returns an object, with the following properties: { tabId: "yourShortNameHere", tabTitle: "Your Display Name"}. A tab and div with the associated ID and title will be created for your use -- `onDesktopDisconnect`: called when a remote desktop session is disconnected -- `onWebUIStartupEnd`: called when the page has loaded for the first time after a login / refresh -- `goPageStart`: called before page changes take effect. Passes 2 arguments ( : int, : Event) -- `goPageEnd`: called after page changes take effect. Passes 2 arguments ( : int, : Event) - -#### Exports - -Any function can be exported to the Web UI layer by adding the name of the function to an `exports` array in the plugin object. - -### Back End Hooks - -- `server_startup`: called once when the server starts (or when the plugin is first installed) -- `hook_agentCoreIsStable`: called once when an agent initially checks in -- `hook_processAgentData`: called each time an agent transmits data back to the server -- `hook_userLoggedIn`: called when a user has logged into the web interface -- `hook_setupHttpHandlers`: called before all http handlers are setup - -### Mesh Agent - -Use of the optional file `plugin_name.js` in the optional folder `modules_meshcore` will include the file in the default meshcore file sent to each endpoint. This is useful to add functionality on each of the endpoints. - -## Structure - -Much of MeshCentral revolves around returning objects for your structures, and plugins are no different. Within your plugin you can traverse all the way up to the web server and MeshCentral Server classes to access all the functionality those layers provide. This is done by passing the current object to newly created objects, and assigning that reference to a `parent` variable within that object. - - -## Ping-Pong - -If you build a plugin which makes use of `meshrelay.ashx`, keep in mind to either handle ping-pong messages (`serverPing`, `serverPong`) on the control channel or to request MeshCentral to not send such messages through sending the `noping=1` parameter in the connection URL. For a deeper sight search for "PING/PONG" in `meshrelay.js`. - -## Versioning - -Versioning your plugin correctly and consistently is essential to ensure users of your plugin are prompted to upgrade when it is available. Semantic versioning is recommended. - -## Changelog - -A changelog is highly recommended so that your users know what's changed since their last version. - -## Sample Plugin - -[MeshCentral-Sample](https://github.com/ryanblenis/MeshCentral-Sample) is a simple plugin that, upon disconnecting from remote desktop, prompts the user to enter a manual event (note), pre-filled in with the date and timestamp. diff --git a/docs/docs/meshcentral/security.md b/docs/docs/meshcentral/security.md deleted file mode 100644 index ef1dc2d7..00000000 --- a/docs/docs/meshcentral/security.md +++ /dev/null @@ -1,55 +0,0 @@ -# Security - -## Rate Limiting login attempts - -You can use the MeshCentral Server Console with the command `badlogins` to see the current settings. - -Adjust these items in your `config.json` - -```json -"settings": { - "_maxInvalidLogin": { - "time": 10, - "count": 10, - "coolofftime": 10 - }, -} -``` - -![](images/rate_limiting_logins.png) - -## Disabling TLS 1.0/1.1 for AMT - -```json -{ - "settings": { - "mpshighsecurity": true - } -} -``` - -## Duo 2FA setup - -MeshCentral supports Duo as a way for users to add two-factor authentication and Duo offers free accounts for user 10 users. To get started, go to [Duo.com](https://duo.com/) and create a free account. Once logged into Duo, select "Applications" and "Protect an Application" on the left side. Search for "Web SDK" and hit the "Protect" button. You will see a screen with the following information: - - - Client ID - - Client secret - - API hostname - -Copy these three values in a safe place and do not share these values with anyone. Then, in your MeshCentral config.json file, add the following in the domains section: - -```json -{ - "domains": { - "": { - "duo2factor": { - "integrationkey": "ClientId", - "secretkey": "ClientSecret", - "apihostname": "api-xxxxxxxxxxx.duosecurity.com" - } - } - } -} -``` - -Restart MeshCentral and your server should now be Duo capable. Users will see an option to enable it in the "My Account" tab. When enabling it, users will be walked thru the process of downloading the mobile application and going thru a trial run on 2FA. Users that get setup will be added to your Duo account under the "Users" / "Users" screen in Duo. Note that the "admin" user is not valid in Duo, so, if you have a user with the name "Admin" in MeshCentral, they will get an error trying to setup Duo. diff --git a/docs/docs/meshcentral/tipsntricks.md b/docs/docs/meshcentral/tipsntricks.md deleted file mode 100644 index 3126e869..00000000 --- a/docs/docs/meshcentral/tipsntricks.md +++ /dev/null @@ -1,45 +0,0 @@ -# Tips n' Tricks - -## Colors in SSH - -The SSH terminal does support color. The issue is going to be the terminal configuration of the shell. Try typing this: - -```bash -ls -al --color /tmp -``` - -## Fancy config editing with VS Code - -A common problem in the issues is an incorrect config.json. What makes a config incorrect? How can you verify your config is correct? - -Easy! Use Visual Studio Code to edit your config.json and add the schema at the top. - -If you haven't already, download VS code. -Download or copy the config.json to your computer. -Open config.json in code and add the schema as the top line. This schema is the raw JSON file in the MeshCentral repo. - -```json -{ - "$schema": "https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json", - "settings": { - "your settings go here": "..." - } -} -``` - -Now you have autocomplete, auto-format and validation for your config.json! If you start typing, Code will show the values that are valid for the location you are editing. Words with a red squiggle line are errors. Words with a orange squiggle line are warnings. Hover over both to see the error message and possible fixes. Code can even format your config. - -While this is a huge step up, it's not perfect. If you notice, there are some invalid keys in the screenshot. This is perfectly valid JSON and MeshCentral will ignore them (maybe?). If you paste some configs into the wrong section, code will not tell you it's in the wrong section. Autocomplete will tell you what keys are valid and the type of the value (i.e. string, number, boolean). - -Hopefully this will help verify your config is syntactically correct and prevent needless formatting errors, misspellings, etc. - -![](images/2023-02-24vscodejsonediting.png) - -## Downloading Folders - -If you would like to download folders via Files simply select folder/files then use the zip and download the zip file by clicking on it. - -## Share device groups with AD logins -If you would like to share device groups with different AD users. - -In the config.json set "ldapuserkey" to "sAMAccountName". diff --git a/docs/docs/meshcentral/tokens.md b/docs/docs/meshcentral/tokens.md index 7086955d..c190d674 100644 --- a/docs/docs/meshcentral/tokens.md +++ b/docs/docs/meshcentral/tokens.md @@ -8,18 +8,8 @@ ## Software Integration Tokens -!!!warning - You can only have a SINGLE loginTokenKey for your meshcentral server!
- So if you regenerate a loginTokenKey, the old one will be revoked/deleted! - -You can create/view the Login Token Key with the following: +Currently, the login tokens in the user manual section 14.1 can't be tracked, deleted or revoked. They are generated with: ```bash -node node_modules/meshcentral --loginTokenKey -``` - -You can then reset/revoke/renew the Login Token Key with the following to create a new one: - -```bash -node node_modules/meshcentral --loginTokenKey --loginTokenGen +node meshcentral --loginTokenKey ``` diff --git a/docs/docs/meshcmd/index.md b/docs/docs/meshcmd/index.md index 2c4cf1bb..38528f91 100644 --- a/docs/docs/meshcmd/index.md +++ b/docs/docs/meshcmd/index.md @@ -1,6 +1,6 @@ # MeshCmd -MeshCmd Guide [as .pdf](https://meshcentral.com/docs/MeshCmdUserGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCmd User's Guide v0.0.3.odt?raw=true) +MeshCmd Guide [as .pdf](https://meshcentral.com/info/docs/MeshCmdUserGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCmd User's Guide v0.0.3.odt?raw=true) ## Video Walkthru diff --git a/docs/docs/meshctrl/index.md b/docs/docs/meshctrl/index.md index 13b74bc9..c8f46b1c 100644 --- a/docs/docs/meshctrl/index.md +++ b/docs/docs/meshctrl/index.md @@ -1,6 +1,6 @@ # MeshCtrl -MeshCmd Guide [as .pdf](https://meshcentral.com/docs/MeshCtrlUsersGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCtrl User's Guide v0.0.1.odt?raw=true) +MeshCmd Guide [as .pdf](https://meshcentral.com/info/docs/MeshCtrlUsersGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCtrl User's Guide v0.0.1.odt?raw=true) ## Video Walkthru @@ -274,7 +274,6 @@ devicesharing devicepower indexagenterrorlog agentdownload -report ``` You can get this list by just running MeshCtrl without any argument and can get more information on each action by typing “meshctrl help [action]” diff --git a/docs/docs/meshrouter/index.md b/docs/docs/meshrouter/index.md index b99f042e..057b0515 100644 --- a/docs/docs/meshrouter/index.md +++ b/docs/docs/meshrouter/index.md @@ -2,7 +2,7 @@ ![](images/Aspose.Words.954ea56c-626b-416a-8b2a-efde10ebd3a9.002.png) -MeshCentral Router Guide [as .pdf](https://meshcentral.com/docs/MeshCentral2RouterUserGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCentral%20Router%20User%20Guide%20v0.0.2.odt?raw=true) +MeshCentral Router Guide [as .pdf](https://meshcentral.com/info/docs/MeshCentral2RouterUserGuide.pdf) [as .odt](https://github.com/Ylianst/MeshCentral/blob/master/docs/MeshCentral%20Router%20User%20Guide%20v0.0.2.odt?raw=true) ## Video Walkthru @@ -21,7 +21,7 @@ MeshCentral is a remote management web site that connects users to remote comput ## Downloading MeshCentral router is a Windows application that comes built-into the MeshCentral server or can -be downloaded at: +be downloaded at: It’s probably best to use the MeshCentral router that comes with your version of the MeshCentral server as the two will likely be most compatible. A given MeshCentral Router version may not diff --git a/docs/docs/messaging/images/MC2-CallMeBot3.png b/docs/docs/messaging/images/MC2-CallMeBot3.png deleted file mode 100644 index e1bcbcd7..00000000 Binary files a/docs/docs/messaging/images/MC2-CallMeBot3.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Discord1.png b/docs/docs/messaging/images/MC2-Discord1.png deleted file mode 100644 index 072c3bff..00000000 Binary files a/docs/docs/messaging/images/MC2-Discord1.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Ntfy1.png b/docs/docs/messaging/images/MC2-Ntfy1.png deleted file mode 100644 index bbd043cd..00000000 Binary files a/docs/docs/messaging/images/MC2-Ntfy1.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Pushover1.png b/docs/docs/messaging/images/MC2-Pushover1.png deleted file mode 100644 index eb543dbb..00000000 Binary files a/docs/docs/messaging/images/MC2-Pushover1.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Pushover2.png b/docs/docs/messaging/images/MC2-Pushover2.png deleted file mode 100644 index 2175c371..00000000 Binary files a/docs/docs/messaging/images/MC2-Pushover2.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Telegram1.png b/docs/docs/messaging/images/MC2-Telegram1.png deleted file mode 100644 index 664aa2ef..00000000 Binary files a/docs/docs/messaging/images/MC2-Telegram1.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Telegram2.png b/docs/docs/messaging/images/MC2-Telegram2.png deleted file mode 100644 index f8046886..00000000 Binary files a/docs/docs/messaging/images/MC2-Telegram2.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Telegram3.png b/docs/docs/messaging/images/MC2-Telegram3.png deleted file mode 100644 index 0a623a32..00000000 Binary files a/docs/docs/messaging/images/MC2-Telegram3.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Telegram4.png b/docs/docs/messaging/images/MC2-Telegram4.png deleted file mode 100644 index 3c8727fe..00000000 Binary files a/docs/docs/messaging/images/MC2-Telegram4.png and /dev/null differ diff --git a/docs/docs/messaging/images/MC2-Telegram5.png b/docs/docs/messaging/images/MC2-Telegram5.png deleted file mode 100644 index 830f9c20..00000000 Binary files a/docs/docs/messaging/images/MC2-Telegram5.png and /dev/null differ diff --git a/docs/docs/messaging/index.md b/docs/docs/messaging/index.md deleted file mode 100644 index 40be9b88..00000000 --- a/docs/docs/messaging/index.md +++ /dev/null @@ -1,291 +0,0 @@ -# Messaging - -## Table of Contents - -[Introduction](#introduction) -[Telegram Setup](#telegram-setup) -[Discord Setup](#discord-setup) -[XMPP Setup](#xmpp-setup) -[CallMeBot Setup](#callmebot-setup) -[Pushover Setup](#pushover-setup) -[ntfy Setup](#ntfy-setup) -[Zulip Setup](#zulip-setup) -[User Setup](#user-setup) -[Administrator Management](#administrator-management) -[Two-Factor Authentication](#two-factor-authentication) - -## Introduction - -MeshCentral supports messaging platforms so that users can register a messaging account with MeshCentral and receive notifications. This is useful since messages are sent to an application the user is confirtable with and many messaging platforms have clients on mobile phones, desktop and more so that the notification can show up where the user is. - -## Telegram Setup - -For Telegram integration, you will need to provide MeshCentral with the necessary login information so that MeshCentral can authenticate and connect to the Telegram servers and start sending notifications. For Telegram, both user and bot login is supported with bot login being the more typical way to go. The configuration in the config.json for a bot login looks like this: - -```json -{ - "settings": { - "Cert": "devbox.mesh.meshcentral.com", - }, - "domains": { - "": { - "title": "My Server" - } - }, - "messaging": { - "telegram": { - "apiid": 0, - "apihash": "00000000000000000000000", - "bottoken": "00000000:aaaaaaaaaaaaaaaaaaaaaaaa" - } - } -} -``` - -Note the "messaging" section in the config.json. For Telegram user login, it looks like this: - -```json -{ - "messaging": { - "telegram": { - "apiid": 0, - "apihash": "00000000000000000000000", - "session": "aaaaaaaaaaaaaaaaaaaaaaa" - } - } -} -``` - -User login makes use of "session", while bot login uses "bottoken". One way to get started with the setup is to run `node node_modules/meshcentral --setuptelegram` and follow the instructions. - -![](images/MC2-Telegram5.png) - -In the first step, you will get the apiid and apihash values. In the second step you get the bottoken or enter your phone number and code to get the session value. Once done, when running the server manually from the command line, the server should indicate that it can connect to Telegram like this: - -``` -MeshCentral HTTP redirection server running on port 80. -MeshCentral v1.0.87, Hybrid (LAN + WAN) mode. -MeshCentral Intel(R) AMT server running on central.mesh.meshcentral.com:4433. -MeshCentral HTTPS server running on central.mesh.meshcentral.com:443. -MeshCentral HTTPS relay server running on relay1.mesh.meshcentral.com:443. -MeshCentral Telegram client is bot connected. -``` - -Note the last line, indicating it's connected as a bot. If you wish to use Telegram with a proxy, here are the possible Telegram settings. You can use the proxy settings for both user or bot login modes. - -``` -{ - "messaging": { - "telegram": { - "apiid": 0, - "apihash": "00000000000000000000000", - "session": "aaaaaaaaaaaaaaaaaaaaaaa", - "useWSS": false, // Important. Most proxies cannot use SSL. - "proxy": { - "ip": "123.123.123.123", // Proxy host (IP or hostname) - "port": 123, // Proxy port - "MTProxy": false, // Whether it's an MTProxy or a normal Socks one - "secret": "00000000000000000000000000000000", // If used MTProxy then you need to provide a secret (or zeros). - "socksType": 5, // If used Socks you can choose 4 or 5. - "timeout": 2 // Timeout (in seconds) for connection, - } - } - } -} -``` - -## Discord Setup - -For Discord integration, you need to provide MeshCentral with a bot application token so that MeshCentral can login and send notifications to users. The Discord bot will need to be joined to one or more Discord servers and users will need to join at at least one Discord server that is in common with the bot to receive notifications. - -There are many tutorials online on how to create a Discord bot and get the login token. For example follow the [two first sections of this tutorial](https://www.freecodecamp.org/news/create-a-discord-bot-with-javascript-nodejs/). The "How to Create a Discord Bot Account" section will show how to create a bot and get the token, the "How to Invite Your Bot to Join a Server" section shows how to join the bot to a Discord server. - -Note that Privleged Gateway Intents permissions is needed for the bot on Discord. If not set, MeshCentral will show an error when trying to connect to Discord. - -![](images/MC2-Discord1.png) - -Discord integration requires that MeshCentral be run on NodeJS v17 or higher. Once you have the Discord bot login token, the config.json Discord configuration looks like this: - -```json -{ - "messaging": { - "discord": { - "serverurl": "https://discord.gg/xxxxxxxxx", - "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxx" - } - } -} -``` - -Once users will need to join the same Discord server as the bot, the optional "serverurl" can be used to give the users a URL link to join the server, this can be a server invitation link or some other URL with instructions. - -## XMPP Setup - -For XMPP integration, you need to provide MeshCentral with a XMPP server, username and password so that MeshCentral can login and send notifications to users. You can get a XMPP account to any number of servers or start up your own XMPP server. - -```json -{ - "messaging": { - "xmpp": { - "service": "xmppserver.com", - "credentials": { - "username": "username", - "password": "password" - } - } - } -} -``` - -An easy way to get setup with XMPP is to create a free account with [chatterboxtown.us](https://chatterboxtown.us/) and then, setup MeshCentral with the service value set to "chatterboxtown.us" along with the username and password of you account. This can be done in minutes. Once setup, users will be able to setup and verify XMLL accounts and use this for notifications and 2FA verification. - -## CallMeBot Setup - -![](images/MC2-CallMeBot3.png) - -[CallMeBot](https://www.callmebot.com/) is a free system that allows users to receive notifications on Signal Messenger, Whatsapp and Facebook Messenger. Enabling this feature is very simple, just enable it like this: - -```json -{ - "messaging": { - "callmebot": true - } -} -``` - -Once enabled, users see the new "CallMeBot" option when trying to enable messaging in MeshCentral. They will need to follow specific instructions to enable CallMeBot to send notifications to their messaging application. - - - [Signal Messenger](https://www.callmebot.com/blog/free-api-signal-send-messages/) - - [Whatsapp](https://www.callmebot.com/blog/free-api-whatsapp-messages/) - - [Facebook Messenger](https://www.callmebot.com/blog/free-api-facebook-messenger/) - - [Telegram](https://www.callmebot.com/blog/telegram-text-messages/) - -Once the user has enabled their account, they can cut & paste the CallMeBot URI into MeshCentral to validate their account. - -## Pushover Setup - -[Pushover](https://pushover.net/) is another notification service that makes it's own mobile application. To get started, download the Pushover application and create an account then go to the https://pushover.net/ web site and setup a new application like this: - -![](images/MC2-Pushover2.png) - -You can setup an application with a name and icon, then, once you get a application token you can add it to the config.json like this: - -```json -{ - "messaging": { - "pushover": { - "token": "xxxxxxxxxxxxxxxxxxxxx" - } - } -} -``` - -Once setup, the server will offer users the "Pushover" option when setting up messaging. Users will need to copy the Pushover user key into the dialog box to verify notifications are correct. - -![](images/MC2-Pushover1.png) - -## ntfy setup - -[ntfy](https://ntfy.sh/) is a completely free notification service. You can enable the ntfy integration with the following config.json section: - -```json -{ - "messaging": { - "ntfy": true - } -} -``` -No setup is reqired to enable this. When using ntfy, make sure you use a suffisently random topic name so that others can't guess the name and subscribe to it to receive your messages. - -For [self-hosting your own ntfy server](https://ntfy.sh/docs/install/) with [ACL support](https://ntfy.sh/docs/config/#access-control) - -You can set `host` to the DNS name of your server, `userurl` to the url to provide to users to setup access to your server and `authorization` to the Basic base64 User+Pass authenttication for your server - -```json -{ - "messaging": { - "ntfy": { - "host": "myntfyserver.com", - "userurl": "https://myntfyserver.com/userhelp", - "authorization": "Basic cGhpbDpteXBhc3M=" - } - } -} -``` - -![](images/MC2-Ntfy1.png) - -## Zulip setup - -You can enable the MeshCentral [Zulip](https://zulip.com/) integration with the following config.json section: - -```json -{ - "messaging": { - "zulip": { - "site": "https://api.zulip.com", - "email": "your-bot@zulip.com", - "api_key": "your_32_character_api_key" - } - } -} -``` - -## Slack setup - -[Slack](https://slack.com/) integration is achieved by the use of Incoming Webhooks. -You can get started by following the Slack guide [here](https://api.slack.com/messaging/webhooks) and getting your URL - -Once you have your incoming webhooks url, You can enable the [Slack](https://slack.com/) integration with the following config.json section - -```json -{ - "messaging": { - "slack": true - } -} -``` - -## User Setup - -Once one or more messaging systems are setup with MeshCentral, users will be able to register their handle and verify that they own that account by typing in a 6 digit code. - -![](images/MC2-Telegram1.png) - -This verification is necessary so that MeshCentral does not send notifications to incorrect messaging accounts. - -## Administrator Management - -When users setup a messaging account, a messaging bubble will show up next to their name in the "My Users" tab. You can also click on a user to see and edit it's messaging handle and message them. Currently MeshCentral can only send messages, no receive. - -![](images/MC2-Telegram2.png) - -## Two-Factor Authentication - -By default, messaging is used as a second factor for login when a user enabled a messaging account. Users will need to messaging icon on the login screen and can opt to receive a 6 digit code to login. - -![](images/MC2-Telegram3.png) - -As an administrator you can turn off use of messaging for 2FA using the following settings in the config.json: - -```json -{ - "settings": { - "Cert": "devbox.mesh.meshcentral.com", - }, - "domains": { - "": { - "title": "My Server", - "passwordRequirements": { - "msg2factor": false - } - } - } -} -``` - -Notice the `msg2factor` is set to false. In this case, messaging can still be used for user notifications, but will not be offered as a 2FA option. - -For administrators, login reports will show if "Messaging" was used as a second factor for a user login. You can see this in this report: - -![](images/MC2-Telegram4.png) diff --git a/docs/docs/stylesheets/extra.css b/docs/docs/stylesheets/extra.css index 721e0b33..d43f2cf7 100644 --- a/docs/docs/stylesheets/extra.css +++ b/docs/docs/stylesheets/extra.css @@ -1,8 +1,3 @@ -/* Maximum space for text block */ -.md-grid { - max-width: 95%; /* or 100%, if you want to stretch to full-width */ - } - .md-header { background-color: #0b3e81 !important; color: white !important; @@ -82,18 +77,4 @@ a:link { padding:4px; border-radius:4px; box-shadow: 2px 2px 4px black; -} -.md-typeset .tabbed-set { - border-left-width: 0.2rem; - border-left-color: rgb(244, 244, 244); - border-left-style: solid; - border-radius: 4px; - background-color: rgba(68,138,255,.1); - border-color: rgb(244, 244, 244); - padding: 5px; -} -@media only screen and (max-width: 76.1875em) { - .md-nav__link { - color: black; - } - } +} \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 8773ed8a..326c1f94 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -9,21 +9,12 @@ nav: - MeshCentral2: - 'MeshCentral2 Guide': 'meshcentral/index.md' - 'All Configuration Options': 'meshcentral/config.md' - - 'Agent Information': 'meshcentral/agents.md' + - 'Device Tabs': 'meshcentral/devicetabs.md' + - 'Tokens': 'meshcentral/tokens.md' - 'Assistant': 'meshcentral/assistant.md' - 'Code Signing': 'meshcentral/codesigning.md' - 'Debugging': 'meshcentral/debugging.md' - - 'Device Tabs': 'meshcentral/devicetabs.md' - - 'Plugins': 'meshcentral/plugins.md' - - 'SSL': 'meshcentral/SSLnletsencrypt.md' - - 'Security': 'meshcentral/security.md' - - 'Tokens': 'meshcentral/tokens.md' - - 'FAQ': 'meshcentral/faq.md' - - 'Tips n Tricks': 'meshcentral/tipsntricks.md' - - 'Messaging': 'messaging/index.md' - - 'Customization': 'meshcentral/customization.md' - - 'openidConnectStrategy': 'meshcentral/openidConnectStrategy.md' - + - Design and Architecture: - design/index.md @@ -39,16 +30,13 @@ nav: - Intel AMT: - intelamt/index.md - - How to Contribute: - - how-to-contribute/index.md - - Other: - other/adfs_sso_guide.md - other/meshcentral_satellite.md site_description: "A remote monitoring and management tool" site_author: "Ylianst" -site_url: "https://ylianst.github.io/MeshCentral/" +site_url: "https://git.meshcentral.com/" dev_addr: "0.0.0.0:8010" @@ -86,6 +74,13 @@ markdown_extensions: - admonition - pymdownx.details - pymdownx.highlight + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.mark + - pymdownx.smartsymbols + - pymdownx.highlight + - pymdownx.inlinehilite + - pymdownx.keys - pymdownx.mark - pymdownx.smartsymbols - codehilite: diff --git a/docs/powerpoints/MeshCentral - 0009 - Desktop Multiplexer.pptx b/docs/powerpoints/MeshCentral - 0009 - Desktop Multiplexer.pptx deleted file mode 100644 index 916288c6..00000000 Binary files a/docs/powerpoints/MeshCentral - 0009 - Desktop Multiplexer.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0027 - Overview Presentation.pptx b/docs/powerpoints/MeshCentral - 0027 - Overview Presentation.pptx deleted file mode 100644 index 5da21935..00000000 Binary files a/docs/powerpoints/MeshCentral - 0027 - Overview Presentation.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0028 - Multi-domain Server.pptx b/docs/powerpoints/MeshCentral - 0028 - Multi-domain Server.pptx deleted file mode 100644 index a97a7bd0..00000000 Binary files a/docs/powerpoints/MeshCentral - 0028 - Multi-domain Server.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0029 - Technical - A short history of MeshCentral.pptx b/docs/powerpoints/MeshCentral - 0029 - Technical - A short history of MeshCentral.pptx deleted file mode 100644 index 485e5e73..00000000 Binary files a/docs/powerpoints/MeshCentral - 0029 - Technical - A short history of MeshCentral.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0030 - Technical - REST vs WebSocket.pptx b/docs/powerpoints/MeshCentral - 0030 - Technical - REST vs WebSocket.pptx deleted file mode 100644 index da1d7a8a..00000000 Binary files a/docs/powerpoints/MeshCentral - 0030 - Technical - REST vs WebSocket.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0031 - Technical - Agent Updates.pptx b/docs/powerpoints/MeshCentral - 0031 - Technical - Agent Updates.pptx deleted file mode 100644 index 55392196..00000000 Binary files a/docs/powerpoints/MeshCentral - 0031 - Technical - Agent Updates.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0037 - Technical - Agent Tunnels(1).pptx b/docs/powerpoints/MeshCentral - 0037 - Technical - Agent Tunnels(1).pptx deleted file mode 100644 index de5258d5..00000000 Binary files a/docs/powerpoints/MeshCentral - 0037 - Technical - Agent Tunnels(1).pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0037 - Technical - Agent Tunnels.pptx b/docs/powerpoints/MeshCentral - 0037 - Technical - Agent Tunnels.pptx deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/powerpoints/MeshCentral - 0038 - Server & DB Migration.pptx b/docs/powerpoints/MeshCentral - 0038 - Server & DB Migration.pptx deleted file mode 100644 index 99b9c5e3..00000000 Binary files a/docs/powerpoints/MeshCentral - 0038 - Server & DB Migration.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0039 - Intel AMT Configuration and CIRA.pptx b/docs/powerpoints/MeshCentral - 0039 - Intel AMT Configuration and CIRA.pptx deleted file mode 100644 index a4359402..00000000 Binary files a/docs/powerpoints/MeshCentral - 0039 - Intel AMT Configuration and CIRA.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0040 - Technical - Inter-User Messaging.pptx b/docs/powerpoints/MeshCentral - 0040 - Technical - Inter-User Messaging.pptx deleted file mode 100644 index 52cd2562..00000000 Binary files a/docs/powerpoints/MeshCentral - 0040 - Technical - Inter-User Messaging.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0042 - Technical - Web Applications.pptx b/docs/powerpoints/MeshCentral - 0042 - Technical - Web Applications.pptx deleted file mode 100644 index 1e74942d..00000000 Binary files a/docs/powerpoints/MeshCentral - 0042 - Technical - Web Applications.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0043 - Let's Encrypt.pptx b/docs/powerpoints/MeshCentral - 0043 - Let's Encrypt.pptx deleted file mode 100644 index 9cc81304..00000000 Binary files a/docs/powerpoints/MeshCentral - 0043 - Let's Encrypt.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0044 - JumpCloud.pptx b/docs/powerpoints/MeshCentral - 0044 - JumpCloud.pptx deleted file mode 100644 index f7a9f6c8..00000000 Binary files a/docs/powerpoints/MeshCentral - 0044 - JumpCloud.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0045 - Local Device Management.pptx b/docs/powerpoints/MeshCentral - 0045 - Local Device Management.pptx deleted file mode 100644 index 0044dbdb..00000000 Binary files a/docs/powerpoints/MeshCentral - 0045 - Local Device Management.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0047 - MongoDB.pptx b/docs/powerpoints/MeshCentral - 0047 - MongoDB.pptx deleted file mode 100644 index b6aea557..00000000 Binary files a/docs/powerpoints/MeshCentral - 0047 - MongoDB.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0048 - IP-KVM Support.pptx b/docs/powerpoints/MeshCentral - 0048 - IP-KVM Support.pptx deleted file mode 100644 index 9c0f5b37..00000000 Binary files a/docs/powerpoints/MeshCentral - 0048 - IP-KVM Support.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0049 - Web Power Switch.pptx b/docs/powerpoints/MeshCentral - 0049 - Web Power Switch.pptx deleted file mode 100644 index 86eed853..00000000 Binary files a/docs/powerpoints/MeshCentral - 0049 - Web Power Switch.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0050 - 2021 in Review.pptx b/docs/powerpoints/MeshCentral - 0050 - 2021 in Review.pptx deleted file mode 100644 index d7211361..00000000 Binary files a/docs/powerpoints/MeshCentral - 0050 - 2021 in Review.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0054 - Public Server.pptx b/docs/powerpoints/MeshCentral - 0054 - Public Server.pptx deleted file mode 100644 index 9b230b25..00000000 Binary files a/docs/powerpoints/MeshCentral - 0054 - Public Server.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0057 - Technical - MeshCore & MeshCmd.pptx b/docs/powerpoints/MeshCentral - 0057 - Technical - MeshCore & MeshCmd.pptx deleted file mode 100644 index 4fa97a8b..00000000 Binary files a/docs/powerpoints/MeshCentral - 0057 - Technical - MeshCore & MeshCmd.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0063 - Port Aliasing.pptx b/docs/powerpoints/MeshCentral - 0063 - Port Aliasing.pptx deleted file mode 100644 index 924b1622..00000000 Binary files a/docs/powerpoints/MeshCentral - 0063 - Port Aliasing.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0064 - April Fools Joke - Car Automation Mesh.pptx b/docs/powerpoints/MeshCentral - 0064 - April Fools Joke - Car Automation Mesh.pptx deleted file mode 100644 index 6307dd80..00000000 Binary files a/docs/powerpoints/MeshCentral - 0064 - April Fools Joke - Car Automation Mesh.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0066 - Basic AMT 802.1x with JumpCloud.pptx b/docs/powerpoints/MeshCentral - 0066 - Basic AMT 802.1x with JumpCloud.pptx deleted file mode 100644 index 812a38b1..00000000 Binary files a/docs/powerpoints/MeshCentral - 0066 - Basic AMT 802.1x with JumpCloud.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0067 - Satellite & Advanced AMT 802.1x.pptx b/docs/powerpoints/MeshCentral - 0067 - Satellite & Advanced AMT 802.1x.pptx deleted file mode 100644 index 22b4641b..00000000 Binary files a/docs/powerpoints/MeshCentral - 0067 - Satellite & Advanced AMT 802.1x.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0068 - Local Device Management thru a Agent Relay.pptx b/docs/powerpoints/MeshCentral - 0068 - Local Device Management thru a Agent Relay.pptx deleted file mode 100644 index 5b7d48b5..00000000 Binary files a/docs/powerpoints/MeshCentral - 0068 - Local Device Management thru a Agent Relay.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0070 - Intel AMT System Defense.pptx b/docs/powerpoints/MeshCentral - 0070 - Intel AMT System Defense.pptx deleted file mode 100644 index 94487af7..00000000 Binary files a/docs/powerpoints/MeshCentral - 0070 - Intel AMT System Defense.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0075 - Intel AMT MEI and LMS.pptx b/docs/powerpoints/MeshCentral - 0075 - Intel AMT MEI and LMS.pptx deleted file mode 100644 index ddaf3881..00000000 Binary files a/docs/powerpoints/MeshCentral - 0075 - Intel AMT MEI and LMS.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0077 - History of Intel AMT.pptx b/docs/powerpoints/MeshCentral - 0077 - History of Intel AMT.pptx deleted file mode 100644 index 3a269a6b..00000000 Binary files a/docs/powerpoints/MeshCentral - 0077 - History of Intel AMT.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0078 - Intel AMT Activation.pptx b/docs/powerpoints/MeshCentral - 0078 - Intel AMT Activation.pptx deleted file mode 100644 index b77c4cd3..00000000 Binary files a/docs/powerpoints/MeshCentral - 0078 - Intel AMT Activation.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0078 - Web Relay.pptx b/docs/powerpoints/MeshCentral - 0078 - Web Relay.pptx deleted file mode 100644 index 9a3ba39b..00000000 Binary files a/docs/powerpoints/MeshCentral - 0078 - Web Relay.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0079 - Intel AMT Activation.pptx b/docs/powerpoints/MeshCentral - 0079 - Intel AMT Activation.pptx deleted file mode 100644 index b77c4cd3..00000000 Binary files a/docs/powerpoints/MeshCentral - 0079 - Intel AMT Activation.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0080 - Web Relay with DNS.pptx b/docs/powerpoints/MeshCentral - 0080 - Web Relay with DNS.pptx deleted file mode 100644 index f1e4b29d..00000000 Binary files a/docs/powerpoints/MeshCentral - 0080 - Web Relay with DNS.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0081 - CrowdSec.pptx b/docs/powerpoints/MeshCentral - 0081 - CrowdSec.pptx deleted file mode 100644 index f2e73f6c..00000000 Binary files a/docs/powerpoints/MeshCentral - 0081 - CrowdSec.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0082 - New Account CAPTCHA.pptx b/docs/powerpoints/MeshCentral - 0082 - New Account CAPTCHA.pptx deleted file mode 100644 index d625b1ad..00000000 Binary files a/docs/powerpoints/MeshCentral - 0082 - New Account CAPTCHA.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0083 - Yubikey OTP.pptx b/docs/powerpoints/MeshCentral - 0083 - Yubikey OTP.pptx deleted file mode 100644 index 4678bc2c..00000000 Binary files a/docs/powerpoints/MeshCentral - 0083 - Yubikey OTP.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0084 - LDAP Integration.pptx b/docs/powerpoints/MeshCentral - 0084 - LDAP Integration.pptx deleted file mode 100644 index ab55ad14..00000000 Binary files a/docs/powerpoints/MeshCentral - 0084 - LDAP Integration.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0087 - AceBase Database.pptx b/docs/powerpoints/MeshCentral - 0087 - AceBase Database.pptx deleted file mode 100644 index 365fcc9a..00000000 Binary files a/docs/powerpoints/MeshCentral - 0087 - AceBase Database.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0088 - SQLite Database.pptx b/docs/powerpoints/MeshCentral - 0088 - SQLite Database.pptx deleted file mode 100644 index 9b069181..00000000 Binary files a/docs/powerpoints/MeshCentral - 0088 - SQLite Database.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0091 - SessionKey.pptx b/docs/powerpoints/MeshCentral - 0091 - SessionKey.pptx deleted file mode 100644 index 563b6342..00000000 Binary files a/docs/powerpoints/MeshCentral - 0091 - SessionKey.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0092 - Agent Ping and Browser Pong.pptx b/docs/powerpoints/MeshCentral - 0092 - Agent Ping and Browser Pong.pptx deleted file mode 100644 index a1cd400b..00000000 Binary files a/docs/powerpoints/MeshCentral - 0092 - Agent Ping and Browser Pong.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0093 - Web Relay Sharing.pptx b/docs/powerpoints/MeshCentral - 0093 - Web Relay Sharing.pptx deleted file mode 100644 index 84f78b38..00000000 Binary files a/docs/powerpoints/MeshCentral - 0093 - Web Relay Sharing.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0094 - Device Pages.pptx b/docs/powerpoints/MeshCentral - 0094 - Device Pages.pptx deleted file mode 100644 index 9900ad68..00000000 Binary files a/docs/powerpoints/MeshCentral - 0094 - Device Pages.pptx and /dev/null differ diff --git a/docs/powerpoints/MeshCentral - 0095 - Security Password Policies.pptx b/docs/powerpoints/MeshCentral - 0095 - Security Password Policies.pptx deleted file mode 100644 index cc61a0e7..00000000 Binary files a/docs/powerpoints/MeshCentral - 0095 - Security Password Policies.pptx and /dev/null differ diff --git a/docs/powerpoints/README.md b/docs/powerpoints/README.md index 968e1706..159d630d 100644 --- a/docs/powerpoints/README.md +++ b/docs/powerpoints/README.md @@ -1,3 +1 @@ -Powerpoints from Youtube channel: - -Originals located at: \ No newline at end of file +Please place Powerpoints and slides here \ No newline at end of file diff --git a/docs/startdevmkdocsonwindows.ps1 b/docs/startdevmkdocsonwindows.ps1 index 833433bf..a8fcb55e 100644 --- a/docs/startdevmkdocsonwindows.ps1 +++ b/docs/startdevmkdocsonwindows.ps1 @@ -14,8 +14,8 @@ pip install mkdocs #only 1st time pip install mkdocs-material #only 1st time #Run mkdocs and look at changes as you make them -start-process http://localhost:8010 #Opens Browser mkdocs serve +start http://localhost:8010 #Opens Browser #Stop python deactivate \ No newline at end of file diff --git a/emails/device-help.html b/emails/device-help.html deleted file mode 100644 index f29092a3..00000000 --- a/emails/device-help.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- click here to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/device-help.txt b/emails/device-help.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/device-help.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/account-check_bs.html b/emails/translations/account-check_bs.html deleted file mode 100644 index b568f6e2..00000000 --- a/emails/translations/account-check_bs.html +++ /dev/null @@ -1,15 +0,0 @@ -
[[[SERVERNAME]]] - Potvrda e-pošte
-
- - - - -
- [[[SERVERNAME]]] - Potvrda -
-

Zdravo [[[USERNAME]]], [[[SERVERNAME]]] traži verifikaciju e-pošte, kliknite na sljedeću vezu da dovršite proces.

-

- Kliknite ovdje da potvrdite svoju e-mail adresu. -

- Ako niste vi inicirali ovaj zahtjev, zanemarite ovu poruku. -
\ No newline at end of file diff --git a/emails/translations/account-check_bs.txt b/emails/translations/account-check_bs.txt deleted file mode 100644 index 5b4ddb0f..00000000 --- a/emails/translations/account-check_bs.txt +++ /dev/null @@ -1,6 +0,0 @@ -[[[SERVERNAME]]] - Potvrda e-pošte -Zdravo [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) vrši verifikaciju e-pošte. Idite na sljedeću vezu da dovršite proces: -~ -~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] -~ -Ako niste vi inicirali ovaj zahtjev, zanemarite ovu poruku. \ No newline at end of file diff --git a/emails/translations/account-check_hu.html b/emails/translations/account-check_hu.html deleted file mode 100644 index ee47a1ca..00000000 --- a/emails/translations/account-check_hu.html +++ /dev/null @@ -1,15 +0,0 @@ -
[[[SERVERNAME]]] - Email megerősítés
-
- - - - -
- [[[SERVERNAME]]] - Megerősítés -
-

Tisztelt [[[USERNAME]]], [[[SERVERNAME]]] e-mail megerősítést kér, kattintson az alábbi linkre a folyamat befejezéséhez.

-

- Kattintson ide az e-mail címének megerősítéséhez. -

- Ha nem Ön kezdeményezte ezt a kérést, kérjük, hagyja figyelmen kívül ezt a levelet. -
\ No newline at end of file diff --git a/emails/translations/account-check_hu.txt b/emails/translations/account-check_hu.txt deleted file mode 100644 index 2e420352..00000000 --- a/emails/translations/account-check_hu.txt +++ /dev/null @@ -1,6 +0,0 @@ -[[[SERVERNAME]]] - Email megerősítés -Tisztelt [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) e-mail ellenőrzést végez. A folyamat befejezéséhez lépjen a következő linkre: -~ -~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] -~ -Ha nem Ön kezdeményezte ezt a kérést, kérjük, hagyja figyelmen kívül ezt a levelet. \ No newline at end of file diff --git a/emails/translations/account-check_n.html b/emails/translations/account-check_n.html new file mode 100644 index 00000000..f65dfd71 --- /dev/null +++ b/emails/translations/account-check_n.html @@ -0,0 +1,15 @@ +
[[[SERVERNAME]]] - Email Verification
+
+ + + + +
+ [[[SERVERNAME]]] - Verification +
+

Hi [[[USERNAME]]], [[[SERVERNAME]]] is requesting email verification, click on the following link to complete the process.

+

+ Click here to verify your e-mail address. +

+ If you did not initiate this request, please ignore this mail. +
\ No newline at end of file diff --git a/emails/translations/account-check_n.txt b/emails/translations/account-check_n.txt new file mode 100644 index 00000000..5ad23547 --- /dev/null +++ b/emails/translations/account-check_n.txt @@ -0,0 +1,6 @@ +[[[SERVERNAME]]] - Email Verification +Hi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) is performing an e-mail verification. Nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] +~ +If you did not initiate this request, please ignore this mail. \ No newline at end of file diff --git a/emails/translations/account-check_nn.html b/emails/translations/account-check_nn.html new file mode 100644 index 00000000..f65dfd71 --- /dev/null +++ b/emails/translations/account-check_nn.html @@ -0,0 +1,15 @@ +
[[[SERVERNAME]]] - Email Verification
+
+ + + + +
+ [[[SERVERNAME]]] - Verification +
+

Hi [[[USERNAME]]], [[[SERVERNAME]]] is requesting email verification, click on the following link to complete the process.

+

+ Click here to verify your e-mail address. +

+ If you did not initiate this request, please ignore this mail. +
\ No newline at end of file diff --git a/emails/translations/account-check_nn.txt b/emails/translations/account-check_nn.txt new file mode 100644 index 00000000..5ad23547 --- /dev/null +++ b/emails/translations/account-check_nn.txt @@ -0,0 +1,6 @@ +[[[SERVERNAME]]] - Email Verification +Hi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) is performing an e-mail verification. Nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] +~ +If you did not initiate this request, please ignore this mail. \ No newline at end of file diff --git a/emails/translations/account-check_pt-br.html b/emails/translations/account-check_pt-br.html index 17802e2e..109ea30f 100644 --- a/emails/translations/account-check_pt-br.html +++ b/emails/translations/account-check_pt-br.html @@ -7,7 +7,7 @@ -

Olá [[[USERNAME]]], [[[SERVERNAME]]] está solicitando verificação de e-mail, clique no link a seguir para concluir o processo.

+

Olá [[[NOME DE USUÁRIO]]], [[[SERVERNAME]]] está solicitando verificação de e-mail, clique no link a seguir para concluir o processo.

Clique aqui para verificar seu endereço de e-mail.

diff --git a/emails/translations/account-check_pt.html b/emails/translations/account-check_pt.html index 0caea85e..fef12eec 100644 --- a/emails/translations/account-check_pt.html +++ b/emails/translations/account-check_pt.html @@ -7,7 +7,7 @@ -

Olá [[[USERNAME]]], [[[SERVERNAME]]] está solicitando verificação de e-mail, clique no link a seguir para concluir o processo.

+

Olá [[[NOME DE USUÁRIO]]], [[[SERVERNAME]]] está solicitando verificação de e-mail, clique no link a seguir para concluir o processo.

Clique aqui para verificar seu endereço de e-mail.

diff --git a/emails/translations/account-check_zh-chs.html b/emails/translations/account-check_zh-chs.html index 49ebb484..ed60e9f1 100644 --- a/emails/translations/account-check_zh-chs.html +++ b/emails/translations/account-check_zh-chs.html @@ -1,15 +1,15 @@ -
[[[SERVERNAME]]] - 邮件验证
+
[[[SERVERNAME]]]-电邮验证
- [[[SERVERNAME]]] - 验证 + [[[SERVERNAME]]]-验证

[[[USERNAME]],你好, [[[SERVERNAME]]] 正在请求电邮验证,请单击以下连结以完成该过程。

- 单击此处以验证您的邮件地址。 + 单击此处以验证您的电邮地址。

- 如果您没有发起此请求,请忽略此邮件。 + 如果您没有发起此请求,请不理此邮件。
\ No newline at end of file diff --git a/emails/translations/account-check_zh-chs.txt b/emails/translations/account-check_zh-chs.txt index 38db4b5b..f8c390d7 100644 --- a/emails/translations/account-check_zh-chs.txt +++ b/emails/translations/account-check_zh-chs.txt @@ -1,6 +1,6 @@ -[[[SERVERNAME]]] - 邮件验证 -嗨[[[USERNAME]]],[[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) 正在执行邮件验证。转到以下链接以完成该过程: +[[[SERVERNAME]]]-电邮验证 +嗨[[[USERNAME]]],[[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) 正在执行电邮验证。导航至以下连结以完成该过程: ~ ~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] ~ -如果您没有发起此请求,请忽略此邮件。 \ No newline at end of file +如果您没有发起此请求,请不理此邮件。 \ No newline at end of file diff --git a/emails/translations/account-check_zh-cht.html b/emails/translations/account-check_zh-cht.html index 4addc99d..4d7020a0 100644 --- a/emails/translations/account-check_zh-cht.html +++ b/emails/translations/account-check_zh-cht.html @@ -1,9 +1,9 @@ -
[[[SERVERNAME]]] - 電郵驗證
+
[[[SERVERNAME]]]-電郵驗證
- [[[SERVERNAME]]] - 驗證 + [[[SERVERNAME]]]-驗證
diff --git a/emails/translations/account-check_zh-cht.txt b/emails/translations/account-check_zh-cht.txt index 9a7cb5f2..4b843330 100644 --- a/emails/translations/account-check_zh-cht.txt +++ b/emails/translations/account-check_zh-cht.txt @@ -1,4 +1,4 @@ -[[[SERVERNAME]]] - 電郵驗證 +[[[SERVERNAME]]]-電郵驗證 嗨[[[USERNAME]]],[[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) 正在執行電郵驗證。導航至以下鏈結以完成該過程: ~ ~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] diff --git a/emails/translations/account-invite_bs.html b/emails/translations/account-invite_bs.html deleted file mode 100644 index 3ff65f37..00000000 --- a/emails/translations/account-invite_bs.html +++ /dev/null @@ -1,19 +0,0 @@ -
[[[SERVERNAME]]] - Pozivnica za račun
-
- - - - -
- [[[SERVERNAME]]] - Pozivnica za račun -
-

Za vas je kreiran nalog na serveru [[[SERVERNAME]]], sada mu možete pristupiti sa:

-

-    Korisničko ime: [[[ACCOUNTNAME]]]
-    Lozinka: [[[PASSWORD]]] -

- Srdačan pozdrav, -
- [[[USERNAME]]] -
-
\ No newline at end of file diff --git a/emails/translations/account-invite_bs.txt b/emails/translations/account-invite_bs.txt deleted file mode 100644 index d2fbb3dc..00000000 --- a/emails/translations/account-invite_bs.txt +++ /dev/null @@ -1,5 +0,0 @@ -[[[SERVERNAME]]] - Pozivnica za račun -Za vas je kreiran račun na serveru [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]), sada mu možete pristupiti sa korisničkim imenom "[[[ACCOUNTNAME]]]" i lozinka "[[[PASSWORD]]]". -~ -Srdačan pozdrav, -~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_cs.txt b/emails/translations/account-invite_cs.txt index 43c4db32..b3f5b64b 100644 --- a/emails/translations/account-invite_cs.txt +++ b/emails/translations/account-invite_cs.txt @@ -1,5 +1,5 @@ [[[SERVERNAME]]] - Pozvánka na účet -Účet pro vás byl vytvořen na serveru [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]), nyní k němu můžete přistupovat pomocí uživatelského jména „[[[ACCOUNTNAME]]]“ “a hesla„ [[[PASSWORD]]] ". +Účet pro vás byl vytvořen na serveru [[[SERVERNAME]]] ([[[[SERVERURL]]]/[[[URLARGS1]]]), nyní k němu můžete přistupovat pomocí uživatelského jména „[[[[ACCOUNTNAME]]]“ “a hesla„ [[[HESLO]] ]] ". ~ S pozdravem, ~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_hu.html b/emails/translations/account-invite_hu.html deleted file mode 100644 index b6151710..00000000 --- a/emails/translations/account-invite_hu.html +++ /dev/null @@ -1,19 +0,0 @@ -
[[[SERVERNAME]]] - Fiók meghívó
-
- - - - -
- [[[SERVERNAME]]] - Fiók meghívó -
-

Létrehozásra került Önnek egy fiók a kiszolgálón [[[SERVERNAME]]], most a következőkkel érheti el:

-

-    Felhasználó név: [[[ACCOUNTNAME]]]
-    Jelszó: [[[PASSWORD]]] -

- Üdvözlettel, -
- [[[USERNAME]]] -
-
\ No newline at end of file diff --git a/emails/translations/account-invite_hu.txt b/emails/translations/account-invite_hu.txt deleted file mode 100644 index 6b85d933..00000000 --- a/emails/translations/account-invite_hu.txt +++ /dev/null @@ -1,5 +0,0 @@ -[[[SERVERNAME]]] - Fiók meghívó -A [[[SERVERNAME]]] szerveren ([[[SERVERURL]]]/[[[URLARGS1]]]) létrehozásra került egy fiókot az Ön számára, amelyhez most már hozzáférhet a "[[[[ACCOUNTNAME]]]" felhasználónévvel és a "[[[[PASSWORD]]]" jelszóval. -~ -Üdvözlettel, -~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_n.html b/emails/translations/account-invite_n.html new file mode 100644 index 00000000..69ac6ebf --- /dev/null +++ b/emails/translations/account-invite_n.html @@ -0,0 +1,19 @@ +
[[[SERVERNAME]]] - Account Invitation
+
+ + + + +
+ [[[SERVERNAME]]] - Account Invitation +
+

An account was created for you on server [[[SERVERNAME]]], you can access it now with:

+

+    Username: [[[ACCOUNTNAME]]]
+    Password: [[[PASSWORD]]] +

+ Best regards, +
+ [[[USERNAME]]] +
+
\ No newline at end of file diff --git a/emails/translations/account-invite_n.txt b/emails/translations/account-invite_n.txt new file mode 100644 index 00000000..bfb0563d --- /dev/null +++ b/emails/translations/account-invite_n.txt @@ -0,0 +1,5 @@ +[[[SERVERNAME]]] - Account Invitation +An account was created for you on server [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]), you can access it now with username "[[[ACCOUNTNAME]]]" and password "[[[PASSWORD]]]". +~ +Best regards, +~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_nn.html b/emails/translations/account-invite_nn.html new file mode 100644 index 00000000..69ac6ebf --- /dev/null +++ b/emails/translations/account-invite_nn.html @@ -0,0 +1,19 @@ +
[[[SERVERNAME]]] - Account Invitation
+
+ + + + +
+ [[[SERVERNAME]]] - Account Invitation +
+

An account was created for you on server [[[SERVERNAME]]], you can access it now with:

+

+    Username: [[[ACCOUNTNAME]]]
+    Password: [[[PASSWORD]]] +

+ Best regards, +
+ [[[USERNAME]]] +
+
\ No newline at end of file diff --git a/emails/translations/account-invite_nn.txt b/emails/translations/account-invite_nn.txt new file mode 100644 index 00000000..bfb0563d --- /dev/null +++ b/emails/translations/account-invite_nn.txt @@ -0,0 +1,5 @@ +[[[SERVERNAME]]] - Account Invitation +An account was created for you on server [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]), you can access it now with username "[[[ACCOUNTNAME]]]" and password "[[[PASSWORD]]]". +~ +Best regards, +~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_pt.html b/emails/translations/account-invite_pt.html index d804ac67..84d3e9e8 100644 --- a/emails/translations/account-invite_pt.html +++ b/emails/translations/account-invite_pt.html @@ -7,7 +7,7 @@ -

Uma conta foi criada para você no servidor [[[SERVERNAME]]], pode aceder agora com:

+

Uma conta foi criada para você no servidor [[[SERVERNAME]]], você pode acessá-lo agora com:

   Nome de usuário: [[[ACCOUNTNAME]]]
   Senha: [[[PASSWORD]]] diff --git a/emails/translations/account-invite_ru.txt b/emails/translations/account-invite_ru.txt index b9814a02..b3a9721d 100644 --- a/emails/translations/account-invite_ru.txt +++ b/emails/translations/account-invite_ru.txt @@ -1,5 +1,5 @@ [[[SERVERNAME]]] - приглашение в аккаунт -Для вас на сервере [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]) была создана учетная запись, теперь вы можете получить к ней доступ с именем пользователя «[[[ACCOUNTNAME]]]» и паролем «[[[PASSWORD]]]". +Для вас на сервере [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]) была создана учетная запись, теперь вы можете получить к ней доступ с именем пользователя «[[[ACCOUNTNAME]]]» и паролем «[[[PASSWORD] ]] ". ~ С уважением, ~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_sv.txt b/emails/translations/account-invite_sv.txt index e95330d9..28543e9e 100644 --- a/emails/translations/account-invite_sv.txt +++ b/emails/translations/account-invite_sv.txt @@ -1,5 +1,5 @@ [[[SERVERNAME]]] - Kontoinbjudan -Ett konto skapades åt dig på servern [[[SERVERNAME]]] ([[[SERVERURL]]] / [[[URLARGS1]]], du kan komma åt det nu med användarnamnet "[[[ACCOUNTNAME]]]" och lösenord "[[[PASSWORD]]]". +Ett konto skapades åt dig på servern [[[SERVERNAME]]] ([[[SERVERURL]]] / [[[URLARGS1]]], du kan komma åt det nu med användarnamnet "[[[ACCOUNTNAME]]]" och lösenord "[[[LÖSENORD]]]". ~ Vänliga hälsningar, ~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_zh-chs.html b/emails/translations/account-invite_zh-chs.html index 256c34e4..935828db 100644 --- a/emails/translations/account-invite_zh-chs.html +++ b/emails/translations/account-invite_zh-chs.html @@ -1,9 +1,9 @@ -

[[[SERVERNAME]]] - 帐户邀请
+
[[[SERVERNAME]]]-帐户邀请
- [[[SERVERNAME]]] - 帐户邀请 + [[[SERVERNAME]]]-帐户邀请
diff --git a/emails/translations/account-invite_zh-chs.txt b/emails/translations/account-invite_zh-chs.txt index 89ea6e62..61bac8b0 100644 --- a/emails/translations/account-invite_zh-chs.txt +++ b/emails/translations/account-invite_zh-chs.txt @@ -1,5 +1,5 @@ -[[[SERVERNAME]]] - 帐户邀请 -已在服务器[[[SERVERNAME]]]([[[SERVERURL]]]/[[[URLARGS1]]])上为您创建了一个帐户,您现在可以使用用户名“ [[[ACCOUNTNAME]]]”和密码“ [[[PASSWORD]]]”。 +[[[SERVERNAME]]]-帐户邀请 +已在服务器[[[SERVERNAME]]]([[[SERVERURL]]]/[[[URLARGS1]]])上为您创建了一个帐户,您现在可以使用用户名“ [[[ACCOUNTNAME]]]”和密码“ [[[PASSWORD] ]]”。 ~ 最好的祝福, ~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-invite_zh-cht.html b/emails/translations/account-invite_zh-cht.html index 3b7f71c6..9bbd3294 100644 --- a/emails/translations/account-invite_zh-cht.html +++ b/emails/translations/account-invite_zh-cht.html @@ -1,9 +1,9 @@ -
[[[SERVERNAME]]] - 帳戶邀請
+
[[[SERVERNAME]]]-帳戶邀請
- [[[SERVERNAME]]] - 帳戶邀請 + [[[SERVERNAME]]]-帳戶邀請
diff --git a/emails/translations/account-invite_zh-cht.txt b/emails/translations/account-invite_zh-cht.txt index 5af11274..1ea2736a 100644 --- a/emails/translations/account-invite_zh-cht.txt +++ b/emails/translations/account-invite_zh-cht.txt @@ -1,5 +1,5 @@ -[[[SERVERNAME]]] - 帳戶邀請 -在伺服器[[[SERVERNAME]]]([[[SERVERURL]]]/[[[URLARGS1]]])上為你創建了一個帳戶,你現在可以使用用戶名“ [[[ACCOUNTNAME]]]”和密碼“ [[[PASSWORD]]]”。 +[[[SERVERNAME]]]-帳戶邀請 +在伺服器[[[SERVERNAME]]]([[[SERVERURL]]]/[[[URLARGS1]]])上為你創建了一個帳戶,你現在可以使用用戶名“ [[[ACCOUNTNAME]]]”和密碼“ [[[PASSWORD] ]]”。 ~ 最好的祝福, ~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/account-login_bs.txt b/emails/translations/account-login_bs.txt deleted file mode 100644 index 5d3ae8a8..00000000 --- a/emails/translations/account-login_bs.txt +++ /dev/null @@ -1,4 +0,0 @@ -[[[SERVERNAME]]] - Prijava na račun -Vaš token za prijavu je: [[[TOKEN]]] -~ -Ovaj token se može koristiti samo jednom i vrijedi 5 minuta. \ No newline at end of file diff --git a/emails/translations/account-login_de.html b/emails/translations/account-login_de.html index 9047666c..da766021 100644 --- a/emails/translations/account-login_de.html +++ b/emails/translations/account-login_de.html @@ -7,6 +7,6 @@ -

Ihr Anmelde-Token lautet: [[[TOKEN]]]

+

Ihr Login-Token lautet: [[[TOKEN]]]

Dieser Token kann nur einmal verwendet werden und ist 5 Minuten gültig.

\ No newline at end of file diff --git a/emails/translations/account-login_de.txt b/emails/translations/account-login_de.txt index 0f97eb94..0208acd6 100644 --- a/emails/translations/account-login_de.txt +++ b/emails/translations/account-login_de.txt @@ -1,4 +1,4 @@ [[[SERVERNAME]]] - Konto-Login -Ihr Anmelde-Token lautet: [[[TOKEN]]] +Ihr Login-Token lautet: [[[TOKEN]]] ~ Dieser Token kann nur einmal verwendet werden und ist 5 Minuten gültig. \ No newline at end of file diff --git a/emails/translations/account-login_hu.txt b/emails/translations/account-login_hu.txt deleted file mode 100644 index 0b104a09..00000000 --- a/emails/translations/account-login_hu.txt +++ /dev/null @@ -1,4 +0,0 @@ -[[[SERVERNAME]]] - Bejelentkezés a fiókba -Az Ön bejelentkezési tokenje: [[[TOKEN]]] -~ -Ez a token csak egyszer használható, és 5 percig érvényes. \ No newline at end of file diff --git a/emails/translations/account-login_bs.html b/emails/translations/account-login_n.html similarity index 55% rename from emails/translations/account-login_bs.html rename to emails/translations/account-login_n.html index 0a65c8e7..a218cade 100644 --- a/emails/translations/account-login_bs.html +++ b/emails/translations/account-login_n.html @@ -1,12 +1,12 @@ -
[[[SERVERNAME]]] - Prijava na račun
+
[[[SERVERNAME]]] - Account Login
- [[[SERVERNAME]]] - Prijava na račun + [[[SERVERNAME]]] - Account Login
-

Vaš token za prijavu je: [[[TOKEN]]]

-

Ovaj token se može koristiti samo jednom i vrijedi 5 minuta.

+

Your login token is: [[[TOKEN]]]

+

This token can only be used once and is valid for 5 minutes.

\ No newline at end of file diff --git a/emails/translations/account-login_n.txt b/emails/translations/account-login_n.txt new file mode 100644 index 00000000..5cf6151e --- /dev/null +++ b/emails/translations/account-login_n.txt @@ -0,0 +1,4 @@ +[[[SERVERNAME]]] - Account Login +Your login token is: [[[TOKEN]]] +~ +This token can only be used once and is valid for 5 minutes. \ No newline at end of file diff --git a/emails/translations/account-login_hu.html b/emails/translations/account-login_nn.html similarity index 53% rename from emails/translations/account-login_hu.html rename to emails/translations/account-login_nn.html index e8c93ae3..a218cade 100644 --- a/emails/translations/account-login_hu.html +++ b/emails/translations/account-login_nn.html @@ -1,12 +1,12 @@ -
[[[SERVERNAME]]] - Bejelentkezés a fiókba
+
[[[SERVERNAME]]] - Account Login
- [[[SERVERNAME]]] - Bejelentkezés a fiókba + [[[SERVERNAME]]] - Account Login
-

Az Ön bejelentkezési tokenje: [[[TOKEN]]]

-

Ez a token csak egyszer használható, és 5 percig érvényes.

+

Your login token is: [[[TOKEN]]]

+

This token can only be used once and is valid for 5 minutes.

\ No newline at end of file diff --git a/emails/translations/account-login_nn.txt b/emails/translations/account-login_nn.txt new file mode 100644 index 00000000..5cf6151e --- /dev/null +++ b/emails/translations/account-login_nn.txt @@ -0,0 +1,4 @@ +[[[SERVERNAME]]] - Account Login +Your login token is: [[[TOKEN]]] +~ +This token can only be used once and is valid for 5 minutes. \ No newline at end of file diff --git a/emails/translations/account-login_zh-chs.html b/emails/translations/account-login_zh-chs.html index 82d896ce..f71018c9 100644 --- a/emails/translations/account-login_zh-chs.html +++ b/emails/translations/account-login_zh-chs.html @@ -1,9 +1,9 @@ -
[[[SERVERNAME]]] - 帐户登录
+
[[[SERVERNAME]]]-帐户登录
- [[[SERVERNAME]]] - 帐户登录 + [[[SERVERNAME]]]-帐户登录
diff --git a/emails/translations/account-login_zh-chs.txt b/emails/translations/account-login_zh-chs.txt index 2dc58cb4..0f26ce3d 100644 --- a/emails/translations/account-login_zh-chs.txt +++ b/emails/translations/account-login_zh-chs.txt @@ -1,4 +1,4 @@ -[[[SERVERNAME]]] - 帐户登录 +[[[SERVERNAME]]]-帐户登录 您的登录保安编码为:[[[TOKEN]]] ~ 此保安编码只能使用一次,有效期为5分钟。 \ No newline at end of file diff --git a/emails/translations/account-login_zh-cht.html b/emails/translations/account-login_zh-cht.html index 876e41d4..30baa6cb 100644 --- a/emails/translations/account-login_zh-cht.html +++ b/emails/translations/account-login_zh-cht.html @@ -1,9 +1,9 @@ -
[[[SERVERNAME]]] - 帳戶登入
+
[[[SERVERNAME]]]-帳戶登入
- [[[SERVERNAME]]] - 帳戶登入 + [[[SERVERNAME]]]-帳戶登入
diff --git a/emails/translations/account-login_zh-cht.txt b/emails/translations/account-login_zh-cht.txt index adeb97dd..18c401c0 100644 --- a/emails/translations/account-login_zh-cht.txt +++ b/emails/translations/account-login_zh-cht.txt @@ -1,4 +1,4 @@ -[[[SERVERNAME]]] - 帳戶登入 +[[[SERVERNAME]]]-帳戶登入 你的登入保安編碼為:[[[TOKEN]]] ~ 該保安編碼只能使用一次,有效期為5分鐘。 \ No newline at end of file diff --git a/emails/translations/account-reset_bs.html b/emails/translations/account-reset_bs.html deleted file mode 100644 index 36138d24..00000000 --- a/emails/translations/account-reset_bs.html +++ /dev/null @@ -1,15 +0,0 @@ -
[[[SERVERNAME]]] - Resetiranje računa
-
- - - - -
- [[[SERVERNAME]]] - Potvrda -
-

Zdravo [[[USERNAME]]], [[[SERVERNAME]]] traži resetiranje lozinke računa, kliknite na sljedeću vezu da dovršite proces.

-

- Kliknite ovdje da poništite lozinku za svoj račun. -

- Ako niste vi inicirali ovaj zahtjev, zanemarite ovu poruku. -
\ No newline at end of file diff --git a/emails/translations/account-reset_bs.txt b/emails/translations/account-reset_bs.txt deleted file mode 100644 index fe99cfa6..00000000 --- a/emails/translations/account-reset_bs.txt +++ /dev/null @@ -1,6 +0,0 @@ -[[[SERVERNAME]]] - Resetiranje računa -Zdravo [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) traži reset lozinke naloga. Idite na sljedeću vezu da dovršite proces: -~ -~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] -~ -Ako niste vi inicirali ovaj zahtjev, zanemarite ovu poruku. \ No newline at end of file diff --git a/emails/translations/account-reset_hu.html b/emails/translations/account-reset_hu.html deleted file mode 100644 index 4d8247d9..00000000 --- a/emails/translations/account-reset_hu.html +++ /dev/null @@ -1,15 +0,0 @@ -
[[[SERVERNAME]]] - Fiók visszaállítás
-
- - - - -
- [[[SERVERNAME]]] - Megerősítés -
-

Tisztelt [[[USERNAME]]], [[[SERVERNAME]]] fiókhoz tartozó jelszó visszaállítási igényt kapott, kattintson a következő linkre a folyamat befejezéséhez.

-

- Kattintson ide fiókja jelszaváknak visszaállításához. -

- Ha nem Ön kezdeményezte ezt a kérést, kérjük, hagyja figyelmen kívül ezt a levelet. -
\ No newline at end of file diff --git a/emails/translations/account-reset_hu.txt b/emails/translations/account-reset_hu.txt deleted file mode 100644 index 39f76c76..00000000 --- a/emails/translations/account-reset_hu.txt +++ /dev/null @@ -1,6 +0,0 @@ -[[[SERVERNAME]]] - Fiók visszaállítás -Tisztelt [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) a fiók jelszavának visszaállítását kéri. A folyamat befejezéséhez lépjen a következő linkre: -~ -~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] -~ -Ha nem Ön kezdeményezte ezt a kérést, kérjük, hagyja figyelmen kívül ezt a levelet. \ No newline at end of file diff --git a/emails/translations/account-reset_n.html b/emails/translations/account-reset_n.html new file mode 100644 index 00000000..414d33f8 --- /dev/null +++ b/emails/translations/account-reset_n.html @@ -0,0 +1,15 @@ +
[[[SERVERNAME]]] - Account Reset
+
+ + + + +
+ [[[SERVERNAME]]] - Verification +
+

Hi [[[USERNAME]]], [[[SERVERNAME]]] is requesting an account password reset, click on the following link to complete the process.

+

+ Click here to reset your account password. +

+ If you did not initiate this request, please ignore this mail. +
\ No newline at end of file diff --git a/emails/translations/account-reset_n.txt b/emails/translations/account-reset_n.txt new file mode 100644 index 00000000..44f02b30 --- /dev/null +++ b/emails/translations/account-reset_n.txt @@ -0,0 +1,6 @@ +[[[SERVERNAME]]] - Account Reset +Hi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) is requesting an account password reset. Nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] +~ +If you did not initiate this request, please ignore this mail. \ No newline at end of file diff --git a/emails/translations/account-reset_nn.html b/emails/translations/account-reset_nn.html new file mode 100644 index 00000000..414d33f8 --- /dev/null +++ b/emails/translations/account-reset_nn.html @@ -0,0 +1,15 @@ +
[[[SERVERNAME]]] - Account Reset
+
+ + + + +
+ [[[SERVERNAME]]] - Verification +
+

Hi [[[USERNAME]]], [[[SERVERNAME]]] is requesting an account password reset, click on the following link to complete the process.

+

+ Click here to reset your account password. +

+ If you did not initiate this request, please ignore this mail. +
\ No newline at end of file diff --git a/emails/translations/account-reset_nn.txt b/emails/translations/account-reset_nn.txt new file mode 100644 index 00000000..44f02b30 --- /dev/null +++ b/emails/translations/account-reset_nn.txt @@ -0,0 +1,6 @@ +[[[SERVERNAME]]] - Account Reset +Hi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]][[[URLARGS1]]]) is requesting an account password reset. Nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] +~ +If you did not initiate this request, please ignore this mail. \ No newline at end of file diff --git a/emails/translations/account-reset_pt-br.html b/emails/translations/account-reset_pt-br.html index 78408653..c790c845 100644 --- a/emails/translations/account-reset_pt-br.html +++ b/emails/translations/account-reset_pt-br.html @@ -7,7 +7,7 @@ -

Olá [[[USERNAME]]], [[[SERVERNAME]]] está solicitando a redefinição da senha da conta, clique no link a seguir para concluir o processo.

+

Olá [[[NOME DE USUÁRIO]]], [[[SERVERNAME]]] está solicitando a redefinição da senha da conta, clique no link a seguir para concluir o processo.

Clique aqui para redefinir a senha da sua conta.

diff --git a/emails/translations/account-reset_pt.html b/emails/translations/account-reset_pt.html index 78408653..c790c845 100644 --- a/emails/translations/account-reset_pt.html +++ b/emails/translations/account-reset_pt.html @@ -7,7 +7,7 @@ -

Olá [[[USERNAME]]], [[[SERVERNAME]]] está solicitando a redefinição da senha da conta, clique no link a seguir para concluir o processo.

+

Olá [[[NOME DE USUÁRIO]]], [[[SERVERNAME]]] está solicitando a redefinição da senha da conta, clique no link a seguir para concluir o processo.

Clique aqui para redefinir a senha da sua conta.

diff --git a/emails/translations/account-reset_zh-chs.html b/emails/translations/account-reset_zh-chs.html index 824250dd..eb2e88eb 100644 --- a/emails/translations/account-reset_zh-chs.html +++ b/emails/translations/account-reset_zh-chs.html @@ -3,7 +3,7 @@
- [[[SERVERNAME]]] - 验证 + [[[SERVERNAME]]]-验证
@@ -11,5 +11,5 @@

单击此处重置您的帐户密码。

- 如果您没有发起此请求,请忽略此邮件。 + 如果您没有发起此请求,请不理此邮件。
\ No newline at end of file diff --git a/emails/translations/account-reset_zh-chs.txt b/emails/translations/account-reset_zh-chs.txt index 8f1e1cb9..97e9a2b7 100644 --- a/emails/translations/account-reset_zh-chs.txt +++ b/emails/translations/account-reset_zh-chs.txt @@ -3,4 +3,4 @@ ~ ~[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]][[[URLARGS2]]] ~ -如果您没有发起此请求,请忽略此邮件。 \ No newline at end of file +如果您没有发起此请求,请不理此邮件。 \ No newline at end of file diff --git a/emails/translations/account-reset_zh-cht.html b/emails/translations/account-reset_zh-cht.html index d31e2ad3..7e4aa9fa 100644 --- a/emails/translations/account-reset_zh-cht.html +++ b/emails/translations/account-reset_zh-cht.html @@ -3,7 +3,7 @@
- [[[SERVERNAME]]] - 驗證 + [[[SERVERNAME]]]-驗證
diff --git a/emails/translations/device-help_bs.html b/emails/translations/device-help_bs.html deleted file mode 100644 index 3c4ee388..00000000 --- a/emails/translations/device-help_bs.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Zahtjev za pomoć
-
- - - - -
- [[[SERVERNAME]]] - Zahtjev za pomoć -
-

- uređaj "[[[NAZIV UREĐAJA]]]“ zatražio pomoć. -

-

- Korisnik: [[[IME POMOĆI]]]
- Zahtjev: [[[UPIT ZA POMOĆ]]] -

-

- kliknite ovdje za navigaciju do ovog uređaja. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_bs.txt b/emails/translations/device-help_bs.txt deleted file mode 100644 index d060d62b..00000000 --- a/emails/translations/device-help_bs.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Zahtjev za pomoć uređaja -Uređaj "[[[DEVICENAME]]]" je zatražio pomoć. - -Korisnik: "[[[IME POMOĆI]]]" -Zahtjev: "[[[UPIT ZA POMOĆ]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_cs.html b/emails/translations/device-help_cs.html deleted file mode 100644 index ca6f8ed6..00000000 --- a/emails/translations/device-help_cs.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" požádal o pomoc. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- klikněte zde to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_cs.txt b/emails/translations/device-help_cs.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_cs.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_da.html b/emails/translations/device-help_da.html deleted file mode 100644 index d152a334..00000000 --- a/emails/translations/device-help_da.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- Klik her to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_da.txt b/emails/translations/device-help_da.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_da.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_de.html b/emails/translations/device-help_de.html deleted file mode 100644 index 7e01917a..00000000 --- a/emails/translations/device-help_de.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Gerät "[[[DEVICENAME]]]" requested help. -

-

- Benutzer: [[[HELPUSERNAME]]]
- Anforderung: [[[HELPREQUEST]]] -

-

- hier klicken um zu diesem Gerät zu navigieren. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_de.txt b/emails/translations/device-help_de.txt deleted file mode 100644 index 849df051..00000000 --- a/emails/translations/device-help_de.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Gerät "[[[DEVICENAME]]]" hat Unterstützung angefordert. - -Benutzer: "[[[HELPUSERNAME]]]" -Anforderung: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_es.html b/emails/translations/device-help_es.html deleted file mode 100644 index beafbccf..00000000 --- a/emails/translations/device-help_es.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Solicitud de Ayuda
-
- - - - -
- [[[SERVERNAME]]] - Solicitud de Ayuda -
-

- Dispositivo "[[[DEVICENAME]]]" ha pedido ayuda. -

-

- Usuario: [[[HELPUSERNAME]]]
- Solicitud: [[[HELPREQUEST]]] -

-

- haz clic aquí para navegar a este dispositivo. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_es.txt b/emails/translations/device-help_es.txt deleted file mode 100644 index 3dc02cc3..00000000 --- a/emails/translations/device-help_es.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Solicitud de ayuda con el Dispositivo -Dispositivo "[[[DEVICENAME]]]" solicito asistencia. - -Usuario: "[[[HELPUSERNAME]]]" -Solicitud: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_fi.html b/emails/translations/device-help_fi.html deleted file mode 100644 index 1dd46aaf..00000000 --- a/emails/translations/device-help_fi.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- klikkaa tästä to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_fi.txt b/emails/translations/device-help_fi.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_fi.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_fr.html b/emails/translations/device-help_fr.html deleted file mode 100644 index 745639b3..00000000 --- a/emails/translations/device-help_fr.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Demande d'assistance
-
- - - - -
- [[[SERVERNAME]]] - Demande d'assistance -
-

- Appareil "[[[DEVICENAME]]]" assistance demandée. -

-

- Utilisateur : [[[HELPUSERNAME]]]
- Demande : [[[HELPREQUEST]]] -

-

- cliquez ici pour naviguer vers cet appareil. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_fr.txt b/emails/translations/device-help_fr.txt deleted file mode 100644 index 8c08fe7a..00000000 --- a/emails/translations/device-help_fr.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Demande d'assistance sur l'appareil -Une assistance est demandée par l'appareil "[[[DEVICENAME]]]" - -Utilistateur : "[[[HELPUSERNAME]]]" -Demande : "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_hi.html b/emails/translations/device-help_hi.html deleted file mode 100644 index c5c0a18e..00000000 --- a/emails/translations/device-help_hi.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- यहाँ क्लिक करें to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_hi.txt b/emails/translations/device-help_hi.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_hi.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_hu.html b/emails/translations/device-help_hu.html deleted file mode 100644 index 75f8cb32..00000000 --- a/emails/translations/device-help_hu.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Segítség kérés
-
- - - - -
- [[[SERVERNAME]]] - Segítség kérés -
-

- Eszköz "[[[DEVICENAME]]]" segítséget kért. -

-

- Felhsználó: [[[HELPUSERNAME]]]
- Segítségkérés: [[[HELPREQUEST]]] -

-

- Kattintson ide az eszközhöz való navigáláshoz. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_hu.txt b/emails/translations/device-help_hu.txt deleted file mode 100644 index 4dcc6a94..00000000 --- a/emails/translations/device-help_hu.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Segítség kérés -A "[[[DEVICENAME]]]" eszköz segítséget kért. - -Felhasználó: "[[[HELPUSERNAME]]]" -Segítség kérés: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_it.html b/emails/translations/device-help_it.html deleted file mode 100644 index 812e9607..00000000 --- a/emails/translations/device-help_it.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- clicca qui to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_it.txt b/emails/translations/device-help_it.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_it.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_ja.html b/emails/translations/device-help_ja.html deleted file mode 100644 index 42e39cba..00000000 --- a/emails/translations/device-help_ja.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- ここをクリック to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_ja.txt b/emails/translations/device-help_ja.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_ja.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_ko.html b/emails/translations/device-help_ko.html deleted file mode 100644 index 37356e43..00000000 --- a/emails/translations/device-help_ko.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- 여기를 클릭하십시오. to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_ko.txt b/emails/translations/device-help_ko.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_ko.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_nl.html b/emails/translations/device-help_nl.html deleted file mode 100644 index 1f0f6596..00000000 --- a/emails/translations/device-help_nl.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Verzoek om hulp
-
- - - - -
- [[[SERVERNAME]]] - Verzoek om hulp -
-

- Apparaat "[[[DEVICENAME]]]" vraagt om hulp. -

-

- Gebruiker: [[[HELPUSERNAME]]]
- Verzoek: [[[HELPREQUEST]]] -

-

- Klik hier naar dit apparaat navigeren. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_nl.txt b/emails/translations/device-help_nl.txt deleted file mode 100644 index 7a592968..00000000 --- a/emails/translations/device-help_nl.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Een verzoek om het apparaat te helpen -Apparaat "[[[DEVICENAME]]]" heeft assistentie gevraagd - -Gebruiker: "[[[HELPUSERNAME]]]" -Verzoek: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_pl.html b/emails/translations/device-help_pl.html deleted file mode 100644 index b94b193d..00000000 --- a/emails/translations/device-help_pl.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Prośba Pomocy
-
- - - - -
- [[[SERVERNAME]]] - Prośba Pomocy -
-

- Urządzenie "[[[DEVICENAME]]]" prosi o pomoc. -

-

- Użytkownik: [[[HELPUSERNAME]]]
- Prośba: [[[HELPREQUEST]]] -

-

- kliknij tutaj by nawigować do tego urządzenia. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_pl.txt b/emails/translations/device-help_pl.txt deleted file mode 100644 index 1b6b5a97..00000000 --- a/emails/translations/device-help_pl.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Prośba Pomocy Urządzenia -Urządzenie "[[[DEVICENAME]]]" prosiło o pomoc. - -Użytkownik: "[[[HELPUSERNAME]]]" -Prośba: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_pt-br.html b/emails/translations/device-help_pt-br.html deleted file mode 100644 index b77b5794..00000000 --- a/emails/translations/device-help_pt-br.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- Clique aqui to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_pt-br.txt b/emails/translations/device-help_pt-br.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_pt-br.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_pt.html b/emails/translations/device-help_pt.html deleted file mode 100644 index b77b5794..00000000 --- a/emails/translations/device-help_pt.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- Clique aqui to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_pt.txt b/emails/translations/device-help_pt.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_pt.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_ru.html b/emails/translations/device-help_ru.html deleted file mode 100644 index 19986fa8..00000000 --- a/emails/translations/device-help_ru.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- кликните сюда to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_ru.txt b/emails/translations/device-help_ru.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_ru.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_sv.html b/emails/translations/device-help_sv.html deleted file mode 100644 index 8423ff37..00000000 --- a/emails/translations/device-help_sv.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- Klicka här to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_sv.txt b/emails/translations/device-help_sv.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_sv.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_tr.html b/emails/translations/device-help_tr.html deleted file mode 100644 index 2844ba28..00000000 --- a/emails/translations/device-help_tr.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- buraya Tıkla to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_tr.txt b/emails/translations/device-help_tr.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_tr.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_zh-chs.html b/emails/translations/device-help_zh-chs.html deleted file mode 100644 index 2f13132c..00000000 --- a/emails/translations/device-help_zh-chs.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- 点击这里 to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_zh-chs.txt b/emails/translations/device-help_zh-chs.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_zh-chs.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-help_zh-cht.html b/emails/translations/device-help_zh-cht.html deleted file mode 100644 index 52d6e990..00000000 --- a/emails/translations/device-help_zh-cht.html +++ /dev/null @@ -1,20 +0,0 @@ -
[[[SERVERNAME]]] - "[[[DEVICENAME]]]" Help Request
-
- - - - -
- [[[SERVERNAME]]] - Help Request -
-

- Device "[[[DEVICENAME]]]" requested help. -

-

- User: [[[HELPUSERNAME]]]
- Request: [[[HELPREQUEST]]] -

-

- 點擊這裡 to navigate to this device. -

-
\ No newline at end of file diff --git a/emails/translations/device-help_zh-cht.txt b/emails/translations/device-help_zh-cht.txt deleted file mode 100644 index c2b3c09f..00000000 --- a/emails/translations/device-help_zh-cht.txt +++ /dev/null @@ -1,7 +0,0 @@ -[[[SERVERNAME]]] - Device Help Request -Device "[[[DEVICENAME]]]" requested assistance. - -User: "[[[HELPUSERNAME]]]" -Request: "[[[HELPREQUEST]]]" - -[[[SERVERURL]]]?viewmode=10&gotonode=[[[NODEID]]] \ No newline at end of file diff --git a/emails/translations/device-notify_bs.html b/emails/translations/device-notify_bs.html deleted file mode 100644 index c0b6ecd8..00000000 --- a/emails/translations/device-notify_bs.html +++ /dev/null @@ -1,36 +0,0 @@ -
[[[SERVERNAME]]] - Obavještenje uređaja
-
- - - - -
- [[[SERVERNAME]]] - Obavještenje uređaja -
- -

- Sljedeći uređaji su promijenili stanje veze. -

-
- -

- Povezani uređaji: -

-

-[[[VEZE]]] -

-
- -

- Isključeni uređaji: -

-

-[[[PREKIDI]]] -

-
- -

- Da odjavite pretplatu, kliknite ovdje u roku od 1 sata od prijema ove poruke. -

-
-
\ No newline at end of file diff --git a/emails/translations/device-notify_bs.txt b/emails/translations/device-notify_bs.txt deleted file mode 100644 index ff3ba7e9..00000000 --- a/emails/translations/device-notify_bs.txt +++ /dev/null @@ -1,22 +0,0 @@ -[[[SERVERNAME]]] - Obavještenje uređaja -~ -Sljedeći uređaji su promijenili stanje veze. -~ -~ -~ -Povezani uređaji: -~ -~[[[CONNECTIONS]]] -~ -~ -~ -~ -Isključeni uređaji: -~ -~[[[DISCONNECTIONS]]] -~ -~ -~ - -Da odjavite pretplatu, učitajte ovaj link u roku od 1 sata od prijema ove poruke: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] -~ \ No newline at end of file diff --git a/emails/translations/device-notify_cs.html b/emails/translations/device-notify_cs.html index 37b8536e..9bebac77 100644 --- a/emails/translations/device-notify_cs.html +++ b/emails/translations/device-notify_cs.html @@ -1,9 +1,9 @@ -
[[[SERVERNAME]]] - Oznámení zařízení
+
[[[SERVERNAME]]] – Oznámení zařízení
- [[[SERVERNAME]]] - Oznámení zařízení + [[[SERVERNAME]]] – Oznámení zařízení
diff --git a/emails/translations/device-notify_cs.txt b/emails/translations/device-notify_cs.txt index fad0096b..29d28676 100644 --- a/emails/translations/device-notify_cs.txt +++ b/emails/translations/device-notify_cs.txt @@ -1,4 +1,4 @@ -[[[SERVERNAME]]] - Oznámení zařízení +[[[SERVERNAME]]] – Oznámení zařízení ~ Následující zařízení změnila svůj stav připojení. ~ diff --git a/emails/translations/device-notify_hu.txt b/emails/translations/device-notify_hu.txt deleted file mode 100644 index d025d6a0..00000000 --- a/emails/translations/device-notify_hu.txt +++ /dev/null @@ -1,22 +0,0 @@ -[[[SERVERNAME]]] - Eszköz értesítés -~ -A következő eszközök kapcsolati állapota megváltozott. -~ -~ -~ -Csatlakozott eszközök: -~ -~[[[CONNECTIONS]]] -~ -~ -~ -~ -Lecsatlakozott eszközök: -~ -~[[[DISCONNECTIONS]]] -~ -~ -~ - -A leiratkozáshoz lépjen erre a linkre az üzenet kézhezvételétől számított 1 órán belül: [[[SERVERURL]]][[UNSUBSCRIBELINK]]] -~ \ No newline at end of file diff --git a/emails/translations/device-notify_it.html b/emails/translations/device-notify_it.html index d182ab6f..f9fb3a6c 100644 --- a/emails/translations/device-notify_it.html +++ b/emails/translations/device-notify_it.html @@ -25,7 +25,7 @@ Dispositivi disconnessi:

-[[[DISCONNECTIONS]]] +[[[DISCONNESSIONI]]]

diff --git a/emails/translations/device-notify_ko.html b/emails/translations/device-notify_ko.html index e397277c..e74be455 100644 --- a/emails/translations/device-notify_ko.html +++ b/emails/translations/device-notify_ko.html @@ -1,20 +1,20 @@ -
[[[SERVERNAME]]] - 기기 알림
+
[[[SERVERNAME]]] - Device Notification
- [[[SERVERNAME]]] - 기기 알림 + [[[SERVERNAME]]] - Device Notification

- 다음 장치의 연결 상태가 변경되었습니다. + The following devices have changed their connection state.

- 연결된 장치: + Connected devices:

[[[CONNECTIONS]]] @@ -22,7 +22,7 @@

- 연결 해제된 장치: + Disconnected devices:

[[[DISCONNECTIONS]]] @@ -30,7 +30,7 @@

- 구독을 취소하려면 여기를 클릭하십시오. 이 메시지를 받은 후 1시간 이내에 + To unsubscribe, 여기를 클릭하십시오. within 1 hour of getting this message.

\ No newline at end of file diff --git a/emails/translations/device-notify_ko.txt b/emails/translations/device-notify_ko.txt index ebcba9b4..ed4a6ac5 100644 --- a/emails/translations/device-notify_ko.txt +++ b/emails/translations/device-notify_ko.txt @@ -1,22 +1,22 @@ -[[[SERVERNAME]]] - 기기 알림 +[[[SERVERNAME]]] - Device Notification ~ -다음 장치의 연결 상태가 변경되었습니다. +The following devices have changed their connection state. ~ ~ ~ -연결된 장치: +Connected devices: ~ ~[[[CONNECTIONS]]] ~ ~ ~ ~ -연결 해제된 장치: +Disconnected devices: ~ ~[[[DISCONNECTIONS]]] ~ ~ ~ -구독을 취소하려면 다음 메시지를 받은 후 1시간 이내에 다음 링크를 로드하세요. [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] ~ \ No newline at end of file diff --git a/emails/translations/device-notify_hu.html b/emails/translations/device-notify_nn.html similarity index 60% rename from emails/translations/device-notify_hu.html rename to emails/translations/device-notify_nn.html index 556ec224..4353cb01 100644 --- a/emails/translations/device-notify_hu.html +++ b/emails/translations/device-notify_nn.html @@ -1,20 +1,20 @@ -
[[[SERVERNAME]]] - Eszköz értesítés
+
[[[SERVERNAME]]] - Device Notification
- [[[SERVERNAME]]] - Eszköz értesítés + [[[SERVERNAME]]] - Device Notification

- A következő eszközök kapcsolati állapota megváltozott. + The following devices have changed their connection state.

- Csatlakozott eszközök: + Connected devices:

[[[CONNECTIONS]]] @@ -22,7 +22,7 @@

- Lecsatlakozott eszközök: + Disconnected devices:

[[[DISCONNECTIONS]]] @@ -30,7 +30,7 @@

- A leiratkozáshoz, Kattintson ide az üzenet kézhezvételétől számított 1 órán belül. + To unsubscribe, click here within 1 hour of getting this message.

\ No newline at end of file diff --git a/emails/translations/device-notify_nn.txt b/emails/translations/device-notify_nn.txt new file mode 100644 index 00000000..ed4a6ac5 --- /dev/null +++ b/emails/translations/device-notify_nn.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The following devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_pt.html b/emails/translations/device-notify_pt.html index 0e50ce6a..959ad77a 100644 --- a/emails/translations/device-notify_pt.html +++ b/emails/translations/device-notify_pt.html @@ -1,20 +1,20 @@ -
[[[SERVERNAME]]] - Notificação do dispositivo
+
[[[SERVERNAME]]] - Device Notification
- [[[SERVERNAME]]] - Notificação do dispositivo + [[[SERVERNAME]]] - Device Notification

- Os seguintes dispositivos mudaram seu estado de conexão. + The following devices have changed their connection state.

- Dispositivos conectados: + Connected devices:

[[[CONNECTIONS]]] @@ -22,7 +22,7 @@

- Dispositivos desconectados: + Disconnected devices:

[[[DISCONNECTIONS]]] @@ -30,7 +30,7 @@

- Para cancelar a inscrição, Clique aqui dentro de 1 hora após receber esta mensagem. + To unsubscribe, Clique aqui within 1 hour of getting this message.

\ No newline at end of file diff --git a/emails/translations/device-notify_pt.txt b/emails/translations/device-notify_pt.txt index 7f7675c6..ed4a6ac5 100644 --- a/emails/translations/device-notify_pt.txt +++ b/emails/translations/device-notify_pt.txt @@ -1,22 +1,22 @@ -[[[SERVERNAME]]] - Notificação do dispositivo +[[[SERVERNAME]]] - Device Notification ~ -Os seguintes dispositivos mudaram seu estado de conexão. +The following devices have changed their connection state. ~ ~ ~ -Dispositivos conectados: +Connected devices: ~ ~[[[CONNECTIONS]]] ~ ~ ~ ~ -Dispositivos desconectados: +Disconnected devices: ~ ~[[[DISCONNECTIONS]]] ~ ~ ~ -Para cancelar a inscrição, carregue este link em até 1 hora após receber esta mensagem: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] ~ \ No newline at end of file diff --git a/emails/translations/device-notify_sv.html b/emails/translations/device-notify_sv.html index a9c457d6..13ef6bfa 100644 --- a/emails/translations/device-notify_sv.html +++ b/emails/translations/device-notify_sv.html @@ -1,20 +1,20 @@ -
[[[SERVERNAME]]] – enhetsavisering
+
[[[SERVERNAME]]] - Device Notification
- [[[SERVERNAME]]] – enhetsavisering + [[[SERVERNAME]]] - Device Notification

- Följande enheter har ändrat anslutningsstatus. + The following devices have changed their connection state.

- Anslutna enheter: + Connected devices:

[[[CONNECTIONS]]] @@ -22,7 +22,7 @@

- Frånkopplade enheter: + Disconnected devices:

[[[DISCONNECTIONS]]] @@ -30,7 +30,7 @@

- Att avprenumerera, Klicka här inom 1 timme efter att du fick detta meddelande. + To unsubscribe, Klicka här within 1 hour of getting this message.

\ No newline at end of file diff --git a/emails/translations/device-notify_sv.txt b/emails/translations/device-notify_sv.txt index be164b2b..ed4a6ac5 100644 --- a/emails/translations/device-notify_sv.txt +++ b/emails/translations/device-notify_sv.txt @@ -1,22 +1,22 @@ -[[[SERVERNAME]]] – enhetsavisering +[[[SERVERNAME]]] - Device Notification ~ -Följande enheter har ändrat anslutningsstatus. +The following devices have changed their connection state. ~ ~ ~ -Anslutna enheter: +Connected devices: ~ ~[[[CONNECTIONS]]] ~ ~ ~ ~ -Frånkopplade enheter: +Disconnected devices: ~ ~[[[DISCONNECTIONS]]] ~ ~ ~ -För att avsluta prenumerationen, ladda denna länk inom 1 timme efter att du fått detta meddelande: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] ~ \ No newline at end of file diff --git a/emails/translations/device-notify_zh-chs.html b/emails/translations/device-notify_zh-chs.html index c24ac8c9..44bbf065 100644 --- a/emails/translations/device-notify_zh-chs.html +++ b/emails/translations/device-notify_zh-chs.html @@ -1,20 +1,20 @@ -
[[[SERVERNAME]]] - 设备通知
+
[[[SERVERNAME]]] - Device Notification
- [[[SERVERNAME]]] - 设备通知 + [[[SERVERNAME]]] - Device Notification

- 以下设备已更改其连接状态。 + The following devices have changed their connection state.

- 连接的设备: + Connected devices:

[[[CONNECTIONS]]] @@ -22,7 +22,7 @@

- 断开连接的设备: + Disconnected devices:

[[[DISCONNECTIONS]]] @@ -30,7 +30,7 @@

- 退订, 点击这里 在收到此消息的 1 小时内。 + To unsubscribe, 点击这里 within 1 hour of getting this message.

\ No newline at end of file diff --git a/emails/translations/device-notify_zh-chs.txt b/emails/translations/device-notify_zh-chs.txt index d992e0c0..ed4a6ac5 100644 --- a/emails/translations/device-notify_zh-chs.txt +++ b/emails/translations/device-notify_zh-chs.txt @@ -1,22 +1,22 @@ -[[[SERVERNAME]]] - 设备通知 +[[[SERVERNAME]]] - Device Notification ~ -以下设备已更改其连接状态。 +The following devices have changed their connection state. ~ ~ ~ -连接的设备: +Connected devices: ~ ~[[[CONNECTIONS]]] ~ ~ ~ ~ -断开连接的设备: +Disconnected devices: ~ ~[[[DISCONNECTIONS]]] ~ ~ ~ -要取消订阅,请在收到此消息后 1 小时内加载此链接:[[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] ~ \ No newline at end of file diff --git a/emails/translations/device-notify_zh-cht.html b/emails/translations/device-notify_zh-cht.html index 4d0ef07f..6a897da4 100644 --- a/emails/translations/device-notify_zh-cht.html +++ b/emails/translations/device-notify_zh-cht.html @@ -1,20 +1,20 @@ -
[[[SERVERNAME]]] - 設備通知
+
[[[SERVERNAME]]] - Device Notification
- [[[SERVERNAME]]] - 設備通知 + [[[SERVERNAME]]] - Device Notification

- 以下設備已更改其連接狀態。 + The following devices have changed their connection state.

- 連接的設備: + Connected devices:

[[[CONNECTIONS]]] @@ -22,7 +22,7 @@

- 斷開連接的設備: + Disconnected devices:

[[[DISCONNECTIONS]]] @@ -30,7 +30,7 @@

- 退訂, 點擊這裡 在收到此消息的 1 小時內。 + To unsubscribe, 點擊這裡 within 1 hour of getting this message.

\ No newline at end of file diff --git a/emails/translations/device-notify_zh-cht.txt b/emails/translations/device-notify_zh-cht.txt index 22e63c07..ed4a6ac5 100644 --- a/emails/translations/device-notify_zh-cht.txt +++ b/emails/translations/device-notify_zh-cht.txt @@ -1,22 +1,22 @@ -[[[SERVERNAME]]] - 設備通知 +[[[SERVERNAME]]] - Device Notification ~ -以下設備已更改其連接狀態。 +The following devices have changed their connection state. ~ ~ ~ -連接的設備: +Connected devices: ~ ~[[[CONNECTIONS]]] ~ ~ ~ ~ -斷開連接的設備: +Disconnected devices: ~ ~[[[DISCONNECTIONS]]] ~ ~ ~ -要取消訂閱,請在收到此消息後 1 小時內加載此鏈接:[[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] ~ \ No newline at end of file diff --git a/emails/translations/mesh-invite_bs.txt b/emails/translations/mesh-invite_bs.txt deleted file mode 100644 index 6da44ae6..00000000 --- a/emails/translations/mesh-invite_bs.txt +++ /dev/null @@ -1,41 +0,0 @@ -[[[SERVERNAME]]] - Pozivnica -~ -Zdravo [[[NAME]]], -~ -Korisnik [[[USERNAME]]] na serveru [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]) traži da instalirate softver za pokretanje sesije daljinskog upravljanja. -~ -~ -Poruka: [[[MSG]]] -~ -~ -~ -Za Windows, idite na sljedeću vezu da dovršite proces: -~ -~[[[SERVERURL]]]/meshagents?id=4&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] -~ -~ -~ -Za Apple OSX, idite na sljedeću vezu da dovršite proces: -~ -~[[[SERVERURL]]]/meshosxagent?id=16&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] -~ -~ -~ -Za Linux, izrežite i zalijepite sljedeće u terminal da biste instalirali agenta: -~ -~wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] '[[[MESHIDHEX]]]' -~ -~ -~ -Za MeshCentral Assistant na Windows-u, idite na sljedeću vezu da dovršite proces: -~ -~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] -~ -~ -~ -Da instalirate softver, idite na [[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]] i slijedite upute. -~ -Ako niste vi inicirali ovaj zahtjev, zanemarite ovu poruku. -~ -Srdačan pozdrav, -~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/mesh-invite_cs.html b/emails/translations/mesh-invite_cs.html index a5fcc451..18f6c8c2 100644 --- a/emails/translations/mesh-invite_cs.html +++ b/emails/translations/mesh-invite_cs.html @@ -34,7 +34,7 @@

- Kliknutím sem stáhnete MeshCentral Assistant pro Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_cs.txt b/emails/translations/mesh-invite_cs.txt index 0a7ca244..80c108b2 100644 --- a/emails/translations/mesh-invite_cs.txt +++ b/emails/translations/mesh-invite_cs.txt @@ -27,7 +27,7 @@ V případě systému Linux vyjměte a vložte do terminálu a nainstalujte agen ~ ~ ~ -Pro MeshCentral Assistant v systému Windows přejděte na následující odkaz a dokončete proces: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_da.html b/emails/translations/mesh-invite_da.html index 0ae90618..832fb738 100644 --- a/emails/translations/mesh-invite_da.html +++ b/emails/translations/mesh-invite_da.html @@ -34,7 +34,7 @@

- Klik her for at downloade MeshCentral Assistant til Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_da.txt b/emails/translations/mesh-invite_da.txt index a06d1ad5..5fb79606 100644 --- a/emails/translations/mesh-invite_da.txt +++ b/emails/translations/mesh-invite_da.txt @@ -27,7 +27,7 @@ For Linux skal du klippe og indsætte følgende i en terminal for at installere ~ ~ ~ -For MeshCentral Assistant på Windows skal du gå til følgende link for at fuldføre processen: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_de.html b/emails/translations/mesh-invite_de.html index 5a5f2efb..9c37ee5c 100644 --- a/emails/translations/mesh-invite_de.html +++ b/emails/translations/mesh-invite_de.html @@ -3,7 +3,7 @@
- [[[SERVERNAME]]] - Agent-Installation + [[[SERVERNAME]]] - Agenteninstallation
@@ -15,7 +15,7 @@

Benutzer [[[USERNAME]]] auf dem Server [[[SERVERNAME]]] fordert Sie auf, Software zu installieren, um eine Fernsteuerungssitzung zu starten.

- Nachricht: [[[MSG]]] + Botschaft: [[[MSG]]]

@@ -28,13 +28,13 @@

- Schneiden Sie unter Linux Folgendes aus und fügen Sie es in ein Terminal ein, um den Agent zu installieren:
+ Schneiden Sie unter Linux Folgendes aus und fügen Sie es in ein Terminal ein, um den Agenten zu installieren:

wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] \'[[[MESHIDHEX]]]\'

- Klicken Sie hier, um den MeshCentral-Assistenten für Windows herunterzuladen. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_de.txt b/emails/translations/mesh-invite_de.txt index 961fcc02..976e83f6 100644 --- a/emails/translations/mesh-invite_de.txt +++ b/emails/translations/mesh-invite_de.txt @@ -21,13 +21,13 @@ Nagivieren Sie unter Apple OSX den folgenden Link, um den Vorgang abzuschließen ~ ~ ~ -Schneiden Sie unter Linux Folgendes aus und fügen Sie es in ein Terminal ein, um den Agent zu installieren: +Schneiden Sie unter Linux Folgendes aus und fügen Sie es in ein Terminal ein, um den Agenten zu installieren: ~ ~wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] '[[[MESHIDHEX]]]' ~ ~ ~ -Navigieren Sie für MeshCentral Assistant unter Windows zum folgenden Link, um den Vorgang abzuschließen: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_es.html b/emails/translations/mesh-invite_es.html index cedfc2a6..1f0d2552 100644 --- a/emails/translations/mesh-invite_es.html +++ b/emails/translations/mesh-invite_es.html @@ -34,7 +34,7 @@

- Haga clic aquí para descargar el Asistente de MeshCentral para Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_es.txt b/emails/translations/mesh-invite_es.txt index 44c3db2a..a51d2d10 100644 --- a/emails/translations/mesh-invite_es.txt +++ b/emails/translations/mesh-invite_es.txt @@ -27,7 +27,7 @@ Para Linux, copia y pega lo siguiente en la terminal para instalar el agente: ~ ~ ~ -Para el Asistente de MeshCentral en Windows, navegue hasta el siguiente enlace para completar el proceso: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_fi.html b/emails/translations/mesh-invite_fi.html index 82cff925..61e81977 100644 --- a/emails/translations/mesh-invite_fi.html +++ b/emails/translations/mesh-invite_fi.html @@ -34,7 +34,7 @@

- Napsauta tätä ladataksesi MeshCentral Assistant for Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_fi.txt b/emails/translations/mesh-invite_fi.txt index 368e01d5..76839b54 100644 --- a/emails/translations/mesh-invite_fi.txt +++ b/emails/translations/mesh-invite_fi.txt @@ -27,7 +27,7 @@ Linux: leikkaa ja liitä seuraava päätelaitteeseen agentin asentamiseksi: ~ ~ ~ -Jos käytät MeshCentral Assistantia Windowsissa, siirry seuraavaan linkkiin prosessin viimeistelemiseksi: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_hi.html b/emails/translations/mesh-invite_hi.html index 971c04a1..9c1354ce 100644 --- a/emails/translations/mesh-invite_hi.html +++ b/emails/translations/mesh-invite_hi.html @@ -34,7 +34,7 @@

- विंडोज के लिए मेशसेंट्रल असिस्टेंट डाउनलोड करने के लिए यहां क्लिक करें। + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_hi.txt b/emails/translations/mesh-invite_hi.txt index a6138486..5314dc5c 100644 --- a/emails/translations/mesh-invite_hi.txt +++ b/emails/translations/mesh-invite_hi.txt @@ -27,7 +27,7 @@ Apple OSX के लिए, इस प्रक्रिया को पूर ~ ~ ~ -विंडोज़ पर मेशसेंट्रल असिस्टेंट के लिए, प्रक्रिया को पूरा करने के लिए निम्न लिंक पर जाएँ: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_hu.html b/emails/translations/mesh-invite_hu.html deleted file mode 100644 index 10faaf72..00000000 --- a/emails/translations/mesh-invite_hu.html +++ /dev/null @@ -1,47 +0,0 @@ -
[[[SERVERNAME]]] - Meghívás
-
- - - - -
- [[[SERVERNAME]]] - Agent Telepítése -
- -

- Tisztelt [[[NAME]]], -

-
-

[[[USERNAME]]] felhasználó, kiszolgáló: [[[SERVERNAME]]] kéri hogy telepítse az alkalmazást, amivel lehetőség van távvezérlő munkamant elindítására.

- -

- Üzenet: [[[MSG]]] -

-
- -

- Kattintson ide a MeshAgent for Windows letöltéséhez. -

-
- -

Kattintson ide az Apple OSX rendszerhez készült MeshAgent letöltéséhez.

-
- -

- Linux esetén az Agent telepítéséhez vágja ki és illessze be egy terminálba a következőt:
-

wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] \'[[[MESHIDHEX]]]\'
-

-
- -

- Kattintson ide a MeshCentral Assistant for Windows letöltéséhez. -

-
- -

- A szoftver telepítéséhez, Kattintson ide és kövesse az utasításokat. -

-
-

Ha nem Ön kezdeményezte ezt a kérést, kérjük, hagyja figyelmen kívül ezt a levelet.

- Üdvözlettel,
[[[USERNAME]]]
-
\ No newline at end of file diff --git a/emails/translations/mesh-invite_hu.txt b/emails/translations/mesh-invite_hu.txt deleted file mode 100644 index 437028be..00000000 --- a/emails/translations/mesh-invite_hu.txt +++ /dev/null @@ -1,41 +0,0 @@ -[[[SERVERNAME]]] - Meghívás -~ -Tisztelt [[[NAME]]], -~ -A [[[USERNAME]]] felhasználó a [[[SERVERNAME]]] kiszolgálón ([[[[SERVERURL]]]/[[[URLARGS1]]]) a távvezérlési munkamenet indításához szükséges szoftver telepítését kéri. -~ -~ -Üzenet: [[[MSG]]] -~ -~ -~ -Windows esetén a folyamat befejezéséhez menjen a következő hivatkozásra: -~ -~[[[SERVERURL]]]/meshagents?id=4&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] -~ -~ -~ -Apple OSX esetén kattintson az alábbi linkre a folyamat befejezéséhez: -~ -~[[[SERVERURL]]]/meshosxagent?id=16&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] -~ -~ -~ -Linux esetén az Agent telepítéséhez vágja ki és illessze be egy terminálba a következőt: -~ -~wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] '[[[MESHIDHEX]]]' -~ -~ -~ -Windows rendszeren futó MeshCentral Assistant esetén menjen a következő hivatkozásra a folyamat befejezéséhez: -~ -~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] -~ -~ -~ -A szoftver telepítéséhez kérjük lépjen a [[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]] oldalra, és kövesse az utasításokat. -~ -Ha nem Ön kezdeményezte ezt a kérést, kérjük, hagyja figyelmen kívül ezt a levelet. -~ -Üdvözlettel, -~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/mesh-invite_it.html b/emails/translations/mesh-invite_it.html index d2f82d68..b0ab3ca1 100644 --- a/emails/translations/mesh-invite_it.html +++ b/emails/translations/mesh-invite_it.html @@ -34,7 +34,7 @@

- Fare clic qui per scaricare MeshCentral Assistant per Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_it.txt b/emails/translations/mesh-invite_it.txt index 5673519d..9eb5cf76 100644 --- a/emails/translations/mesh-invite_it.txt +++ b/emails/translations/mesh-invite_it.txt @@ -27,7 +27,7 @@ Per Linux, taglia e incolla quanto segue in un terminale per installare l'agente ~ ~ ~ -Per MeshCentral Assistant su Windows, accedere al seguente collegamento per completare il processo: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_ja.html b/emails/translations/mesh-invite_ja.html index 0cc05dad..ba857840 100644 --- a/emails/translations/mesh-invite_ja.html +++ b/emails/translations/mesh-invite_ja.html @@ -34,7 +34,7 @@

- Windows용 MeshCentral Assistant를 다운로드하려면 여기를 클릭하십시오. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_ja.txt b/emails/translations/mesh-invite_ja.txt index 91db4edb..fe7f5b8b 100644 --- a/emails/translations/mesh-invite_ja.txt +++ b/emails/translations/mesh-invite_ja.txt @@ -27,7 +27,7 @@ Linuxの場合は、ターミナルで以下をカットアンドペーストし ~ ~ ~ -Windows용 MeshCentral Assistant의 경우 다음 링크로 이동하여 프로세스를 완료하십시오. +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_ko.html b/emails/translations/mesh-invite_ko.html index a9872cc0..0241238e 100644 --- a/emails/translations/mesh-invite_ko.html +++ b/emails/translations/mesh-invite_ko.html @@ -34,7 +34,7 @@

- Windows용 MeshCentral Assistant를 다운로드하려면 여기를 클릭하십시오. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_ko.txt b/emails/translations/mesh-invite_ko.txt index 21dcc913..55b887bf 100644 --- a/emails/translations/mesh-invite_ko.txt +++ b/emails/translations/mesh-invite_ko.txt @@ -27,7 +27,7 @@ Linux의 경우, 다음을 잘라내어 터미널에 붙여 넣어 에이전트 ~ ~ ~ -Windows용 MeshCentral Assistant의 경우 다음 링크로 이동하여 프로세스를 완료하십시오. +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_bs.html b/emails/translations/mesh-invite_n.html similarity index 50% rename from emails/translations/mesh-invite_bs.html rename to emails/translations/mesh-invite_n.html index 470b0056..0058093d 100644 --- a/emails/translations/mesh-invite_bs.html +++ b/emails/translations/mesh-invite_n.html @@ -1,47 +1,42 @@ -
[[[SERVERNAME]]] - Pozivnica
+
[[[SERVERNAME]]] - Invitation
- [[[SERVERNAME]]] - Instalacija agenta + [[[SERVERNAME]]] - Agent Installation

- Zdravo [[[NAME]]], + Hello [[[NAME]]],

-

Korisnik [[[USERNAME]]] na serveru [[[SERVERNAME]]] traži od vas da instalirate softver za pokretanje sesije daljinskog upravljanja.

+

User [[[USERNAME]]] on server [[[SERVERNAME]]] is requesting you to install software to start a remote control session.

- Poruka: [[[MSG]]] + Message: [[[MSG]]]

- Kliknite ovdje da preuzmete MeshAgent za Windows. + Click here to download the MeshAgent for Windows.

-

Kliknite ovdje da preuzmete MeshAgent za Apple OSX.

+

Click here to download the MeshAgent for Apple OSX.

- Za Linux, izrežite i zalijepite sljedeće u terminal da biste instalirali agenta:
+ For Linux, cut & paste the following in a terminal to install the agent:

wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] \'[[[MESHIDHEX]]]\'

- -

- Kliknite ovdje da preuzmete MeshCentral Assistant za Windows. -

-

- Da biste instalirali softver, kliknite ovdje i slijedite upute. + To install the software, click here and follow the instructions.

-

Ako niste vi inicirali ovaj zahtjev, zanemarite ovu poruku.

- Srdačan pozdrav,
[[[USERNAME]]]
+

If you did not initiate this request, please ignore this mail.

+ Best regards,
[[[USERNAME]]]
\ No newline at end of file diff --git a/emails/translations/mesh-invite_n.txt b/emails/translations/mesh-invite_n.txt new file mode 100644 index 00000000..ade301dc --- /dev/null +++ b/emails/translations/mesh-invite_n.txt @@ -0,0 +1,35 @@ +[[[SERVERNAME]]] - Invitation +~ +Hello [[[NAME]]], +~ +User [[[USERNAME]]] on server [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]) is requesting you install software to start the remote control session. +~ +~ +Message: [[[MSG]]] +~ +~ +~ +For Windows, nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/meshagents?id=4&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] +~ +~ +~ +For Apple OSX, nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/meshosxagent?id=16&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] +~ +~ +~ +For Linux, cut & paste the following in a terminal to install the agent: +~ +~wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] '[[[MESHIDHEX]]]' +~ +~ +~ +To install the software, navigate to [[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]] and follow the instructions. +~ +If you did not initiate this request, please ignore this mail. +~ +Best regards, +~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/mesh-invite_nn.html b/emails/translations/mesh-invite_nn.html new file mode 100644 index 00000000..0058093d --- /dev/null +++ b/emails/translations/mesh-invite_nn.html @@ -0,0 +1,42 @@ +
[[[SERVERNAME]]] - Invitation
+
+ + + + +
+ [[[SERVERNAME]]] - Agent Installation +
+ +

+ Hello [[[NAME]]], +

+
+

User [[[USERNAME]]] on server [[[SERVERNAME]]] is requesting you to install software to start a remote control session.

+ +

+ Message: [[[MSG]]] +

+
+ +

+ Click here to download the MeshAgent for Windows. +

+
+ +

Click here to download the MeshAgent for Apple OSX.

+
+ +

+ For Linux, cut & paste the following in a terminal to install the agent:
+

wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] \'[[[MESHIDHEX]]]\'
+

+
+ +

+ To install the software, click here and follow the instructions. +

+
+

If you did not initiate this request, please ignore this mail.

+ Best regards,
[[[USERNAME]]]
+
\ No newline at end of file diff --git a/emails/translations/mesh-invite_nn.txt b/emails/translations/mesh-invite_nn.txt new file mode 100644 index 00000000..ade301dc --- /dev/null +++ b/emails/translations/mesh-invite_nn.txt @@ -0,0 +1,35 @@ +[[[SERVERNAME]]] - Invitation +~ +Hello [[[NAME]]], +~ +User [[[USERNAME]]] on server [[[SERVERNAME]]] ([[[SERVERURL]]]/[[[URLARGS1]]]) is requesting you install software to start the remote control session. +~ +~ +Message: [[[MSG]]] +~ +~ +~ +For Windows, nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/meshagents?id=4&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] +~ +~ +~ +For Apple OSX, nagivate to the following link to complete the process: +~ +~[[[SERVERURL]]]/meshosxagent?id=16&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]&installflags=[[[INSTALLFLAGS]]] +~ +~ +~ +For Linux, cut & paste the following in a terminal to install the agent: +~ +~wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] '[[[MESHIDHEX]]]' +~ +~ +~ +To install the software, navigate to [[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]] and follow the instructions. +~ +If you did not initiate this request, please ignore this mail. +~ +Best regards, +~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/mesh-invite_pt.html b/emails/translations/mesh-invite_pt.html index 982fbb51..116470a1 100644 --- a/emails/translations/mesh-invite_pt.html +++ b/emails/translations/mesh-invite_pt.html @@ -34,7 +34,7 @@

- Clique aqui para baixar o Assistente MeshCentral para Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_pt.txt b/emails/translations/mesh-invite_pt.txt index bb13866b..72e3a393 100644 --- a/emails/translations/mesh-invite_pt.txt +++ b/emails/translations/mesh-invite_pt.txt @@ -27,7 +27,7 @@ Para Linux, recorte e cole o seguinte em um terminal para instalar o agente: ~ ~ ~ -Para o MeshCentral Assistant no Windows, navegue até o seguinte link para concluir o processo: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_sv.html b/emails/translations/mesh-invite_sv.html index 22261dd6..264b91f3 100644 --- a/emails/translations/mesh-invite_sv.html +++ b/emails/translations/mesh-invite_sv.html @@ -34,7 +34,7 @@

- Klicka här för att ladda ner MeshCentral Assistant för Windows. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_sv.txt b/emails/translations/mesh-invite_sv.txt index 6e867358..7e2aea3d 100644 --- a/emails/translations/mesh-invite_sv.txt +++ b/emails/translations/mesh-invite_sv.txt @@ -2,7 +2,7 @@ ~ Hej [[[NAME]]] ~ -Användaren [[[USERNAME]]] på servern [[[SERVERNAME]]] ([[[SERVERURL]]/[[[URLARGS1]]) ber dig installera programvara för att starta fjärrkontrollsessionen. +Användaren [[[USERNAME]]] på servern [[[SERVERNAME]]] ([[[SERVERURL]] / [[[URLARGS1]]) ber dig installera programvara för att starta fjärrkontrollsessionen. ~ ~ Meddelande: [[[[MSG]]] @@ -27,7 +27,7 @@ För Linux, klipp och klistra in följande i en terminal för att installera age ~ ~ ~ -För MeshCentral Assistant på Windows, gå till följande länk för att slutföra processen: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_tr.html b/emails/translations/mesh-invite_tr.html index 26cc077b..6dbd7c7f 100644 --- a/emails/translations/mesh-invite_tr.html +++ b/emails/translations/mesh-invite_tr.html @@ -34,7 +34,7 @@

- Windows için MeshCentral Assistant'ı indirmek için buraya tıklayın. + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_tr.txt b/emails/translations/mesh-invite_tr.txt index 42e818a8..138bebf5 100644 --- a/emails/translations/mesh-invite_tr.txt +++ b/emails/translations/mesh-invite_tr.txt @@ -27,7 +27,7 @@ Linux için, aracıyı yüklemek için aşağıdakileri kesip bir terminale yap ~ ~ ~ -Windows'ta MeshCentral Assistant için işlemi tamamlamak üzere aşağıdaki bağlantıya gidin: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/mesh-invite_zh-chs.html b/emails/translations/mesh-invite_zh-chs.html index 39b649d5..9c69b50a 100644 --- a/emails/translations/mesh-invite_zh-chs.html +++ b/emails/translations/mesh-invite_zh-chs.html @@ -1,4 +1,4 @@ -
[[[SERVERNAME]]] - 邀请
+
[[[SERVERNAME]]]-邀请
@@ -34,7 +34,7 @@

- 单击此处下载适用于 Windows 的 MeshCentral 助手。 + Click here to download the MeshCentral Assistant for Windows.

@@ -42,6 +42,6 @@ 要安装软件, 点击这里 并按照说明进行操作。

-

如果您没有发起此请求,请忽略此邮件。

+

如果您没有发起此请求,请不理此邮件。

最好的祝福,
[[[USERNAME]]]
\ No newline at end of file diff --git a/emails/translations/mesh-invite_zh-chs.txt b/emails/translations/mesh-invite_zh-chs.txt index f4140b66..42be8cbd 100644 --- a/emails/translations/mesh-invite_zh-chs.txt +++ b/emails/translations/mesh-invite_zh-chs.txt @@ -1,4 +1,4 @@ -[[[SERVERNAME]]] - 邀请 +[[[SERVERNAME]]]-邀请 ~ 您好[[[NAME]]], ~ @@ -27,7 +27,7 @@ ~ ~ ~ -对于 Windows 上的 MeshCentral Assistant,导航到以下链接以完成该过程: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ @@ -35,7 +35,7 @@ ~ 要安装软件,请导航至[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]],然后按照说明进行操作。 ~ -如果您没有发起此请求,请忽略此邮件。 +如果您没有发起此请求,请不理此邮件。 ~ 最好的祝福, ~[[[USERNAME]]] \ No newline at end of file diff --git a/emails/translations/mesh-invite_zh-cht.html b/emails/translations/mesh-invite_zh-cht.html index 7274fba6..96828ff9 100644 --- a/emails/translations/mesh-invite_zh-cht.html +++ b/emails/translations/mesh-invite_zh-cht.html @@ -1,4 +1,4 @@ -
[[[SERVERNAME]]] - 邀請
+
[[[SERVERNAME]]]-邀請
@@ -34,7 +34,7 @@

- 單擊此處下載適用於 Windows 的 MeshCentral 助手。 + Click here to download the MeshCentral Assistant for Windows.

diff --git a/emails/translations/mesh-invite_zh-cht.txt b/emails/translations/mesh-invite_zh-cht.txt index 52bab9a1..382ecdc6 100644 --- a/emails/translations/mesh-invite_zh-cht.txt +++ b/emails/translations/mesh-invite_zh-cht.txt @@ -1,4 +1,4 @@ -[[[SERVERNAME]]] - 邀請 +[[[SERVERNAME]]]-邀請 ~ 你好[[[NAME]]], ~ @@ -27,7 +27,7 @@ ~ ~ ~ -對於 Windows 上的 MeshCentral Assistant,導航到以下鏈接以完成該過程: +For MeshCentral Assistant on Windows, nagivate to the following link to complete the process: ~ ~[[[SERVERURL]]]/meshagents?id=10006&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]] ~ diff --git a/emails/translations/sms-messages_bs.txt b/emails/translations/sms-messages_bs.txt deleted file mode 100644 index 768b0043..00000000 --- a/emails/translations/sms-messages_bs.txt +++ /dev/null @@ -1,2 +0,0 @@ -[[0]] verifikacioni kod je: [[1]] -[[0]] pristupni token je: [[1]] diff --git a/emails/translations/sms-messages_hi.txt b/emails/translations/sms-messages_hi.txt index 81e0954b..3c933cf3 100644 --- a/emails/translations/sms-messages_hi.txt +++ b/emails/translations/sms-messages_hi.txt @@ -1,2 +1,2 @@ -[[0]] सत्यापन कोड है: [[1]] +[[०]] सत्यापन कोड है: [[१]] [[0]] अभिगमन टोकन है: [[१]] diff --git a/emails/translations/sms-messages_hu.txt b/emails/translations/sms-messages_hu.txt deleted file mode 100644 index 07b75b61..00000000 --- a/emails/translations/sms-messages_hu.txt +++ /dev/null @@ -1,2 +0,0 @@ -[[0]] ellenőrző kód: [[1]] -[[0]] hozzáférés token: [[1]] diff --git a/emails/translations/sms-messages_n.txt b/emails/translations/sms-messages_n.txt new file mode 100644 index 00000000..cffc6c48 --- /dev/null +++ b/emails/translations/sms-messages_n.txt @@ -0,0 +1,2 @@ +[[0]] verification code is: [[1]] +[[0]] access token is: [[1]] diff --git a/emails/translations/sms-messages_nn.txt b/emails/translations/sms-messages_nn.txt new file mode 100644 index 00000000..cffc6c48 --- /dev/null +++ b/emails/translations/sms-messages_nn.txt @@ -0,0 +1,2 @@ +[[0]] verification code is: [[1]] +[[0]] access token is: [[1]] diff --git a/emails/translations/sms-messages_zh-chs.txt b/emails/translations/sms-messages_zh-chs.txt index 9d2e320e..92e65ab8 100644 --- a/emails/translations/sms-messages_zh-chs.txt +++ b/emails/translations/sms-messages_zh-chs.txt @@ -1,2 +1,2 @@ [[0]]验证码是:[[1]] -[[0]]访问令牌是:[[1]] +[[0]]访问保安编码是:[[1]] diff --git a/firebase.js b/firebase.js index 124acfa0..d20a9541 100644 --- a/firebase.js +++ b/firebase.js @@ -1,6 +1,7 @@ /** * @description MeshCentral Firebase communication module * @author Ylian Saint-Hilaire +* @copyright Intel Corporation 2018-2022 * @license Apache-2.0 * @version v0.0.1 */ @@ -13,31 +14,27 @@ /*jshint esversion: 6 */ "use strict"; -// Initialize the Firebase Admin SDK -module.exports.CreateFirebase = function (parent, serviceAccount) { - - // Import the Firebase Admin SDK - const admin = require('firebase-admin'); - - const obj = {}; +// Construct the Firebase object +module.exports.CreateFirebase = function (parent, senderid, serverkey) { + var obj = {}; obj.messageId = 0; obj.relays = {}; obj.stats = { - mode: 'Real', + mode: "Real", sent: 0, sendError: 0, received: 0, receivedNoRoute: 0, receivedBadArgs: 0 - }; - - const tokenToNodeMap = {}; // Token --> { nid: nodeid, mid: meshid } - - // Initialize Firebase Admin with server key and project ID - if (!admin.apps.length) { - admin.initializeApp({ credential: admin.credential.cert(serviceAccount) }); } - + + const Sender = require('node-xcs').Sender; + const Message = require('node-xcs').Message; + const Notification = require('node-xcs').Notification; + const xcs = new Sender(senderid, serverkey); + + var tokenToNodeMap = {} // Token --> { nid: nodeid, mid: meshid } + // Setup logging if (parent.config.firebase && (parent.config.firebase.log === true)) { obj.logpath = parent.path.join(parent.datapath, 'firebase.txt'); @@ -45,108 +42,155 @@ module.exports.CreateFirebase = function (parent, serviceAccount) { } else { obj.log = function () { } } - - // Function to send notifications + + // Messages received from client (excluding receipts) + xcs.on('message', function (messageId, from, data, category) { + const jsonData = JSON.stringify(data); + obj.log('Firebase-Message: ' + jsonData); + parent.debug('email', 'Firebase-Message: ' + jsonData); + + if (typeof data.r == 'string') { + // Lookup push relay server + parent.debug('email', 'Firebase-RelayRoute: ' + data.r); + const wsrelay = obj.relays[data.r]; + if (wsrelay != null) { + delete data.r; + try { wsrelay.send(JSON.stringify({ from: from, data: data, category: category })); } catch (ex) { } + } + } else { + // Lookup node information from the cache + var ninfo = tokenToNodeMap[from]; + if (ninfo == null) { obj.stats.receivedNoRoute++; return; } + + if ((data != null) && (data.con != null) && (data.s != null)) { // Console command + obj.stats.received++; + parent.webserver.routeAgentCommand({ action: 'msg', type: 'console', value: data.con, sessionid: data.s }, ninfo.did, ninfo.nid, ninfo.mid); + } else { + obj.stats.receivedBadArgs++; + } + } + }); + + // Only fired for messages where options.delivery_receipt_requested = true + /* + xcs.on('receipt', function (messageId, from, data, category) { console.log('Firebase-Receipt', messageId, from, data, category); }); + xcs.on('connected', function () { console.log('Connected'); }); + xcs.on('disconnected', function () { console.log('disconnected'); }); + xcs.on('online', function () { console.log('online'); }); + xcs.on('error', function (e) { console.log('error', e); }); + xcs.on('message-error', function (e) { console.log('message-error', e); }); + */ + + xcs.start(); + + obj.log('CreateFirebase-Setup'); + parent.debug('email', 'CreateFirebase-Setup'); + + // EXAMPLE + //var payload = { notification: { title: command.title, body: command.msg }, data: { url: obj.msgurl } }; + //var options = { priority: 'High', timeToLive: 5 * 60 }; // TTL: 5 minutes, priority 'Normal' or 'High' + obj.sendToDevice = function (node, payload, options, func) { - if (typeof node === 'string') { - parent.db.Get(node, function (err, docs) { - if (!err && docs && docs.length === 1) { - obj.sendToDeviceEx(docs[0], payload, options, func); - } else { - func(0, 'error'); - } - }); + if (typeof node == 'string') { + parent.db.Get(node, function (err, docs) { if ((err == null) && (docs != null) && (docs.length == 1)) { obj.sendToDeviceEx(docs[0], payload, options, func); } else { func(0, 'error'); } }) } else { obj.sendToDeviceEx(node, payload, options, func); } - }; - + } + // Send an outbound push notification obj.sendToDeviceEx = function (node, payload, options, func) { - if (!node || typeof node.pmt !== 'string') { - func(0, 'error'); - return; - } - + parent.debug('email', 'Firebase-sendToDevice'); + if ((node == null) || (typeof node.pmt != 'string')) return; obj.log('sendToDevice, node:' + node._id + ', payload: ' + JSON.stringify(payload) + ', options: ' + JSON.stringify(options)); - + // Fill in our lookup table - if (node._id) { - tokenToNodeMap[node.pmt] = { - nid: node._id, - mid: node.meshid, - did: node.domain - }; + if (node._id != null) { tokenToNodeMap[node.pmt] = { nid: node._id, mid: node.meshid, did: node.domain } } + + // Built the on-screen notification + var notification = null; + if (payload.notification) { + var notification = new Notification('ic_message') + .title(payload.notification.title) + .body(payload.notification.body) + .build(); } - - const message = { - token: node.pmt, - notification: payload.notification, - data: payload.data, - android: { - priority: options.priority || 'high', - ttl: options.timeToLive ? options.timeToLive * 1000 : undefined - } - }; - - admin.messaging().send(message).then(function (response) { - obj.stats.sent++; - obj.log('Success'); - func(response); - }).catch(function (error) { - obj.stats.sendError++; - obj.log('Fail: ' + error); - func(0, error); - }); - }; - + + // Build the message + var message = new Message('msg_' + (++obj.messageId)); + if (options.priority) { message.priority(options.priority); } + if (payload.data) { for (var i in payload.data) { message.addData(i, payload.data[i]); } } + if ((payload.data == null) || (payload.data.shash == null)) { message.addData('shash', parent.webserver.agentCertificateHashBase64); } // Add the server agent hash, new Android agents will reject notifications that don't have this. + if (notification) { message.notification(notification) } + message.build(); + + // Send the message + function callback(result) { + if (result.getError() == null) { obj.stats.sent++; obj.log('Success'); } else { obj.stats.sendError++; obj.log('Fail'); } + callback.func(result.getMessageId(), result.getError(), result.getErrorDescription()) + } + callback.func = func; + parent.debug('email', 'Firebase-sending'); + xcs.sendNoRetry(message, node.pmt, callback); + } + // Setup a two way relay obj.setupRelay = function (ws) { + // Select and set a relay identifier ws.relayId = getRandomPassword(); - while (obj.relays[ws.relayId]) { ws.relayId = getRandomPassword(); } + while (obj.relays[ws.relayId] != null) { ws.relayId = getRandomPassword(); } obj.relays[ws.relayId] = ws; + // On message, parse it ws.on('message', function (msg) { parent.debug('email', 'FBWS-Data(' + this.relayId + '): ' + msg); - if (typeof msg === 'string') { + if (typeof msg == 'string') { obj.log('Relay: ' + msg); - - let data; - try { data = JSON.parse(msg); } catch (ex) { return; } - if (typeof data !== 'object') return; - if (!parent.common.validateObjectForMongo(data, 4096)) return; - if (typeof data.pmt !== 'string' || typeof data.payload !== 'object') return; - - data.payload.data = data.payload.data || {}; - data.payload.data.r = ws.relayId; - - obj.sendToDevice({ pmt: data.pmt }, data.payload, data.options, function (id, err) { - if (!err) { - try { ws.send(JSON.stringify({ sent: true })); } catch (ex) { } + + // Parse the incoming push request + var data = null; + try { data = JSON.parse(msg) } catch (ex) { return; } + if (typeof data != 'object') return; + if (parent.common.validateObjectForMongo(data, 4096) == false) return; // Perform sanity checking on this object. + if (typeof data.pmt != 'string') return; + if (typeof data.payload != 'object') return; + if (typeof data.payload.notification == 'object') { + if (typeof data.payload.notification.title != 'string') return; + if (typeof data.payload.notification.body != 'string') return; + } + if (typeof data.options != 'object') return; + if ((data.options.priority != 'Normal') && (data.options.priority != 'High')) return; + if ((typeof data.options.timeToLive != 'number') || (data.options.timeToLive < 1)) return; + if (typeof data.payload.data != 'object') { data.payload.data = {}; } + data.payload.data.r = ws.relayId; // Set the relay id. + + // Send the push notification + obj.sendToDevice({ pmt: data.pmt }, data.payload, data.options, function (id, err, errdesc) { + if (err == null) { + try { wsrelay.send(JSON.stringify({ sent: true })); } catch (ex) { } } else { - try { ws.send(JSON.stringify({ sent: false })); } catch (ex) { } + try { wsrelay.send(JSON.stringify({ sent: false })); } catch (ex) { } } }); } }); - + // If error, close the relay ws.on('error', function (err) { parent.debug('email', 'FBWS-Error(' + this.relayId + '): ' + err); delete obj.relays[this.relayId]; }); - + // Close the relay ws.on('close', function () { parent.debug('email', 'FBWS-Close(' + this.relayId + ')'); delete obj.relays[this.relayId]; }); - }; - - function getRandomPassword() { - return Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').replace(/\//g, '@'); + } - + + function getRandomPassword() { return Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').split('/').join('@'); } + return obj; }; @@ -168,7 +212,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { const querystring = require('querystring'); const relayUrl = require('url').parse(url); parent.debug('email', 'CreateFirebaseRelay-Setup'); - + // Setup logging if (parent.config.firebaserelay && (parent.config.firebaserelay.log === true)) { obj.logpath = parent.path.join(parent.datapath, 'firebaserelay.txt'); @@ -176,7 +220,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { } else { obj.log = function () { } } - + obj.log('Starting relay to: ' + relayUrl.href); if (relayUrl.protocol == 'wss:') { // Setup two-way push notification channel @@ -208,7 +252,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { parent.debug('email', 'FBWS-Disconnected'); obj.wsclient = null; obj.wsopen = false; - + // Compute the backoff timer if (obj.reconnectTimer == null) { if ((obj.lastConnect != null) && ((Date.now() - obj.lastConnect) > 10000)) { obj.backoffTimer = 0; } @@ -219,12 +263,12 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { } }); } - + function processMessage(messageId, from, data, category) { // Lookup node information from the cache var ninfo = obj.tokenToNodeMap[from]; if (ninfo == null) { obj.stats.receivedNoRoute++; return; } - + if ((data != null) && (data.con != null) && (data.s != null)) { // Console command obj.stats.received++; parent.webserver.routeAgentCommand({ action: 'msg', type: 'console', value: data.con, sessionid: data.s }, ninfo.did, ninfo.nid, ninfo.mid); @@ -232,7 +276,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { obj.stats.receivedBadArgs++; } } - + obj.sendToDevice = function (node, payload, options, func) { if (typeof node == 'string') { parent.db.Get(node, function (err, docs) { if ((err == null) && (docs != null) && (docs.length == 1)) { obj.sendToDeviceEx(docs[0], payload, options, func); } else { func(0, 'error'); } }) @@ -240,19 +284,19 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { obj.sendToDeviceEx(node, payload, options, func); } } - + obj.sendToDeviceEx = function (node, payload, options, func) { parent.debug('email', 'Firebase-sendToDevice-webSocket'); if ((node == null) || (typeof node.pmt != 'string')) { func(0, 'error'); return; } obj.log('sendToDevice, node:' + node._id + ', payload: ' + JSON.stringify(payload) + ', options: ' + JSON.stringify(options)); - + // Fill in our lookup table if (node._id != null) { obj.tokenToNodeMap[node.pmt] = { nid: node._id, mid: node.meshid, did: node.domain } } - + // Fill in the server agent cert hash if (payload.data == null) { payload.data = {}; } if (payload.data.shash == null) { payload.data.shash = parent.webserver.agentCertificateHashBase64; } // Add the server agent hash, new Android agents will reject notifications that don't have this. - + // If the web socket is open, send now if (obj.wsopen == true) { try { obj.wsclient.send(JSON.stringify({ pmt: node.pmt, payload: payload, options: options })); } catch (ex) { func(0, 'error'); obj.stats.sendError++; return; } @@ -270,7 +314,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { } else if (relayUrl.protocol == 'https:') { // Send an outbound push notification using an HTTPS POST obj.pushOnly = true; - + obj.sendToDevice = function (node, payload, options, func) { if (typeof node == 'string') { parent.db.Get(node, function (err, docs) { if ((err == null) && (docs != null) && (docs.length == 1)) { obj.sendToDeviceEx(docs[0], payload, options, func); } else { func(0, 'error'); } }) @@ -278,18 +322,18 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { obj.sendToDeviceEx(node, payload, options, func); } } - + obj.sendToDeviceEx = function (node, payload, options, func) { parent.debug('email', 'Firebase-sendToDevice-httpPost'); if ((node == null) || (typeof node.pmt != 'string')) return; - + // Fill in the server agent cert hash if (payload.data == null) { payload.data = {}; } if (payload.data.shash == null) { payload.data.shash = parent.webserver.agentCertificateHashBase64; } // Add the server agent hash, new Android agents will reject notifications that don't have this. - + obj.log('sendToDevice, node:' + node._id + ', payload: ' + JSON.stringify(payload) + ', options: ' + JSON.stringify(options)); const querydata = querystring.stringify({ 'msg': JSON.stringify({ pmt: node.pmt, payload: payload, options: options }) }); - + // Send the message to the relay const httpOptions = { hostname: relayUrl.hostname, @@ -313,6 +357,6 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { req.end(); } } - + return obj; }; \ No newline at end of file diff --git a/interceptor.js b/interceptor.js index c6e4a878..7585620e 100644 --- a/interceptor.js +++ b/interceptor.js @@ -395,7 +395,7 @@ module.exports.CreateRedirInterceptor = function (args) { if (obj.amt.digestRealm) { // Replace this authentication digest with a server created one // We have everything we need to authenticate - var nc = '0'+ (10000000 + obj.ws.authCNonceCount).toString().substring(1);// set NC at least 8 bytes + var nc = obj.ws.authCNonceCount; obj.ws.authCNonceCount++; var digest = obj.ComputeDigesthash(obj.args.user, obj.args.pass, obj.amt.digestRealm, 'POST', authurl, obj.amt.digestQOP, obj.amt.digestNonce, nc, obj.ws.authCNonce); diff --git a/letsencrypt.js b/letsencrypt.js index c1823ba4..c83cf102 100644 --- a/letsencrypt.js +++ b/letsencrypt.js @@ -28,8 +28,6 @@ module.exports.CreateLetsEncrypt = function (parent) { obj.challenges = {}; obj.runAsProduction = false; obj.redirWebServerHooked = false; - obj.zerossl = false; - obj.csr = null; obj.configErr = null; obj.configOk = false; obj.pendingRequest = false; @@ -59,7 +57,6 @@ module.exports.CreateLetsEncrypt = function (parent) { // Get the current certificate obj.getCertificate = function(certs, func) { obj.runAsProduction = (obj.parent.config.letsencrypt.production === true); - obj.zerossl = ((typeof obj.parent.config.letsencrypt.zerossl == 'object') ? obj.parent.config.letsencrypt.zerossl : false); obj.log("Getting certs from local store (" + (obj.runAsProduction ? "Production" : "Staging") + ")"); if (certs.CommonName.indexOf('.') == -1) { obj.configErr = "Add \"cert\" value to settings in config.json before using Let's Encrypt."; parent.addServerWarning(obj.configErr); obj.log("WARNING: " + obj.configErr); func(certs); return; } if (obj.parent.config.letsencrypt == null) { obj.configErr = "No Let's Encrypt configuration"; parent.addServerWarning(obj.configErr); obj.log("WARNING: " + obj.configErr); func(certs); return; } @@ -167,36 +164,26 @@ module.exports.CreateLetsEncrypt = function (parent) { obj.log("Generating private key..."); acme.forge.createPrivateKey().then(function (accountKey) { + // TODO: ZeroSSL + // https://acme.zerossl.com/v2/DV90 + // Create the ACME client obj.log("Setting up ACME client..."); - if (obj.zerossl) { - if (obj.zerossl.kid == "") { obj.log("EAB KID hasn't been set, invalid configuration."); return; } - if (obj.zerossl.hmackey == "") { obj.log("EAB HMAC KEY hasn't been set, invalid configuration."); return; } - obj.client = new acme.Client({ - directoryUrl: acme.directory.zerossl.production, - accountKey: accountKey, - externalAccountBinding: { - kid: obj.zerossl.kid, - hmacKey: obj.zerossl.hmackey - } - }); - } else { - obj.client = new acme.Client({ - directoryUrl: obj.runAsProduction ? acme.directory.letsencrypt.production : acme.directory.letsencrypt.staging, - accountKey: accountKey - }); - } + obj.client = new acme.Client({ + directoryUrl: obj.runAsProduction ? acme.directory.letsencrypt.production : acme.directory.letsencrypt.staging, + accountKey: accountKey + }); // Create Certificate Request (CSR) obj.log("Creating certificate request..."); var certRequest = { commonName: obj.leDomains[0] }; if (obj.leDomains.length > 1) { certRequest.altNames = obj.leDomains; } acme.forge.createCsr(certRequest).then(function (r) { - obj.csr = r[1]; + var csr = r[1]; obj.tempPrivateKey = r[0]; - if(obj.zerossl) { obj.log("Requesting certificate from ZeroSSL..."); } else { obj.log("Requesting certificate from Let's Encrypt..."); } + obj.log("Requesting certificate from Let's Encrypt..."); obj.client.auto({ - csr: obj.csr, + csr, email: obj.parent.config.letsencrypt.email, termsOfServiceAgreed: true, skipChallengeVerification: (obj.parent.config.letsencrypt.skipchallengeverification === true), diff --git a/mcrec.js b/mcrec.js index 43966b88..565062a9 100644 --- a/mcrec.js +++ b/mcrec.js @@ -13,15 +13,27 @@ var worker = null; const NodeJSVer = Number(process.version.match(/^v(\d+\.\d+)/)[1]); var directRun = (require.main === module); function log() { if (directRun) { console.log(...arguments); } /*else { if (worker != null) { worker.parentPort.postMessage({ msg: arguments[0] }); } } */ } -function log2() { if (directRun) { console.log(...arguments); } else { process.send(...arguments); } /*else { if (worker != null) { worker.parentPort.postMessage({ msg: arguments[0] }); } } */ } if (directRun && (NodeJSVer >= 12)) { const xworker = require('worker_threads'); try { if (xworker.isMainThread == false) { worker = xworker; } } catch (ex) { log(ex); } } +function start() { startEx(process.argv); } +if (directRun) { setup(); } + +function setup() { InstallModules(['image-size'], start); } +function start() { startEx(process.argv); } +function startEx(argv) { + if (argv.length > 2) { indexFile(argv[2]); } else { + log("MeshCentral Session Recodings Processor"); + log("This tool will index a .mcrec file so that the player can seek thru the file."); + log(""); + log(" Usage: node mcrec [file]"); + } +} function indexFile(infile) { var state = { recFileName: null, recFile: null, recFileSize: 0, recFilePtr: 0 }; - if (fs.existsSync(infile) == false) { log2("Missing file: " + infile); return; } + if (fs.existsSync(infile) == false) { log("Missing file: " + infile); return; } state.recFileName = infile; state.recFileSize = fs.statSync(infile).size; - if (state.recFileSize < 32) { log2("Invalid file size: " + infile); return; } + if (state.recFileSize < 32) { log("Invalid file: " + infile); return; } log("Processing file: " + infile + ", " + state.recFileSize + " bytes."); state.recFile = fs.openSync(infile, 'r+'); state.indexTime = 10; // Interval between indexes in seconds @@ -31,8 +43,8 @@ function indexFile(infile) { state.height = 0; state.basePtr = null; readLastBlock(state, function (state, result, time, extras) { - if (result == false) { log2("Invalid file: " + infile); return; } - if (extras != null) { log2("File already indexed: " + infile); return; } + if (result == false) { log("Invalid file: " + infile); return; } + if (extras != null) { log("File already indexed: " + infile); return; } state.lastTimeStamp = time; readNextBlock(state, processBlock); }); @@ -56,7 +68,7 @@ function processBlock(state, block, err) { // Error reading the next block, exit now. fs.close(state.recFile, function () { for (var i in state) { delete state[i]; } // Clear the state. - log2("Error."); + log("Error."); }); return; } @@ -65,7 +77,7 @@ function processBlock(state, block, err) { writeIndex(state, function () { fs.close(state.recFile, function () { for (var i in state) { delete state[i]; } // Clear the state. - log2("Done."); + log("Done."); }); }); return; @@ -84,8 +96,8 @@ function processBlock(state, block, err) { if (block.type == 1) { // Metadata state.metadata = JSON.parse(block.data.toString()); - if (state.metadata.indexInterval != null) { log2("This file is already indexed."); return; } - if (state.metadata.protocol != 2) { log2("Only remote desktop sessions can currently be indexed."); return; } + if (state.metadata.indexInterval != null) { log("This file is already indexed."); return; } + if (state.metadata.protocol != 2) { log("Only remote desktop sessions can currently be indexed."); return; } state.metadataFlags = block.flags; state.metadataTime = block.time; state.recFileProtocol = state.metadata.protocol; @@ -304,7 +316,7 @@ function InstallModule(modulename, func, tag1, tag2) { if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); } // Looks like we need to keep a global reference to the child process object for this to work correctly. - InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 300000, cwd: parentpath }, function (error, stdout, stderr) { + InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) { InstallModuleChildProcess = null; if ((error != null) && (error != '')) { log('ERROR: Unable to install required module "' + modulename + '". May not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n'); @@ -317,18 +329,6 @@ function InstallModule(modulename, func, tag1, tag2) { }); } -function setup() { InstallModules(['image-size'], start); } -function start() { startEx(process.argv); } -function startEx(argv) { - if (argv.length > 2) { indexFile(argv[2]); } else { - log("MeshCentral Session Recordings Processor"); - log("This tool will index a .mcrec file so that the player can seek thru the file."); - log(""); - log(" Usage: node mcrec [file]"); - } -} -if (directRun) { setup(); } - // Export table module.exports.startEx = startEx; module.exports.indexFile = indexFile; \ No newline at end of file diff --git a/meshaccelerator.js b/meshaccelerator.js index 5e663383..c492f92b 100644 --- a/meshaccelerator.js +++ b/meshaccelerator.js @@ -32,20 +32,7 @@ module.exports.processMessage = function(message) { const sign = crypto.createSign('SHA384'); sign.end(Buffer.from(message.data, 'binary')); process.send(sign.sign(message.key).toString('binary')); - } catch (ex) { - // If this exception happens, try again. - if (ex.code == 'ERR_OSSL_DSO_COULD_NOT_LOAD_THE_SHARED_LIBRARY') { - try { - const sign = crypto.createSign('SHA384'); - sign.end(Buffer.from(message.data, 'binary')); - process.send(sign.sign(message.key).toString('binary')); - } catch (ex) { - process.send(null); - } - } else { - process.send(null); - } - } + } catch (e) { process.send(null); } break; } case 'setState': { diff --git a/meshagent.js b/meshagent.js index 7169b9ff..f4fa5419 100644 --- a/meshagent.js +++ b/meshagent.js @@ -58,15 +58,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { dataAccounting(); if ((arg == 1) || (arg == null)) { try { ws.close(); if (obj.nodeid != null) { parent.parent.debug('agent', 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket - if (arg == 2) { - try { + if (arg == 2) { + try { if (ws._socket._parent != null) ws._socket._parent.end(); else ws._socket.end(); - - if (obj.nodeid != null) { - parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); + + if (obj.nodeid != null) { + parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } @@ -616,7 +616,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } if ((mesh == null) && (typeof domain.orphanagentuser == 'string')) { - const adminUser = parent.users['user/' + domain.id + '/' + domain.orphanagentuser]; + const adminUser = parent.users['user/' + domain.id + '/' + domain.orphanagentuser.toLowerCase()]; if ((adminUser != null) && (adminUser.siteadmin == 0xFFFFFFFF)) { // Mesh name is hex instead of base64 const meshname = obj.meshid.substring(0, 18); @@ -1058,7 +1058,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { db.Get('iploc_' + obj.remoteaddr, function (err, iplocs) { if ((iplocs != null) && (iplocs.length == 1)) { // We have a location in the database for this remote IP - const iploc = iplocs[0], x = {}; + const iploc = nodes[0], x = {}; if ((iploc != null) && (iploc.ip != null) && (iploc.loc != null)) { x.publicip = iploc.ip; x.iploc = iploc.loc + ',' + (Math.floor((new Date(iploc.date)) / 1000)); @@ -1067,10 +1067,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } else { // Check if we need to ask for the IP location var doIpLocation = 0; - if (obj.iploc == null) { + if (device.iploc == null) { doIpLocation = 1; } else { - const loc = obj.iploc.split(','); + const loc = device.iploc.split(','); if (loc.length < 3) { doIpLocation = 2; } else { @@ -1363,16 +1363,6 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } if ((typeof command.sessionid == 'string') && (command.sessionid.length < 500)) { event.sessionid = command.sessionid; } parent.parent.DispatchEvent(targets, obj, event); - - // If this is a help request, see if we need to email notify anyone - if (event.msgid == 98) { - // Get the node and change it if needed - db.Get(obj.dbNodeKey, function (err, nodes) { // TODO: THIS IS A BIG RACE CONDITION HERE, WE NEED TO FIX THAT. If this call is made twice at the same time on the same device, data will be missed. - if ((nodes == null) || (nodes.length != 1)) { delete obj.deviceChanging; return; } - const device = nodes[0]; - if (typeof device.name == 'string') { parent.parent.NotifyUserOfDeviceHelpRequest(domain, device.meshid, device._id, device.name, command.msgArgs[0], command.msgArgs[1]); } - }); - } } break; } @@ -1748,9 +1738,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { try { obj.send(JSON.stringify({ action: 'amtconfig', user: '**MeshAgentApfTunnel**', pass: cookie })); } catch (ex) { } break; } - case 'script-task': { - // These command are for running regular batch jobs on the remote device - if (parent.parent.taskManager != null) { parent.parent.taskManager.agentAction(command, obj); } + case 'scriptTask': { + // TODO break; } default: { @@ -1775,7 +1764,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { if (inviteCookie == null) return; // Create the server url - var serverName = parent.getWebServerName(domain, req); + var serverName = parent.getWebServerName(domain); var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified var xdomain = (domain.dns == null) ? domain.id : ''; if (xdomain != '') xdomain += '/'; @@ -1842,7 +1831,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { // Event device share removal if (removedExact != null) { // Send out an event that we removed a device share - var targets = parent.CreateNodeDispatchTargets(obj.dbMeshKey, obj.dbNodeKey, ['server-shareremove']); + var targets = parent.CreateNodeDispatchTargets(obj.dbMeshKey, obj.dbNodeKey, []); var event = { etype: 'node', nodeid: obj.dbNodeKey, action: 'removedDeviceShare', msg: 'Removed Device Share', msgid: 102, msgArgs: ['Agent'], domain: domain.id, publicid: publicid }; parent.parent.DispatchEvent(targets, obj, event); } @@ -1920,14 +1909,6 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { if (!device.wsc) { device.wsc = {}; } if (JSON.stringify(device.wsc) != JSON.stringify(command.wsc)) { /*changes.push('Windows Security Center status');*/ device.wsc = command.wsc; change = 1; log = 1; } } - if (command.defender != null) { // Defender For Windows Server - if (!device.defender) { device.defender = {}; } - if (JSON.stringify(device.defender) != JSON.stringify(command.defender)) { /*changes.push('Defender status');*/ device.defender = command.defender; change = 1; log = 1; } - } - if (command.lastbootuptime != null) { // Last Boot Up Time - if (!device.lastbootuptime) { device.lastbootuptime = ""; } - if (device.lastbootuptime != command.lastbootuptime) { /*changes.push('Last Boot Up Time');*/ device.lastbootuptime = command.lastbootuptime; change = 1; log = 1; } - } // Push Messaging Token if ((command.pmt != null) && (typeof command.pmt == 'string') && (device.pmt != command.pmt)) { @@ -1936,18 +1917,14 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { change = 1; // Don't save this change as an event to the db, so no log=1. parent.removePmtFromAllOtherNodes(device); // We need to make sure to remove this push messaging token from any other device on this server, all domains included. } - + if ((command.users != null) && (Array.isArray(command.users)) && (device.users != command.users)) { device.users = command.users; change = 1; } // Don't save this to the db. - if ((command.lusers != null) && (Array.isArray(command.lusers)) && (device.lusers != command.lusers)) { device.lusers = command.lusers; change = 1; } // Don't save this to the db. if ((mesh.mtype == 2) && (!args.wanonly)) { // In WAN mode, the hostname of a computer is not important. Don't log hostname changes. if (device.host != obj.remoteaddr) { device.host = obj.remoteaddr; change = 1; changes.push('host'); } // TODO: Check that the agent has an interface that is the same as the one we got this websocket connection on. Only set if we have a match. } - // Remove old volumes and BitLocker data, this is part of sysinfo. - delete device.volumes; - // If there are changes, event the new device if (change == 1) { // Do some clean up if needed, these values should not be in the database. diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 91cec3b8..46060972 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -3,183 +3,56 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "MeshCentral configuration file schema", "type": "object", - "required": [ - "settings", - "domains" - ], "properties": { "settings": { "type": "object", "properties": { - "cert": { - "type": "string", - "description": "Set this to the primary DNS name of this MeshCentral server." - }, - "keepCerts": { - "type": "boolean", - "default": false, - "description": "Force MeshCentral to use the HTTPS and MPS certificates even if the name does not match the expected DNS value." - }, - "mongoDb": { - "type": "string", - "default": null - }, - "mongoDbName": { - "type": "string" - }, - "mongoDbChangeStream": { - "type": "boolean", - "default": false - }, - "mongoDbBulkOperations": { - "type": "boolean", - "default": false - }, + "cert": { "type": "string", "description": "Set this to the primary DNS name of this MeshCentral server." }, + "mongoDb": { "type": "string", "default": null }, + "mongoDbName": { "type": "string" }, + "mongoDbChangeStream": { "type": "boolean", "default": false }, + "mongoDbBulkOperations": { "type": "boolean", "default": false }, "mariaDB": { "type": "object", "description": "Add this section to connect MeshCentral to a MariaDB database instance.", "properties": { - "host": { - "type": "string", - "description": "MariaDB hostname" - }, - "user": { - "type": "string", - "description": "MariaDB username" - }, - "port": { - "type": "number", - "description": "MariaDB port number" - }, - "password": { - "type": "string", - "description": "MariaDB password" - }, - "connectionLimit": { - "type": "number", - "description": "MariaDB connection limit" - }, - "database": { - "type": "string", - "default": "meshcentral", - "description": "Name of MariaDB database used" - }, - "awsrds": { - "type": "boolean", - "default": false, - "description": "Set true to resolve LOCK TABLE permissions on AWS RDS." - }, - "ssl": { + "host": { "type": "string", "description": "MariaDB hostname" }, + "user": { "type": "string", "description": "MariaDB username" }, + "port": { "type": "number", "description": "MariaDB port number" }, + "password": { "type": "string", "description": "MariaDB password" }, + "connectionLimit": { "type": "number", "description": "MariaDB connection limit" }, + "database": { "type": "string", "default": "meshcentral", "description": "Name of MariaDB database used" }, + "awsrds": { "type": "boolean", "default": false, "description": "Set true to resolve LOCK TABLE permissions on AWS RDS." }, + "ssl": { "type": "object", "description": "SSL Options. Set to true (boolean) for default options.", "properties": { - "caCertPath": { - "type": "string", - "description": "Absolute path to the CA certificate. Required for self-signed certificates" - }, - "clientCertPath": { - "type": "string", - "description": "Absolute path to the client certificate. Required for two-way SSL Authentication" - }, - "clientKeyPath": { - "type": "string", - "description": "Absolute path to the client key. Required for two-way SSL Authentication" - }, - "dontCheckServerIdentity": { - "type": "boolean", - "description": "Set true to not check the server hostname during verification" - } + "caCertPath": { "type": "string", "description": "Absolute path to the CA certificate. Required for self-signed certificates" }, + "clientCertPath": { "type": "string", "description": "Absolute path to the client certificate. Required for two-way SSL Authentication" }, + "clientKeyPath": { "type": "string", "description": "Absolute path to the client key. Required for two-way SSL Authentication" }, + "dontCheckServerIdentity": { "type": "boolean", "description": "Set true to not check the server hostname during verification" } } } } }, - "sqlite3": { - "type": [ "boolean", "string", "object" ], - "default": false, - "description": "Set boolean true to use SQLite3 as a local MeshCentral database with default db filename 'meshcentral' or enter a string for a different db filename. Extension .sqlite is appended", - "properties":{ - "name": { - "type": "string", - "default": "meshcentral", - "description": "Database filename. '.sqlite' is appended" - }, - "journalMode": { - "type": "string", - "default": "delete", - "description": "DELETE, TRUNCATE, PERSIST, MEMORY, WAL. NONE not allowed. See: https://www.sqlite.org/pragma.html#pragma_journal_mode" - }, - "journalSize": { - "type": "integer", - "default": 4096000, - "description": "Maximum size of the journal file in bytes. Can grow larger if needed, but will shrink to this size. -1 is unlimited growth. See: https://www.sqlite.org/pragma.html#pragma_journal_size_limit" - }, - "autoVacuum": { - "type": "string", - "default": "incremental", - "description": "none, full, incremental. Removes unused pages and shrinks databasefile during maintenance. See: https://www.sqlite.org/pragma.html#pragma_auto_vacuum" - }, - "incrementalVacuum": { - "type": "integer", - "default": 100, - "description": "Maximum amount of pages to free during maintenance. Default page size is 4k, so default frees up to 400k from the databasefile. See: https://www.sqlite.org/pragma.html#pragma_incremental_vacuum" - }, - "startupVacuum": { - "type": "boolean", - "default": false, - "description": "Do a full VACUUM at startup. Shrinks the db file and optimizes it. This can take some time with a large database and can temporarily take up to double the database size on disk. See: https://www.sqlite.org/lang_vacuum.html" - } - } - }, "mySQL": { "type": "object", "description": "Add this section to connect MeshCentral to a MySQL database instance.", "properties": { - "host": { - "type": "string", - "description": "MySQL hostname" - }, - "port": { - "type": "number", - "description": "MySQL port number" - }, - "user": { - "type": "string", - "description": "MySQL username" - }, - "password": { - "type": "string", - "description": "MySQL password" - }, - "database": { - "type": "string", - "default": "meshcentral", - "description": "Name of MySQL database used" - }, - "awsrds": { - "type": "boolean", - "default": false, - "description": "Set true to resolve LOCK TABLE permissions on AWS RDS." - }, + "host": { "type": "string", "description": "MySQL hostname" }, + "port": { "type": "number", "description": "MySQL port number" }, + "user": { "type": "string", "description": "MySQL username" }, + "password": { "type": "string", "description": "MySQL password" }, + "database": { "type": "string", "default": "meshcentral", "description": "Name of MySQL database used" }, + "awsrds": { "type": "boolean", "default": false, "description": "Set true to resolve LOCK TABLE permissions on AWS RDS." }, "ssl": { "type": "object", "description": "SSL Options. Set to true (boolean) for default options.", "properties": { - "caCertPath": { - "type": "string", - "description": "Absolute path to the CA certificate. Required for self-signed certificates" - }, - "clientCertPath": { - "type": "string", - "description": "Absolute path to the client certificate. Required for two-way SSL Authentication" - }, - "clientKeyPath": { - "type": "string", - "description": "Absolute path to the client key. Required for two-way SSL Authentication" - }, - "dontCheckServerIdentity": { - "type": "boolean", - "description": "Set true to not check the server hostname during verification" - } + "caCertPath": { "type": "string", "description": "Absolute path to the CA certificate. Required for self-signed certificates" }, + "clientCertPath": { "type": "string", "description": "Absolute path to the client certificate. Required for two-way SSL Authentication" }, + "clientKeyPath": { "type": "string", "description": "Absolute path to the client key. Required for two-way SSL Authentication" }, + "dontCheckServerIdentity": { "type": "boolean", "description": "Set true to not check the server hostname during verification" } } } } @@ -188,755 +61,146 @@ "type": "object", "description": "Add this section to connect MeshCentral to a PostgreSQL database instance.", "properties": { - "host": { - "type": "string", - "description": "PostgreSQL hostname" - }, - "user": { - "type": "string", - "description": "PostgreSQL username" - }, - "port": { - "type": "number", - "description": "PostgreSQL port number" - }, - "password": { - "type": "string", - "description": "PostgreSQL password" - }, - "database": { - "type": "string", - "default": "meshcentral", - "description": "Name of PostgreSQL database used" - } + "host": { "type": "string", "description": "PostgreSQL hostname" }, + "user": { "type": "string", "description": "PostgreSQL username" }, + "port": { "type": "number", "description": "PostgreSQL port number" }, + "password": { "type": "string", "description": "PostgreSQL password" }, + "database": { "type": "string", "default": "meshcentral", "description": "Name of PostgreSQL database used" } } }, - "acebase": { - "type": "object", - "description": "Add this section to enable AceBase database support, this is a local database system much like NeDB.", - "properties": { - "sponsor": { - "type": "boolean", - "default": false, - "description": "Set true to remove the AceBase banner on startup." - } - } - }, - "WANonly": { - "type": "boolean", - "default": false, - "description": "When enabled, only MeshCentral WAN features are enabled and agents will connect to the server using a well known DNS name." - }, - "LANonly": { - "type": "boolean", - "default": false, - "description": "When enabled, only MeshCentral LAN features are enabled and agents will find the server using multicast LAN packets." - }, - "maintenanceMode": { - "type": "boolean", - "default": false, - "description": "When enabled the server is in maintenance mode, only administrators can login. Use the maintenance command in server console to change." - }, - "certificatePrivateKeyPassword": { - "type": "array", - "default": null, - "description": "List of passwords used to decrypt PKCK#8 .key files that are in the meshcentral-data folder." - }, - "sessionTime": { - "type": "integer", - "default": 60, - "description": "Duration of a session cookie in minutes. Changing this affects how often the session needs to be automatically refreshed." - }, - "sessionKey": { - "type": "string", - "default": null, - "description": "Password used to encrypt the MeshCentral web session cookies. If null, a random one is generated each time the server starts." - }, - "sessionSameSite": { - "type": "string", - "default": "lax", - "enum": [ - "strict", - "lax", - "none" - ] - }, - "dbEncryptKey": { - "type": "string", - "default": null, - "description": "This value is only valid when used with NeDB, sets the database encryption and decryption key." - }, - "dbRecordsEncryptKey": { - "type": "string", - "default": null, - "description": "With any database, encrypt and decrypt sensitive information within records using this secret key." - }, - "dbRecordsDecryptKey": { - "type": "string", - "default": null, - "description": "With any database, decrypt sensitive information within records using this secret key, don't use a key to encrypt records." - }, + "WANonly": { "type": "boolean", "default": false, "description": "When enabled, only MeshCentral WAN features are enabled and agents will connect to the server using a well known DNS name." }, + "LANonly": { "type": "boolean", "default": false, "description": "When enabled, only MeshCentral LAN features are enabled and agents will find the server using multicast LAN packets." }, + "maintenanceMode": { "type": "boolean", "default": false, "description": "When enabled the server is in maintenance mode, only administrators can login. Use the maintenance command in server console to change." }, + "certificatePrivateKeyPassword": { "type": "array", "default": null, "description": "List of passwords used to decrypt PKCK#8 .key files that are in the meshcentral-data folder." }, + "sessionTime": { "type": "integer", "default": 60, "description": "Duration of a session cookie in minutes. Changing this affects how often the session needs to be automatically refreshed." }, + "sessionKey": { "type": "string", "default": null, "description": "Password used to encrypt the MeshCentral web session cookies. If null, a random one is generated each time the server starts." }, + "sessionSameSite": { "type": "string", "default": "lax", "enum": ["strict", "lax", "none"] }, + "dbEncryptKey": { "type": "string" }, + "dbRecordsEncryptKey": { "type": "string", "default": null }, + "dbRecordsDecryptKey": { "type": "string", "default": null }, "dbExpire": { "type": "object", "properties": { - "events": { - "type": "integer", - "default": 1728000, - "description": "Amount of time in seconds that events are kept in the database." - }, - "powerevents": { - "type": "integer", - "default": 864000, - "description": "Amount of time in seconds that device power events are kept in the database." - }, - "statsevents": { - "type": "integer", - "default": 2592000, - "description": "Amount of time in seconds that server statistics are kept in the database." - } + "events": { "type": "integer", "default": 1728000, "description": "Amount of time in seconds that events are kept in the database." }, + "powerevents": { "type": "integer", "default": 864000, "description": "Amount of time in seconds that device power events are kept in the database." }, + "statsevents": { "type": "integer", "default": 2592000, "description": "Amount of time in seconds that server statistics are kept in the database." } } }, - "port": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "default": 443, - "description": "Ths port of the main HTTPS server." - }, - "portBind": { - "type": "string", - "description": "When set, bind the HTTPS main port to a specific network address." - }, - "aliasPort": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "default": null, - "description": "The actual main port as seen externally on the Internet, this setting is often used when a reverse-proxy is used." - }, - "redirPort": { - "type": "integer", - "minimum": 0, - "maximum": 65535, - "default": 80, - "description": "This is a HTTP web server port that mostly redirects users to the HTTPS port but does provide some other services, 0 will turn this port off." - }, - "redirPortBind": { - "type": "string", - "description": "When set, bind the HTTP redirection port to a specific network address." - }, - "redirAliasPort": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "description": "The actual redirection port as seen externally on the Internet, this setting is often used when a reverse-proxy is used." - }, - "relayPort": { - "type": "integer", - "minimum": 0, - "maximum": 65535, - "default": 0, - "description": "When set, a web relay web server is bound to this port and will allow user access to remote web sites." - }, - "relayAliasPort": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "default": null, - "description": "The actual relay port as seen externally on the Internet, this setting is often used when a reverse-proxy is used." - }, - "relayDNS": { - "type": "string", - "default": null, - "description": "When set, relayPort value is ignored. Set this to a DNS name the points to this server. When the server is accessed using the DNS name, the main web server port is used as a web relay port." - }, - "agentPort": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "description": "When set, enabled a new HTTPS server port that only accepts agent connections." - }, - "agentPortBind": { - "type": "string", - "description": "When set, binds the agent port to a specific network interface." - }, - "agentAliasPort": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "description": "When set, indicates the actual publicly visible agent-only port. If not set, the AgentPort value is used." - }, - "agentAliasDNS": { - "type": "string", - "format": "hostname", - "description": "When set, specified the DNS name used by agents to connect to the agent-only port." - }, - "agentPortTls": { - "type": "boolean", - "default": true, - "description": "Indicates if the agent-only port must perform TLS, this should be set to false if TLS is performed in front of this server." - }, - "agentLogDump": { - "type": "boolean", - "default": false, - "description": "Automatically downloads all agent error logs into meshcentral-data/agenterrorlogs.txt." - }, - "agentCoreDump": { - "type": "boolean", - "default": false, - "description": "Automatically activates and transfers any agent crash dump files to the server in meshcentral-data/coredumps." - }, - "agentCoreDumpUsers": { - "type": "array", - "description": "List of non-administrator users that have access to mesh agent crash dumps." - }, - "agentSignLock": { - "type": "boolean", - "default": false, - "description": "When code signing an agent using authenticode, lock the agent to only allow connection to this server. (This is in testing, the default value will change to true in the future)." - }, - "agentTimeStampServer": { - "type": [ - "boolean", - "string" - ], - "default": "http://timestamp.comodoca.com/authenticode", - "description": "The time stamping server to use when code signing Windows executables. When set to false, the executables are not time stamped." - }, - "agentTimeStampProxy": { - "type": [ - "boolean", - "string" - ], - "description": "The HTTP proxy to use when contacting the time stamping server, if false, no proxy is used. By default, the npmproxy value is used." - }, - "lockAgentDownload": { - "type": "boolean", - "default": false, - "description": "When enabled, MeshCentral will block all downloads of MeshAgent including install scripts, if the user is not logged in" - }, - "ignoreAgentHashCheck": { - "type": [ - "boolean", - "string" - ], - "default": false, - "description": "When true, the agent no longer checked the TLS certificate of the server. This should be used for debugging only. You can also set this to a comma separated list of IP addresses to ignore, for example: \"192.168.2.100,192.168.1.0/24\"." - }, - "exactPorts": { - "type": "boolean", - "default": false, - "description": "When set to true, MeshCentral will only grab the required TCP listening ports or fail. It will not try to use the next available port of it's busy." - }, - "allowLoginToken": { - "type": "boolean", - "default": false, - "description": "When set to true, MeshCentral will allow login tokens to be used in the URL as a replacement for user login. This is useful along with \"allowFraming\" option to embed MeshCentral features into another website" - }, - "StrictTransportSecurity": { - "type": [ - "boolean", - "string" - ], - "default": null, - "description": "Controls the Strict-Transport-Security header, default is 1 year. Set to false to remove, true to force enable, or string to set a custom value. If set to null, MeshCentral will enable if a trusted certificate is set." - }, - "allowFraming": { - "type": "boolean", - "default": false, - "description": "When enabled, the MeshCentral web site can be embedded within another website's iframe." - }, - "cookieIpCheck": { - "type": [ - "string", - "boolean" - ], - "default": "lax", - "enum": [ - "strict", - "lax", - "none" - ] - }, - "cookieEncoding": { - "type": "string", - "enum": [ - "hex", - "base64" - ], - "default": "base64", - "description": "Encoding format of cookies in the HTTP headers, this is typically Base64 but some reverse proxies will require HEX." - }, - "webRTC": { - "type": "boolean", - "default": false, - "description": "When enabled, allows use of WebRTC to allow direct network traffic between the agent and browser." - }, - "nice404": { - "type": "boolean", - "default": true, - "description": "By default, a nice looking 404 error page is displayed when needed. Set this to false to disable it." - }, - "selfUpdate": { - "type": [ - "string", - "boolean" - ], - "default": false, - "description": "When set to true, the server will check for a new version and attempt to self-update automatically a bit after midnight local time every day. If set to a specific version such as \"1.1.21\" the server will immediately update to the specified version on startup if it's not already at this version." - }, - "cleanNpmCacheOnUpdate": { - "type": "boolean", - "default": false, - "description": "When true, run \"npm cache clean --force\" to reclaim disk space." - }, - "browserPing": { - "type": "integer", - "minimum": 1, - "description": "When specified, sends data to the browser at x seconds interval and expects a response from the browser." - }, - "browserPong": { - "type": "integer", - "minimum": 1, - "description": "When specified, sends data to the browser at x seconds interval." - }, - "agentsInRam": { - "type": "boolean", - "default": false, - "description": "Loads all agent binaries in RAM for faster agent updates." - }, - "agentPing": { - "type": "integer", - "minimum": 1, - "description": "When specified, sends data to the agent at x seconds interval and expects a response from the agent." - }, - "agentPong": { - "type": "integer", - "minimum": 1, - "description": "When specified, sends data to the agent at x seconds interval." - }, - "amtManager": { - "type": "boolean", - "default": true, - "description": "When enabled, MeshCentral will automatically monitor and manage Intel AMT devices." - }, - "agentIdleTimeout": { - "type": "integer", - "minimum": 1, - "default": 150, - "description": "How much time in seconds with no traffic from an agent before dropping the agent connection." - }, - "webPageLengthRandomization": { - "type": "boolean", - "default": true, - "description": "Adds a random length string to generated web pages to mitigate a BREACH attack." - }, - "compression": { - "type": "boolean", - "default": true, - "description": "Enables GZIP compression for web requests." - }, - "wsCompression": { - "type": "boolean", - "default": false, - "description": "Enables server-side, websocket per-message deflate compression." - }, - "agentWsCompression": { - "type": "boolean", - "default": true, - "description": "Enables agent-side, websocket per-message deflate compression. wscompression must also be true for this to work." - }, - "noAgentUpdate": { - "type": "integer", - "default": 0, - "description": "Set to 1 to present the server from updating any agent." - }, - "agentUpdateSystem": { - "type": "integer", - "default": 1, - "description": "When set to 2, all agents that need to be updated will use the meshcore.js update system. With the default value of 1, the native update system is used." - }, - "temporaryAgentUpdate": { - "type": "boolean", - "default": true, - "description": "Set to false to not allow temporary agents to be updated." - }, - "amtScanner": { - "type": "boolean", - "default": true, - "description": "Set to false to disable Intel AMT scanning on the local network, this is already disabled in WAN mode." - }, - "meshScanner": { - "type": "boolean", - "default": true, - "description": "Set to false to disable agent multicast scanning on the local network, this is already disabled in WAN mode." - }, - "meshErrorLogPath": { - "type": "string" - }, - "npmPath": { - "type": "string" - }, - "npmProxy": { - "type": "string", - "format": "uri" - }, - "allowHighQualityDesktop": { - "type": "boolean", - "default": true, - "description": "When false, users will only be able to set remote desktop image quality to 60%, this can reduce server bandwidth usage." - }, + "port": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "portBind": { "type": "string", "description": "When set, bind the HTTPS main port to a specific network address." }, + "aliasPort": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "redirPort": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "redirPortBind": { "type": "string", "description": "When set, bind the HTTP redirection port to a specific network address." }, + "redirAliasPort": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "agentPort": { "type": "integer", "minimum": 1, "maximum": 65535, "description": "When set, enabled a new HTTPS server port that only accepts agent connections." }, + "agentPortBind": { "type": "string", "description": "When set, binds the agent port to a specific network interface." }, + "agentAliasPort": { "type": "integer", "minimum": 1, "maximum": 65535, "description": "When set, indicates the actual publically visible agent-only port. If not set, the AgentPort value is used." }, + "agentAliasDNS": { "type": "string", "format": "hostname", "description": "When set, specified the DNS name used by agents to connect to the agent-only port." }, + "agentPortTls": { "type": "boolean", "default": true, "description": "Indicates if the agent-only port must perform TLS, this should be set to false if TLS is performed in front of this server." }, + "agentLogDump": { "type": "boolean", "default": false, "description": "Automatically downloads all agent error logs into meshcentral-data/agenterrorlogs.txt." }, + "agentCoreDump": { "type": "boolean", "default": false, "description": "Automatically activates and transfers any agent crash dump files to the server in meshcentral-data/coredumps." }, + "agentCoreDumpUsers": { "type": "array", "description": "List of non-administrator users that have access to mesh agent crash dumps." }, + "agentSignLock": { "type": "boolean", "default": false, "description": "When code signing an agent using authenticode, lock the agent to only allow connection to this server. (This is in testing, the default value will change to true in the future)." }, + "agentTimeStampServer": { "type": [ "boolean", "string" ], "default": "http://timestamp.comodoca.com/authenticode", "description": "The time stamping server to use when code signing Windows executables. When set to false, the executables are not time stamped." }, + "agentTimeStampProxy": { "type": [ "boolean", "string" ], "description": "The HTTP proxy to use when contacting the time stamping server, if false, no proxy is used. By default, the npmproxy value is used." }, + "ignoreAgentHashCheck": { "type": [ "boolean", "string" ], "default": false, "description": "When true, the agent no longer checked the TLS certificate of the server. This should be used for debugging only. You can also set this to a comma seperated list of IP addresses to ignore, for example: \"192.168.2.100,192.168.1.0/24\"." }, + "exactPorts": { "type": "boolean", "default": false, "description": "When set to true, MeshCentral will only grab the required TCP listening ports or fail. It will not try to use the next available port of it's busy." }, + "allowLoginToken": { "type": "boolean", "default": false }, + "StrictTransportSecurity": { "type": ["boolean", "string"], "default": null, "description": "Controls the Strict-Transport-Security header, default is 1 year. Set to false to remove, true to force enable, or string to set a custom value. If set to null, MeshCentral will enable if a trusted certificate is set." }, + "allowFraming": { "type": "boolean", "default": false, "description": "When enabled, the MeshCentral web site can be embedded within another website's iframe." }, + "cookieIpCheck": { "type": [ "string", "boolean" ], "default": "lax", "enum": ["strict", "lax", "none"] }, + "cookieEncoding": { "type": "string", "enum": [ "hex", "base64" ], "default": "base64", "description": "Encoding format of cookies in the HTTP headers, this is typically Base64 but some reverse proxies will require HEX." }, + "webRTC": { "type": "boolean", "default": false, "description": "When enabled, allows use of WebRTC to allow direct network traffic between the agent and browser." }, + "nice404": { "type": "boolean", "default": true, "description": "By default, a nice looking 404 error page is displayed when needed. Set this to false to disable it." }, + "selfUpdate": { "type": "boolean", "default": false, "description": "When true, this server will attempt to self-update everyday after midnight." }, + "cleanNpmCacheOnUpdate": { "type": "boolean", "default": false, "description": "When true, run \"npm cache clean --force\" to reclame disk space." }, + "browserPing": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the browser at x seconds interval and expects a response from the browser." }, + "browserPong": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the browser at x seconds interval." }, + "agentsInRam": { "type": "boolean", "default": false, "description": "Loads all agent binaries in RAM for faster agent updates." }, + "agentPing": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the agent at x seconds interval and expects a response from the agent." }, + "agentPong": { "type": "integer", "minimum": 1, "description": "When specified, sends data to the agent at x seconds interval." }, + "amtManager": { "type": "boolean", "default": true, "description": "When enabled, MeshCentral will automatically monitor and manage Intel AMT devices." }, + "orphanAgentUser": { "type": "string", "default": null, "description": "If an agent attempts to connect to a unknown device group, automatically create a new device group and grant access to the specified user. Example: admin" }, + "agentIdleTimeout": { "type": "integer", "minimum": 1, "default": 150 ,"description": "How much time in seconds with no traffic from an agent before dropping the agent connection." }, + "webPageLengthRandomization": { "type": "boolean", "default": true, "description": "Adds a random length string to generated web pages to mitigate a BREACH attack." }, + "compression": { "type": "boolean", "default": true, "description": "Enables GZIP compression for web requests." }, + "wsCompression": { "type": "boolean", "default": false, "description": "Enables server-side, websocket per-message deflate compression." }, + "agentWsCompression": { "type": "boolean", "default": true, "description": "Enables agent-side, websocket per-message deflate compression. wscompression must also be true for this to work." }, + "noAgentUpdate": { "type": "integer", "default": 0, "description": "Set to 1 to present the server from updating any agent." }, + "agentUpdateSystem": { "type": "integer", "default": 1, "description": "When set to 2, all agents that need to be updated will use the meshcore.js update system. With the default value of 1, the native update system is used." }, + "temporaryAgentUpdate": { "type": "boolean", "default": true, "description": "Set to false to not allow temporary agents to be updated." }, + "amtScanner": { "type": "boolean", "default": true, "description": "Set to false to disable Intel AMT scanning on the local network, this is already disabled in WAN mode." }, + "meshScanner": { "type": "boolean", "default": true, "description": "Set to false to disable agent multicast scanning on the local network, this is already disabled in WAN mode." }, + "meshErrorLogPath": { "type": "string" }, + "npmPath": { "type": "string" }, + "npmProxy": { "type": "string", "format": "uri" }, + "allowHighQualityDesktop": { "type": "boolean", "default": true, "description": "When false, users will only be able to set remote desktop image quality to 60%, this can reduce server bandwidth usage." }, "webPush": { "type": "object", "description": "When set with a valid email address, enables the MeshCentral web push notification feature. Allows administrators to send browser notifications to users even if they are not looking at the MeshCentral web site.", + "additionalProperties": false, "properties": { - "email": { - "type": "string", - "description": "Server administrator email given to the FireFox and Chrome push notification services." - } + "email": { "type": "string", "description": "Server administrator email given to the FireFox and Chrome push notification services." } }, - "required": [ - "email" - ] - }, - "RunOnServerStarted": { - "type": "boolean", - "default": null, - "description": "Execute this when the server startup is completed. The first parameter will be the server version." - }, - "RunOnServerUpdated": { - "type": "boolean", - "default": null, - "description": "Execute this when the server has been updated. The first parameter will be the server version." - }, - "RunOnServerError": { - "type": "boolean", - "default": null, - "description": "Execute this when the server has to restart due to an error. The first parameter will be the server version." - }, - "publicPushNotifications": { - "type": "boolean", - "default": false, - "description": "When true, this server uses MeshCentral.com a push notification relay for Android notifications. Push notifications work even if the Android app is not open." - }, - "desktopMultiplex": { - "type": "boolean", - "default": false, - "description": "When true, enabled a server modules that efficiently splits a remote desktop stream to multiple browsers. Also allows slow browsers to not slow down the session for fast ones, this comes at the cost of extra server memory and processing for all remote desktop sessions." - }, - "ipBlockedUserRedirect": { - "type": "string", - "default": null, - "description": "If set, a user from a banned IP address will be redirected to this URL." - }, - "userAllowedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, only users from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:userAllowedIP.txt\"" - }, - "userBlockedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, users from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:userBlockedIP.txt\"" - }, - "agentAllowedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, only agents from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:agentAllowedIP.txt\"" - }, - "agentBlockedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, agents from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:agentBlockedIP.txt\"" - }, - "authLog": { - "type": "string", - "default": null, - "description": "File path and name of the authentication log to be created. This log can be parsed by Fail2ban." - }, - "InterUserMessaging": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - }, - "description": "Users in this list are allowed to send and receive inter-user messages. This can be used to implement bots or other software where MeshCentral is used as data transport. See \"interuser\" websocket command in the code." - }, - "manageAllDeviceGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - }, - "description": "Users in this list are allowed to see and manage all device groups within their domain." - }, - "manageCrossDomain": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - }, - "description": "Users in this list are allowed to manage all users in all domains." + "required": [ "email" ] }, + "RunOnServerStarted": { "type": "boolean", "default": null, "description": "Execute this when the server startup is completed. The first parameter will be the server version." }, + "RunOnServerUpdated": { "type": "boolean", "default": null, "description": "Execute this when the server has been updated. The first parameter will be the server version." }, + "RunOnServerError": { "type": "boolean", "default": null, "description": "Execute this when the server has to restart due to an error. The first parameter will be the server version." }, + "publicPushNotifications": { "type": "boolean", "default": false, "description": "When true, this server uses MeshCentral.com a push notification relay for Android notifications. Push notifications work even if the Android app is not open." }, + "desktopMultiplex": { "type": "boolean", "default": false, "description": "When true, enabled a server modules that efficiently splits a remote desktop stream to multiple browsers. Also allows slow browsers to not slow down the session for fast ones, this comes at the cost of extra server memory and processing for all remote desktop sessions." }, + "ipBlockedUserRedirect" : { "type": "string", "default": null, "description": "If set, a user from a banned IP address will be redirected to this URL." }, + "userAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only users from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "userBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, users from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only agents from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, agents from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "authLog": { "type": "string", "default": null, "description": "File path and name of the authentication log to be created. This log can be parsed by Fail2ban." }, + "InterUserMessaging": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Users in this list are allowed to send and receive inter-user messages. This can be used to implement bots or other software where MeshCentral is used as data transport. See \"interuser\" websocket command in the code." }, + "manageAllDeviceGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Users in this list are allowed to see and manage all device groups within their domain." }, + "manageCrossDomain": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Users in this list are allowed to manage all users in all domains." }, "localDiscovery": { "type": "object", "description": "When this server is in LAN mode, you may discover this server using a multicast discovery tool. When discovery happens, the name and info fields are sent back to the discovery tool.", + "additionalProperties": false, "properties": { - "name": { - "type": "string" - }, - "info": { - "type": "string" - }, - "key": { - "type": "string", - "description": "When set, encrypts all LAN discovery traffic to agents and tools using this key. This is only useful in LAN/Hybrid mode when agents and tools user multicast to find the server." - } + "name": { "type": "string" }, + "info": { "type": "string" }, + "key": { "type": "string", "description": "When set, encrypts all LAN discovery traffic to agents and tools using this key. This is only useful in LAN/Hybrid mode when agents and tools user multicast to find the server." } }, - "required": [ - "name", - "info" - ] - }, - "tlsOffload": { - "type": [ - "boolean", - "string" - ], - "default": false, - "description": "When true, indicates that a TLS offloader is in front of the MeshCentral server. More typically, set this to the IP address of the reverse proxy or TLS offloader so that IP forwarding headers will be trusted. For example: \"127.0.0.1,192.168.1.100\"." - }, - "useNodeDefaultTLSCiphers": { - "type": "boolean", - "default": false, - "description": "When true, get the default TLS ciphers from the node process, rather than using the recommended suites set up by meshcentral" - }, - "tlsCiphers": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "Allows user to override the TLS ciphers used by meshcentral by default. If a string, should be a ':' separated list of ciphers to accept. If an array, should be an array of strings representing the ciphers to accept." - }, - "trustedProxy": { - "type": "string", - "default": null, - "description": "Trust forwarded headers from these IPs or domains. Providing the magic string \"CloudFlare\" will cause the server to download the IP address list of trusted CloudFlare proxies directly from CloudFlare on each server start. For example: \"127.0.0.1,proxy.example.com,CloudFlare\"." - }, - "mpsPort": { - "type": "integer", - "minimum": 0, - "maximum": 65535, - "default": 4433, - "description": "The Management Presence Server (MPS), this is the server that received Intel AMT Client Initiated Remote Access (CIRA) connections." - }, - "mpsPortBind": { - "type": "string", - "default": null - }, - "mpsAliasPort": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "default": null - }, - "mpsAliasHost": { - "type": "string", - "default": null - }, - "mpsTlsOffload": { - "type": "boolean", - "default": false, - "description": "When set to true, indicate that TLS is being performed by a device in front of MeshCentral." - }, - "mpsHighSecurity": { - "type": "boolean", - "default": false, - "description": "When set to true, the MPS server will only accept TLS 1.2 and 1.3 connections. Older Intel AMT devices will not be able to connect." - }, - "prometheus": { - "type": [ - "boolean", - "number" - ], - "default": false, - "description": "When set to true, a prometheus metrics endpoint will be available \"0.0.0.0:9464/metrics\". If you specify a number instead, the prometheus metrics will listen on this port instead of the default 9464." - }, - "no2FactorAuth": { - "type": "boolean", - "default": false - }, - "debug": { - "type": "string", - "default": null, - "description": "You can set this value in the format 'web,agent,relay', where each value is separated by a comma. Each specified value will output logs to the MeshCentral console. Setting it to '*' will output all logs." - }, - "log": { - "type": "string", - "default": null, - "description": "You can set this value in the format 'web,agent,relay', where each value is separated by a comma. Each specified value will output logs to a file named 'log.txt' located inside the 'meshcentral-data' folder. Setting it to '*' will output all logs." - }, - "syslog": { - "type": "string", - "default": null - }, - "syslogauth": { - "type": "string", - "default": null - }, - "syslogjson": { - "type": "string", - "default": null - }, - "syslogtcp": { - "type": "string", - "default": null, - "description": "Send syslog events over the network (RFC3164) to a target hostname:port. For example: localhost:514" + "required": [ "name", "info" ] }, + "tlsOffload": { "type": [ "boolean", "string" ], "default": false, "description": "When true, indicates that a TLS offloader is in front of the MeshCentral server. More typically, set this to the IP address of the reverse proxy or TLS offloader so that IP forwarding headers will be trusted. For example: \"127.0.0.1,192.168.1.100\"." }, + "trustedProxy": { "type": "string", "default": null, "description": "Trust forwarded headers from these IPs or domains. Providing the magic string \"CloudFlare\" will cause the server to download the IP address list of trusted CloudFlare proxies directly from CloudFlare on each server start. For example: \"127.0.0.1,proxy.example.com,CloudFlare\"." }, + "mpsPort": { "type": "integer", "minimum": 0, "maximum": 65535, "default": 4433, "description": "The Management Presence Server (MPS), this is the server that received Intel AMT Client Initiated Remote Access (CIRA) connections." }, + "mpsPortBind": { "type": "string", "default": null }, + "mpsAliasPort": { "type": "integer", "minimum": 1, "maximum": 65535, "default": null }, + "mpsAliasHost": { "type": "string", "default": null }, + "mpsTlsOffload": { "type": "boolean", "default": false, "description": "When set to true, indicate that TLS is being performed by a device in front of MeshCentral." }, + "mpsHighSecurity": { "type": "boolean", "default": false, "description": "When set to true, the MPS server will only accept TLS 1.2 and 1.3 connections. Older Intel AMT devices will not be able to connect." }, + "no2FactorAuth": { "type": "boolean", "default": false }, + "log": { "type": "string", "default": null }, + "syslog": { "type": "string", "default": null }, + "syslogauth": { "type": "string", "default": null }, + "syslogjson": { "type": "string", "default": null }, + "syslogtcp": { "type": "string", "default": null, "description": "Send syslog events over the network (RFC3164) to a target hostname:port. For example: localhost:514" }, "webrtcConfig": { "type": "object", - "description": "The STUN/TURN servers used for WebRTC, if not specified the Google and Cloudflare STUN servers are used when the server is not in LAN mode.", + "additionalProperties": false, + "description": "The STUN servers used for WebRTC, if not specified the Google and Mozilla servers and used when the server is not in LAN mode.", "properties": { - "iceServers": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "object", - "properties": { - "urls": { - "type": "string", - "description": "STUN/TURN URLs, examples are stun:stun3.l.google.com:19302 or turn:openrelay.metered.ca:443" - } - }, - "required": [ - "urls" - ] - } - } + "iceServers": { "type": "array", "uniqueItems": true, "items": { "type": "object", "additionalProperties": false, "properties": { "urls": { "type": "string" } }, "required": [ "urls" ] } } }, - "required": [ - "iceServers" - ] - }, - "crowdsec": { - "type": "object", - "description": "Enabled the MeshCentral built-in Crowdsec bouncer. This section is passed directly to the bouncer, all of the settings are documented at https://www.npmjs.com/package/@crowdsec/express-bouncer", - "properties": { - "url": { - "type": "string", - "description": "The URL of your LAPI instance. Ex: http://localhost:8080" - }, - "apiKey": { - "type": "string", - "description": "The bouncer key (generated via cscli)." - }, - "fallbackRemediation": { - "type": "string", - "default": "ban", - "enum": [ - "bypass", - "captcha", - "ban" - ], - "description": "Action to perform if the CrowdSec agent can't be contacted." - } - }, - "required": [ - "url", - "apiKey" - ] + "required": [ "iceServers" ] }, "autoBackup": { - "type": [ - "boolean", - "object" - ], - "description": "Enabled by default or if set to true. Disabled if set to false. An object can be provided with additional properties to set autobackup options.", + "type": "object", "properties": { - "mongoDumpPath": { - "type": "string", - "default": "mongodump", - "description": "The file path of where \"mongodump\" is located. Default is \"mongodump\"" - }, - "mysqlDumpPath": { - "type": "string", - "default": "mysqldump", - "description": "The file path of where \"mysqldump\" is located. Default is \"mysqldump\"" - }, - "pgDumpPath": { - "type": "string", - "default": "pg_dump", - "description": "The file path of where \"pg_dump\" is located. Default is \"pg_dump\"" - }, - "backupIntervalHours": { - "type": "integer", - "default": 24, - "description": "How often should the autobackup run in hours from the second meshcentral starts up? Default is every 24 hours" - }, - "backupHour": { - "type": "integer", - "default": 0, - "description": "At which hour the autobackup should run. This forces a daily backup, overrules a custom 'backupIntervalHours'." - }, - "keepLastDaysBackup": { - "type": "integer", - "default": 10, - "description": "How many days of backups should the autobackup keep? Default is 10 Days worth" - }, - "zipCompression" : { - "type": "integer", - "default": "5", - "description": "Set the zip compression level, 1=fast/less small file to 9=slow/smallest file." - }, - "zipPassword": { - "type": "string", - "default": "", - "minLength": 1, - "description": "When specified, the ZIP backups will be password protected with the zipPassword and the password cannot be a blank value" - }, - "backupPath": { - "type": "string", - "default": "meshcentral-backups", - "description": "The file path where backup files are kept. The default is \"meshcentral-backups\" which sits next to \"meshcentral-data\"." - }, - "backupName": { - "type": "string", - "default": "meshcentral-autobackup-", - "description": "The filename of the backupfile. The default is \"meshcentral-autobackup-\", the filename is appended with the time of backup." - }, - "backupWebFolders": { - "type": "boolean", - "default": false, - "description": "Add views, public and emails directories if overridden" - }, - "backupOtherFolders": { - "type": "boolean", - "default": false, - "description": "Also add files and recordings folder to the backup" - }, - "backupIgnoreFilesGlob": { - "type": "array", - "default": [], - "description": "Glob for ignoring files in the data directory. For example [\"**/*.log\"] !! If a string instead of an array is passed, it will be split by ',' so *{.txt,.log} won't work in that case !! Don't do string..." - }, - "backupSkipFoldersGlob":{ - "type": "array", - "default": [], - "description": "Glob for ignoring directories in the data directory. For example [\"**/signedagents\"]" - }, + "mongoDumpPath": { "type": "string" }, + "mysqlDumpPath": { "type": "string"}, + "backupIntervalHours": { "type": "integer" }, + "keepLastDaysBackup": { "type": "integer" }, + "zipPassword": { "type": "string" }, + "backupPath": { "type": "string" }, "googleDrive": { "type": "object", "description": "Enabled automated upload of the server backups to a Google Drive account, once enabled you need to go in \"My Server\" tab as administrator to associate the account.", @@ -980,125 +244,36 @@ "description": "The maximum number of files to keep in the WebDAV folder, older files will be removed if needed." } } - }, - "s3": { - "type": "object", - "description": "Enabled automated upload of the server backups to an S3 server.", - "required": [ - "accessKey", - "secretKey", - "bucketName" - ], - "properties": { - "endpoint": { - "type": "string", - "default": "s3.amazonaws.com", - "description": "S3 Endpoint address e.g. myS3.myserver.com" - }, - "accessKey": { - "type": "string", - "description": "S3 accessKey, Required" - }, - "secretKey": { - "type": "string", - "description": "S3 secretKey, Required" - }, - "port": { - "type": "integer", - "default": 443, - "description": "S3 Endpoint port number, Default is 443" - }, - "ssl": { - "type": "boolean", - "default": true, - "description": "If \"true\", the S3 Endpoint will use \"https\", else it will use \"http\", Default is true" - }, - "bucketName": { - "type": "string", - "description": "S3 Bucket Name, Required" - }, - "folderName": { - "type": "string", - "default": "MeshCentral-Backups", - "description": "The name of the folder to create in the S3 Bucket. Defaults to \"MeshCentral-Backups\"." - }, - "maxFiles": { - "type": "integer", - "default": 0, - "description": "The maximum number of files to keep in the S3 folder, older files will be removed if needed. Default is 0 which is keep everything." - } - } } } }, - "rootCertCommonName": { - "type": "string", - "default": "MeshCentralRoot-XXXXXX", - "description": "The common name of the MeshCentral server root certificate. By default it's 'MeshCentralRoot-' followed by the first 6 HEX digits of the public key fingerprint. For this setting to take effect, all generated certificates need to be deleted and reset. Existing agents will not be able to connect anymore." - }, - "redirects": { - "type": "object" - }, + "redirects": { "type": "object" }, "maxInvalidLogin": { "type": "object", + "additionalProperties": false, "description": "This section described a policy for how many times an IP address is allowed to attempt to login incorrectly. By default it's 10 times in 10 minutes, but this can be changed here.", "properties": { - "exclude": { - "type": "string", - "default": null, - "description": "Ranges of IP addresses that are not subject to invalid login limitations. For example: 192.168.1.0/24,172.16.0.1" - }, - "time": { - "type": "integer", - "default": 10, - "description": "Time in minutes over which the a maximum number of invalid login attempts is allowed from an IP address." - }, - "count": { - "type": "integer", - "default": 10, - "description": "Maximum number of invalid login attempts from an IP address in the time period." - }, - "coolofftime": { - "type": "integer", - "default": null, - "description": "Additional time in minute that login attempts will be denied once the invalid login limit is reached." - } + "exclude": { "type": "string", "default": null, "description": "Ranges of IP addresses that are not subject to invalid login limitations. For example: 192.168.1.0/24,172.16.0.1"}, + "time": { "type": "integer", "default": 10, "description": "Time in minutes over which the a maximum number of invalid login attempts is allowed from an IP address." }, + "count": { "type": "integer", "default": 10, "description": "Maximum number of invalid login attempts from an IP address in the time period." }, + "coolofftime": { "type": "integer", "default": null, "description": "Additional time in minute that login attempts will be denied once the invalid login limit is reached." } } }, "maxInvalid2fa": { "type": "object", + "additionalProperties": false, "description": "This section described a policy for how many times an IP address is allowed to attempt to perform two-factor authentication (2FA) incorrectly. By default it's 10 times in 10 minutes, but this can be changed here.", "properties": { - "exclude": { - "type": "string", - "default": null, - "description": "Ranges of IP addresses that are not subject to invalid 2FA limitations. For example: 192.168.1.0/24,172.16.0.1" - }, - "time": { - "type": "integer", - "default": 10, - "description": "Time in minutes over which the a maximum number of invalid 2FA attempts is allowed from an IP address." - }, - "count": { - "type": "integer", - "default": 10, - "description": "Maximum number of invalid 2FA attempts from an IP address in the time period." - }, - "coolofftime": { - "type": "integer", - "default": null, - "description": "Additional time in minute that 2FA attempts will be denied once the invalid 2FA limit is reached." - } + "exclude": { "type": "string", "default": null, "description": "Ranges of IP addresses that are not subject to invalid 2FA limitations. For example: 192.168.1.0/24,172.16.0.1"}, + "time": { "type": "integer", "default": 10, "description": "Time in minutes over which the a maximum number of invalid 2FA attempts is allowed from an IP address." }, + "count": { "type": "integer", "default": 10, "description": "Maximum number of invalid 2FA attempts from an IP address in the time period." }, + "coolofftime": { "type": "integer", "default": null, "description": "Additional time in minute that 2FA attempts will be denied once the invalid 2FA limit is reached." } } }, "amtProvisioningServer": { "type": "object", - "required": [ - "deviceGroup", - "newMebxPassword", - "trustedFqdn", - "ip" - ], + "additionalProperties": false, + "required": [ "deviceGroup", "newMebxPassword", "trustedFqdn", "ip" ], "description": "When present, this section will enable the Intel AMT provisioning server on the local network. This is used for Intel AMT bare-metal ACM activation.", "properties": { "port": { @@ -1126,344 +301,62 @@ }, "plugins": { "type": "object", - "properties": { - "enabled": { - "type": "boolean" - } - }, - "required": [ - "enabled" - ] - }, - "watchdog": { - "type": "object", - "required": [ - "interval", - "timeout" - ], - "description": "This is used to monitor if NodeJS is servicing IO correctly or getting held up a lot. You MUST specify \"interval\" and \"timeout\".", - "properties": { - "interval": { - "type": "number", - "description": " This will check every X ms" - }, - "timeout": { - "type": "number", - "description": " If the timer is more than X ms late, it will warn to console AND mesherrors.txt" - } - } + "properties": { "enabled": { "type": "boolean" } }, + "required": [ "enabled" ] } } }, - "domaindefaults": { - "$ref": "#/properties/domains/additionalProperties" - }, + "domaindefaults": { "$ref": "#/properties/domains/items" }, "domains": { "type": "object", - "additionalProperties": { + "items": { "type": "object", "properties": { - "dns": { - "type": "string", - "default": null, - "description": "The DNS name used to access this domain instead of accessing it via a subfolder" - }, - "siteStyle": { - "type": "integer", - "default": 2, - "description": "Valid numbers are 1 and 2, changes the style of the login page and some secondary pages." - }, - "showModernUIToggle": { - "type": "boolean", - "default": false, - "description": "When set to true, the user will be able to toggle between the modern and classic UI." - }, - "title": { - "type": "string", - "default": "MeshCentral", - "description": "The title of this web site. All web pages will have this title." - }, - "title2": { - "type": "string", - "default": null, - "description": "Secondary title text that is placed on the upper right on the title on many web pages." - }, - "titlePicture": { - "type": "string", - "default": null, - "description": "Web site .png logo file that is 450x66 in size placed in meshcentral-data that is used on the top of many pages." - }, - "loginPicture": { - "type": "string", - "default": null, - "description": "Web site .png logo file placed in meshcentral-data that used on the login page when sitestyle is 2." - }, - "pwaLogo": { - "type": "string", - "default": null, - "description": "Web site .png logo file that is 512x512 in size placed in meshcentral-data that is used for PWA installs on iOS and Android." - }, - "rootRedirect": { - "type": "string", - "default": null, - "description": "Redirects HTTP root requests to this URL. When in use, direct users to /login to see the normal login page." - }, - "mobileSite": { - "type": "boolean", - "default": true, - "description": "When set to false, this setting will disable the mobile site." - }, - "orphanAgentUser": { - "type": "string", - "default": null, - "description": "If an agent attempts to connect to a unknown device group, automatically create a new device group and grant access to the specified user. Example: admin" - }, - "maxDeviceView": { - "type": "integer", - "default": null, - "description": "The maximum number of devices a user can see on the devices page at the same time. By default all devices will show, but this may need to be limited on servers with large number of devices." - }, - "unknownUserRootRedirect": { - "type": "string", - "default": null, - "description": "Redirects HTTP root requests to this URL only where user is not already logged in. When in use, direct users to /login to see the normal login page." - }, - "nightMode": { - "type": "integer", - "default": 0, - "description": "0 = User selects day/night mode, 1 = Always night mode, 2 = Always day mode" - }, - "scrollToTop": { - "type": "boolean", - "default": false, - "description": "If true, a Scroll To Top button in the devices tab." - }, - "userQuota": { - "type": "integer" - }, - "meshQuota": { - "type": "integer" - }, - "loginKey": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - }, - "default": null, - "description": "Requires that users add the value ?key=xxx in the URL in order to see the web site." - }, - "agentKey": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - }, - "default": null, - "description": "Requires that agents add the value ?key=xxx in the URL in order to connect. This is not automatic and needs to be manually added in the meshagent.msh file." - }, - "ipkvm": { - "type": "boolean", - "default": false, - "description": "Set to true to enable IP KVM device support in this domain." - }, - "minify": { - "type": "boolean", - "default": false, - "description": "When enabled, the server will send reduced sized web pages." - }, - "newAccounts": { - "type": "boolean", - "default": false, - "description": "When set to true, allow new user accounts to be created from the login page." - }, - "newAccountsPass": { - "type": "string", - "default": null, - "description": "When set this password will be required in order to create a new account from the login screen." - }, - "newAccountsCaptcha": { - "type": "boolean", - "default": false, - "description": "When set to true, users will get a CAPTCHA when creating a new account from the login screen." - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "userNameIsEmail": { - "type": "boolean", - "default": false, - "description": "When enabled, the username of each account is also the email address of the account." - }, - "newAccountEmailDomains": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "newAccountsRights": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "allowedOrigin": { - "type": [ - "array", - "boolean" - ], - "default": false, - "uniqueItems": true, - "description": "A list of allowed hostnames for HTTP request origin header. If false, a default list is created, if true, all hostnames are allowed.", - "items": { - "type": "string" - } - }, - "welcomeText": { - "type": "string", - "description": "Text that will be shown on the login screen." - }, - "welcomePicture": { - "type": "string", - "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." - }, - "welcomePictureFullScreen": { - "type": "boolean", - "default": false, - "description": "When enabled, the welcomePicture will show as a fullscreen background on the login screen." - }, - "meshMessengerTitle": { - "type": "string", - "default": "MeshMessenger", - "description": "Text that will be displayed on the top of the messenger window when no username or device name is displayed." - }, - "meshMessengerPicture": { - "type": "string", - "default": null, - "description": "Name of a .png image file that is placed in meshcentral-data that is displayed on the top of the messenger web page. When null, the default image is displayed." - }, - "hide": { - "type": "integer", - "default": 0, - "description": "Sum of: 1 = Hide header, 2 = Hide tab, 4 = Hide footer, 8 = Hide title, 16 = Hide left bar, 32 = Hide back buttons" - }, - "footer": { - "type": "string", - "default": null, - "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." - }, - "loginfooter": { - "type": "string", - "default": null, - "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." - }, - "allowSavingDeviceCredentials": { - "type": "boolean", - "default": true, - "description": "Allow users to save SSH, RDP, VNC device credentials in the server." - }, - "trustedCert": { - "type": "boolean", - "default": "This value is normally auto-detected, when set to true, MeshCentral assumes that the TLS certificate comes from a trusted CA and will ensure download tools perform certificate checking." - }, + "siteStyle": { "type": "integer", "default": 2, "description": "Valid numbers are 1 and 2, changes the style of the login page and some secondary pages." }, + "title": { "type": "string", "default": "MeshCentral", "description": "The title of this web site. All web pages will have this title." }, + "title2": { "type": "string", "default": null, "description": "Secondary title text that is placed on the upper right on the title on many web pages." }, + "titlePicture": { "type": "string", "default": null, "description": "Web site .png logo file that is 450x66 in size placed in meshcentral-data that is used on the top of many pages." }, + "loginPicture": { "type": "string", "default": null, "description": "Web site .png logo file placed in meshcentral-data that used on the login page when sitestyle is 2." }, + "rootRedirect": { "type": "string", "default": null, "description": "Redirects HTTP root requests to this URL. When in use, direct users to /login to see the normal login page." }, + "mobileSite": { "type": "boolean", "default": true, "description": "When set to false, this setting will disable the mobile site." }, + "unknownUserRootRedirect": { "type": "string", "default": null, "description": "Redirects HTTP root requests to this URL only where user is not already logged in. When in use, direct users to /login to see the normal login page." }, + "nightMode": { "type": "integer", "default": 0, "description": "0 = User selects day/night mode, 1 = Always night mode, 2 = Always day mode" }, + "userQuota": { "type": "integer" }, + "meshQuota": { "type": "integer" }, + "loginKey": { "type": [ "string", "array" ], "items": { "type": "string" }, "default": null, "description": "Requires that users add the value ?key=xxx in the URL in order to see the web site." }, + "agentKey": { "type": [ "string", "array" ], "items": { "type": "string" }, "default": null, "description": "Requires that agents add the value ?key=xxx in the URL in order to connect. This is not automatic and needs to be manually added in the meshagent.msh file." }, + "ipkvm": { "type": "boolean", "default": false, "description": "Set to true to enable IP KVM device support in this domain." }, + "minify": { "type": "boolean", "default": false, "description": "When enabled, the server will send reduced sided web pages." }, + "newAccounts": { "type": "boolean", "default": false, "description": "When set to true, allow new user accounts to be created from the login page." }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "userNameIsEmail": { "type": "boolean", "default": false, "description": "When enabled, the username of each account is also the email address of the account." }, + "newAccountEmailDomains": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "newAccountsRights": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "welcomeText": { "type": "string", "description": "Text that will be shown on the login screen." }, + "welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." }, + "welcomePictureFullScreen": { "type": "boolean", "default": false, "description": "When enabled, the welcomePicture will show as a fullscreen background on the login screen." }, + "meshMessengerTitle": { "type": "string", "default": "MeshMessenger", "description": "Text that will be displayed on the top of the messenger window when no username or device name is displayed." }, + "meshMessengerPicture": { "type": "string", "default": null, "description": "Name of a .png image file that is placed in meshcentral-data that is displayed on the top of the messenger web page. When null, the default image is displayed." }, + "hide": { "type": "integer", "default": 0, "description": "Sum of: 1 = Hide header, 2 = Hide tab, 4 = Hide footer, 8 = Hide title, 16 = Hide left bar, 32 = Hide back buttons" }, + "footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." }, + "loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." }, + "allowSavingDeviceCredentials": { "type": "boolean", "default": true, "description": "Allow users to save SSH, RDP, VNC device credentials on the server that can be used by any other user." }, "guestDeviceSharing": { - "type": [ - "boolean", - "object" - ], + "type": [ "boolean", "object" ], "default": true, "description": "When set to false, the desktop/terminal sharing link feature is not available.", "properties": { - "maxSessionTime": { - "type": "number", - "description": "When set, limits the maximum length of a guest session, in minutes." - } + "maxSessionTime": { "type": "number", "description": "When set, limits the maximum length of a guest session, in minutes." } } }, - "autoRemoveInactiveDevices": { - "type": "integer", - "default": 0, - "minimum": 0, - "maximum": 2000, - "description": "Number of days a device can be inactive before it's removed. 0 disables this feature. Device group setting will override this value." - }, - "deviceSearchBarServerAndClientName": { - "type": "boolean", - "default": false, - "description": "When set to true, the devices search box will match on both the server name and client name of a device." - }, - "deviceSearchBarGroupName": { - "type": "boolean", - "default": false, - "description": "When set to true, the devices search box will match on group name too." - }, + "autoRemoveInactiveDevices": { "type": "integer", "default": 0, "minimum": 0, "maximum": 2000, "description": "Number of days a device can be inactive before it's removed. 0 disables this feature. Device group setting will override this value." }, + "deviceSearchBarServerAndClientName": { "type": "boolean", "default": false, "description": "When set to true, the devices search box will match on both the server name and client name of a device." }, "agentSelfGuestSharing": { - "type": [ - "boolean", - "object" - ], + "type": [ "boolean", "object" ], "default": false, - "description": "When set to true, MeshCentral Assistant can create it's own guest sharing links.", + "description": "When set to true, MeshCentral Asssitant can create it's own guest sharing links.", "properties": { - "expire": { - "type": "number", - "description": "When set, limits the self-created guest sharing link to this number of minutes." - } - } - }, - "PreconfiguredScripts": { - "type": "array", - "default": null, - "description": "When set, your can try click the run button to run on of these scripts on the remote device.", - "items": { - "type": "object", - "required": [ - "name", - "type" - ], - "properties": { - "name": { - "description": "Name of the script.", - "type": "string" - }, - "type": { - "description": "The type of script.", - "type": "string", - "enum": [ - "bat", - "ps1", - "sh", - "agent" - ] - }, - "runas": { - "description": "How to run this script, does not apply to agent scripts.", - "type": "string", - "enum": [ - "agent", - "userfirst", - "user" - ] - }, - "cmd": { - "description": "The command or \\r\\n separated commands to run, if set do not use the file key.", - "type": "string" - }, - "file": { - "description": "The script file path and name, if set do not use the cmd key. This file path starts in meshcentral-data.", - "type": "string" - } - } + "expire": { "type": "number", "description": "When set, limits the self-created guest sharing link to this number of minutes." } } }, "preConfiguredRemoteInput": { @@ -1472,10 +365,7 @@ "description": "When set, you can right click on the input button in the desktop tab and instantly remotely type one of these pre-configured strings.", "items": { "type": "object", - "required": [ - "name", - "value" - ], + "required": [ "name", "value" ], "properties": { "name": { "description": "Name of the text string.", @@ -1488,838 +378,262 @@ } } }, - "altMessenging": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the alternative messaging service, for example: \"Jitsi\" " - }, - "url": { - "type": "string", - "description": "URL to the alternative messaging services, for example: \"https://meet.jit.si/myserver-{0}\", for a device {0}, {1}, {2}, {3} is the device id. For a user, {0} is the userid, {1} is full userid with dashes, {2} is real name with no spaces, {3} is real name with dash instead of spaces." - }, - "localurl": { - "type": "string", - "description": "If specified, this is the URL that is used on the administrator side, for example: \"https://meet.jit.si/myserver-{0}\", for a device {0}, {1}, {2}, {3} is the device id. For a user, {0} is the userid, {1} is full userid with dashes, {2} is real name with no spaces, {3} is real name with dash instead of spaces." - }, - "type": { - "type": "string", - "enum": [ - null, - "user", - "device" - ], - "default": null, - "description": "Indicate if this button should be shown in the user or device type. If omitted, it will be displayed in both." - } - }, - "required": [ - "name", - "url" - ] - } - }, - "deviceMeshRouterLinks": { + "altMessenging": { "type": "object", "properties": { - "rdp": { - "type": "boolean", - "default": true, - "description": "Display a RDP link in the device tab when supported." - }, - "ssh": { - "type": "boolean", - "default": true, - "description": "Display a SSH link in the device tab when supported." - }, - "scp": { - "type": "boolean", - "default": true, - "description": "Display a SCP link in the device tab when supported." - }, - "extralinks": { - "type": "array", - "items": { - "type": "object", - "required": [ - "name", - "protocol", - "port" - ], - "properties": { - "name": { - "description": "Name of the link to be displayed on the web site.", - "type": "string" - }, - "protocol": { - "description": "Protocol. Valid values are: custom,http,https,rdp,ssh,scp,mcrdesktop,mcrfiles.", - "type": "string" - }, - "port": { - "description": "The port on the remote device.", - "default": 0, - "minimum": 0, - "maximum": 65535, - "type": "integer" - }, - "ip": { - "description": "Target IP address. If not specified, the target of the connection is the remote device running the MeshAgent.", - "type": "string" - }, - "localport": { - "description": "The local port MeshCentral Router would bind to. By default, a random available port is used.", - "default": 0, - "minimum": 0, - "maximum": 65535, - "type": "integer" - }, - "filter": { - "description": "Array of node// or mesh// or tag: strings. When set, the link will only show up for the specified devices, device groups or device tag.", - "type": "array", - "items": { - "type": "string" - } - } + "name": { "type": "string", "description": "Name of the alternative messaging service, for example: \"Jitsi\" " }, + "url": { "type": "string", "description": "URL to the alternative messaging services, for example: \"https://meet.jit.si/myserver-{0}\"" }, + "localurl": { "type": "string", "description": "If specified, this is the URL that is used on the administrator side, for example: \"https://meet.jit.si/myserver-{0}\"" } + }, + "required": [ "name", "url" ] + }, + "deviceMeshRouterLinks": { + "rdp": { "type": "boolean", "default": true, "description": "Display a RDP link in the device tab when supported." }, + "ssh": { "type": "boolean", "default": true, "description": "Display a SSH link in the device tab when supported." }, + "scp": { "type": "boolean", "default": true, "description": "Display a SCP link in the device tab when supported." }, + "extralinks": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "name", "protocol", "port" ], + "properties": { + "name": { + "description": "Name of the link to be displayed on the web site.", + "type": "string" + }, + "protocol": { + "description": "Protocol. Valid values are: custom,http,https,rdp,ssh,scp,mcrdesktop,mcrfiles.", + "type": "string" + }, + "port": { + "description": "The port on the remote device.", + "default": 0, + "minimum": 0, + "maximum": 65535, + "type": "integer" + }, + "ip": { + "description": "Target IP address. If not specified, the target of the connection is the remote device running the MeshAgent.", + "type": "string" + }, + "localport": { + "description": "The local port MeshCentral Router would bind to. By default, a random available port is used.", + "default": 0, + "minimum": 0, + "maximum": 65535, + "type": "integer" + }, + "filter": { + "description": "Array of node// or mesh// or tag: strings. When set, the link will only show up for the specified devices, device groups or device tag.", + "type": "array", + "items": { "type": "string" } } } } } }, - "assistantTypeAgentInvite": { - "type": "integer", - "default": 0, - "description": "0 = System Tray, Connect on user request, 1 = System Tray, Always Connected, 2 = Application, Connect on user request, 3 = Application, Always connected, 4 = System Tray, Monitor Only" - }, "certUrl": { "type": "string", "format": "uri", - "description": "https url when to get the TLS certificate that MeshAgent's will see when connecting to this server. This setting is used when a reverse proxy like NGINX is used in front of MeshCentral. You can set this to file:// but it must be followed by the full path to the certificate file." + "description": "https url when to get the TLS certificate that MeshAgent's will see when connecting to this server. This setting is used when a reverse proxy like NGINX is used in front of MeshCentral." }, "myServer": { - "type": [ - "object", - "boolean" - ], + "type": [ "object", "boolean" ], + "additionalProperties": false, "properties": { - "Backup": { - "type": "boolean", - "default": true, - "description": "Allows administrators to backup the server from the My Server tab. This option can only enabled when the NeDB database is in use. For other databases, this option disabled and the setting is ignored." - }, - "Restore": { - "type": "boolean", - "default": true, - "description": "Allows administrators to restore the server from the My Server tab. This option can only enabled when the NeDB database is in use. For other databases, this option disabled and the setting is ignored." - }, - "Upgrade": { - "type": "boolean", - "default": true, - "description": "Allows administrators to update the server from the My Server tab." - }, - "ErrorLog": { - "type": "boolean", - "default": true, - "description": "Allows administrators to see the server crash log the server from the My Server tab." - }, - "Console": { - "type": "boolean", - "default": true, - "description": "Allows administrators to access the server console from the My Server tab." - }, - "Trace": { - "type": "boolean", - "default": true, - "description": "Allows administrators to access the server trace tab from from the My Server tab." - }, - "Config": { - "type": "boolean", - "default": true, - "description": "Allows administrators remotely view server configuration on the My Server tab." - } + "Backup": { "type": "boolean", "default": true, "description": "Allows administrators to backup the server from the My Server tab." }, + "Restore": { "type": "boolean", "default": true, "description": "Allows administrators to restore the server from the My Server tab." }, + "Upgrade": { "type": "boolean", "default": true, "description": "Allows administrators to update the server from the My Server tab." }, + "ErrorLog": { "type": "boolean", "default": true, "description": "Allows administrators to see the server crash log the server from the My Server tab." }, + "Console": { "type": "boolean", "default": true, "description": "Allows administrators to access the server console from the My Server tab." }, + "Trace": { "type": "boolean", "default": true, "description": "Allows administrators to access the server trace tab from from the My Server tab." } } }, "passwordRequirements": { "type": "object", "properties": { - "min": { - "type": "integer", - "description": "Minimum number of characters allowed for the account password." - }, - "max": { - "type": "integer", - "description": "Maximum number of characters allowed for the account password." - }, - "upper": { - "type": "integer", - "description": "Minimum number of upper case characters required in the password." - }, - "lower": { - "type": "integer", - "description": "Minimum number of lower case characters required in the password." - }, - "numeric": { - "type": "integer", - "description": "Minimum number of numeric characters required in the password." - }, - "nonalpha": { - "type": "integer", - "description": "Minimum number of non-alpha-numeric characters required in the password." - }, - "reset": { - "type": "integer", - "description": "Number of days after which the user is required to change the account password." - }, - "email2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable email 2FA." - }, - "sms2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable SMS 2FA." - }, - "duo2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable Duo 2FA." - }, - "push2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable push notification 2FA." - }, - "otp2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable one-time-password 2FA." - }, - "msg2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable user messaging 2FA." - }, - "backupcode2factor": { - "type": "boolean", - "default": true, - "description": "Set to false to disable 2FA backup codes." - }, - "single2factorWarning": { - "type": "boolean", - "default": true, - "description": "Set to false to disable single 2FA warning." - }, - "lock2factor": { - "type": "boolean", - "default": false, - "description": "When set to true, prevents any changes to 2FA." - }, - "force2factor": { - "type": "boolean", - "default": false, - "description": "Requires that all accounts setup 2FA." - }, - "skip2factor": { - "type": "string", - "description": "IP addresses where 2FA login is skipped, for example: 127.0.0.1,192.168.2.0/24" - }, - "oldPasswordBan": { - "type": "integer", - "description": "Number of old passwords the server should remember and not allow the user to switch back to." - }, - "banCommonPasswords": { - "type": "boolean", - "default": false, - "description": "Uses WildLeek to block use of the 10000 most commonly used passwords." - }, - "loginTokens": { - "type": [ - "boolean", - "array" - ], - "default": true, - "description": "Allows users to create alternative username/passwords for their account. Set to false to disallow all users, or set to a userid array to only allow some users." - }, - "twoFactorTimeout": { - "type": "integer", - "default": 300, - "description": "Maximum about of time to wait for a 2FA token on the login page in seconds." - }, - "autofido2fa": { - "type": "boolean", - "default": false, - "description": "If true and user account has FIDO key setup, 2FA login screen will automatically request FIDO 2FA." - }, - "maxfidokeys": { - "type": "integer", - "default": null, - "description": "Maximum number of FIDO/YubikeyOTP hardware 2FA keys that can be setup in a user account." - }, - "allowaccountreset": { - "type": "boolean", - "default": true, - "description": "If set to false, the account reset option on the login screen will not be available to users." - } + "min": { "type": "integer", "description": "Minimum number of characters allowed for the account password." }, + "max": { "type": "integer", "description": "Maximum number of characters allowed for the account password." }, + "upper": { "type": "integer", "description": "Minimum number of upper case characters required in the password." }, + "lower": { "type": "integer", "description": "Minimum number of lower case characters required in the password." }, + "numeric": { "type": "integer", "description": "Minimum number of numeric characters required in the password." }, + "nonalpha": { "type": "integer", "description": "Minimum number of non-alpha-numeric characters required in the password." }, + "reset": { "type": "integer", "description": "Number of days after which the user is required to change the account password." }, + "email2factor": { "type": "boolean", "default": true, "description": "Set to false to disable email 2FA." }, + "sms2factor": { "type": "boolean", "default": true, "description": "Set to false to disable SMS 2FA." }, + "push2factor": { "type": "boolean", "default": true, "description": "Set to false to disable push notification 2FA." }, + "otp2factor": { "type": "boolean", "default": true, "description": "Set to false to disable one-time-password 2FA." }, + "backupcode2factor": { "type": "boolean", "default": true, "description": "Set to false to disable 2FA backup codes." }, + "single2factorWarning": { "type": "boolean", "default": true, "description": "Set to false to disable single 2FA warning." }, + "lock2factor": { "type": "boolean", "default": false, "description": "When set to true, prevents any changes to 2FA." }, + "force2factor": { "type": "boolean", "default": false, "description": "Requires that all accounts setup 2FA." }, + "skip2factor": { "type": "string", "description": "IP addresses where 2FA login is skipped, for example: 127.0.0.1,192.168.2.0/24" }, + "oldPasswordBan": { "type": "integer", "description": "Number of old passwords the server should remember and not allow the user to switch back to." }, + "banCommonPasswords": { "type": "boolean", "default": false, "description": "Uses WildLeek to block use of the 10000 most commonly used passwords." }, + "loginTokens": { "type": [ "boolean", "array" ], "default": true, "description": "Allows users to create alternative username/passwords for their account. Set to false to disallow all users, or set to a userid array to only all some users." }, + "twoFactorTimeout": { "type": "integer", "default": 300, "description": "Maximum about of time the to wait for a 2FA token on the login page in seconds." }, + "autofido2fa": { "type": "boolean", "default": false, "description": "If true and user account has FIDO key setup, 2FA login screen will automatically request FIDO 2FA." }, + "maxfidokeys": { "type": "integer", "default": null, "description": "Maximum number of FIDO/YubikeyOTP hardware 2FA keys that can be setup in a user account." }, + "allowaccountreset": { "type": "boolean", "default": true, "description": "If set to false, the account reset option on the login screen will not be available to users." } } }, - "twoFactorCookieDurationDays": { - "type": "integer", - "default": 30, - "description": "Number of days that a user is allowed to remember this device for when completing 2FA. Set this to 0 to remove this option." - }, - "auth": { - "type": "string", - "default": null, - "enum": [ - null, - "sspi", - "ldap" - ], - "description": "Type of user authentication to use, this can be SSPI on Windows or LDAP. If not set, username/password is used." - }, - "ldapUserKey": { - "type": "string", - "default": null, - "description": "The LDAP value to use as a user's unique account identifier. Use \"ldapUserKey\" or \"ldapUserBinaryKey\"." - }, - "ldapUserBinaryKey": { - "type": "string", - "default": "objectSid", - "description": "The LDAP value to use as a user's unique account identifier, when specified in this field, the values will be HEX converted." - }, - "ldapUserName": { - "type": "string", - "default": "displayName", - "description": "The LDAP value to use for the user name, you can also compose the name by setting this value to, for example: \"{{{givenName}}} {{{sn}}}\"" - }, - "ldapUserEmail": { - "type": "string", - "default": "mail", - "description": "The LDAP value to use for the user's email address." - }, - "ldapUserRealName": { - "type": "string", - "default": "name", - "description": "The LDAP value to use for the user's real name, you can also compose the name by setting this value to, for example: \"{{{givenName}}} {{{sn}}}\"" - }, - "ldapUserPhoneNumber": { - "type": "string", - "default": "telephoneNumber", - "description": "The LDAP value to use for the user's phone number." - }, - "ldapUserImage": { - "type": "string", - "default": "thumbnailPhoto", - "description": "The LDAP value to use for the user's image." - }, - "ldapSaveUserToFile": { - "type": "string", - "default": null, - "description": "When set to a filename, for example c:\\temp\\ldapusers.txt, MeshCentral will save the LDAP user object to this file each time a user logs in. This is used for debugging LDAP issues." - }, - "ldapUserGroups": { - "type": "string", - "default": "memberOf", - "description": "The LDAP value to use for the user's group memberships." - }, - "ldapSyncWithUserGroups": { - "type": [ - "boolean", - "object" - ], - "default": false, - "description": "When set to true or set to an object, MeshCentral will synchronize LDAP user memberships to MeshCentral user groups.", - "properties": { - "filter": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set to a string or array of strings, only LDAP membership groups that includes one of the strings will be synchronized with MeshCentral user groups." - } - } - }, - "ldapSiteAdminGroups": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set to a list of LDAP groups, users that are part of one of these groups will be set a site administrator, otherwise site administrator rights will be removed." - }, - "ldapUserRequiredGroupMembership": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "A list of LDAP groups. Users must be part of at least one of these groups to allow login. If null, all users are allowed to login." - }, - "ldapOptions": { - "type": "object", - "description": "LDAP options passed to ldapauth-fork" - }, - "hidePowerTimeline": { - "type": "boolean", - "default": false, - "description": "When enabled, this will hide the power timeline in the web ui" - }, - "showNotesPanel": { - "type": "boolean", - "default": false, - "description": "When enabled, this will show the notes panel in the device view" - }, - "userSessionsSort": { - "type": "string", - "default": "SessionId", - "description": "Arrange the Connect sessions offered when multiple Terminal Sessions are present by 'SessionId', 'StationName' or 'Username' with 'SessionId' as the default sorting criteria." - }, - "agentInviteCodes": { - "type": "boolean", - "default": false, - "description": "Enabled a feature where you can set one or more invitation codes in a device group. You can then give a invitation link to users who can use it to download the agent." - }, - "agentNoProxy": { - "type": "boolean", - "default": false, - "description": "When enabled, all newly installed MeshAgents will be instructed to no use a HTTP/HTTPS proxy even if one is configured on the remote system" - }, + "twoFactorCookieDurationDays": { "type": "integer", "default": 30, "description": "Number of days that a user is allowed to remember this device for when completing 2FA. Set this to 0 to remove this option." }, + "auth": { "type": "string", "default": null, "enum": [null, "sspi", "ldap"], "description": "Type of user authentication to use, this can be SSPI on Windows or LDAP. If not set, username/password is used." }, + "ldapUserKey": { "type": "string" }, + "ldapUserName": { "type": "string" }, + "ldapUserEmail": { "type": "string" }, + "ldapUserRealName": { "type": "string" }, + "ldapUserPhoneNumber": { "type": "string" }, + "ldapOptions": { "type": "object", "description": "LDAP options passed to ldapauth-fork" }, + "agentInviteCodes": { "type": "boolean", "default": false, "description": "Enabled a feature where you can set one or more invitation codes in a device group. You can then give a invitation link to users who can use it to download the agent." }, + "agentNoProxy": { "type": "boolean", "default": false, "description": "When enabled, all newly installed MeshAgents will be instructed to no use a HTTP/HTTPS proxy even if one is configured on the remote system" }, "agentTag": { "type": "object", "description": "This section is used to indicate if parts of the meshagent.tag file should be used to set server-side device properties.", + "additionalProperties": false, "properties": { - "ServerName": { - "type": "integer", - "default": 0, - "description": "Action taken if one of the lines in meshagent.tag contains ~ServerName:name. 0=Ignore, 1=Set." - }, - "ServerDesc": { - "type": "integer", - "default": 0, - "description": "Action taken if one of the lines in meshagent.tag contains ~ServerDesc:desc. 0=Ignore, 1=Set, 2=SetIfEmpty." - }, - "ServerTags": { - "type": "integer", - "default": 0, - "description": "Action taken if one of the lines in meshagent.tag contains ~ServerTags:tag1,tag2,tag3. 0=Ignore, 1=Set, 2=SetIfEmpty, 3=Append." - } + "ServerName": { "type": "integer", "default": 0, "description": "Action taken if one of the lines in meshagent.tag contains ~ServerName:name. 0=Ignore, 1=Set." }, + "ServerDesc": { "type": "integer", "default": 0, "description": "Action taken if one of the lines in meshagent.tag contains ~ServerDesc:desc. 0=Ignore, 1=Set, 2=SetIfEmpty." }, + "ServerTags": { "type": "integer", "default": 0, "description": "Action taken if one of the lines in meshagent.tag contains ~ServerTags:tag1,tag2,tag3. 0=Ignore, 1=Set, 2=SetIfEmpty, 3=Append." } } }, - "lockAgentDownload": { - "type": "boolean", - "default": false, - "description": "When enabled, MeshCentral will block all downloads of MeshAgent including install scripts, if the user is not logged in" - }, - "geoLocation": { - "type": "boolean", - "default": false, - "description": "Enables the geo-location feature and device location map in the user interface, this feature is not being worked on." - }, - "ipLocation": { - "type": "boolean", - "default": false, - "description": "When enabled, the remote agents will submit there approximate location to MeshCentral, Use in combination with \"geoLocation\"." - }, - "novnc": { - "type": "boolean", - "default": true, - "description": "When enabled, activates the built-in web-based VNC client." - }, - "mstsc": { - "type": "boolean", - "default": true, - "description": "When enabled, activates the built-in web-based RDP client." - }, - "ssh": { - "type": "boolean", - "default": false, - "description": "When enabled, activates the built-in web-based SSH client." - }, - "webEmailsPath": { - "type": "string", - "description": "Path where to find custom email templates for this domain." - }, - "customUI": { - "type": "object" - }, + "geoLocation": { "type": "boolean", "default": false, "description": "Enables the geo-location feature and device location map in the user interface, this feature is not being worked on." }, + "novnc": { "type": "boolean", "default": true, "description": "When enabled, activates the built-in web-based VNC client." }, + "mstsc": { "type": "boolean", "default": false, "description": "When enabled, activates the built-in web-based RDP client." }, + "ssh": { "type": "boolean", "default": false, "description": "When enabled, activates the built-in web-based SSH client." }, + "webEmailsPath": { "type": "string", "description": "Path where to find custom email templates for this domain." }, + "customUI": { "type": "object" }, "consentMessages": { "type": "object", "description": "This section is used to customize user consent prompts, these show up when asking if a remote session is allowed or not.", + "additionalProperties": false, "properties": { - "Title": { - "type": "string" - }, - "Desktop": { - "type": "string" - }, - "Terminal": { - "type": "string" - }, - "Files": { - "type": "string" - }, - "consentTimeout": { - "type": "integer", - "default": 30, - "description": "How long in seconds to show the user consent dialog box." - }, - "autoAcceptOnTimeout": { - "type": "boolean", - "default": false, - "description": "If true, user consent is accepted after the timeout." - }, - "autoAcceptIfNoUser": { - "type": "boolean", - "default": false, - "description": "If true, user consent is accepted if no user is logged in." - }, - "oldStyle": { - "type": "boolean", - "default": false, - "description": "If true, user consent will be shown in an old style prompt box rather than the new style consent-box." - } + "Title": { "type": "string" }, + "Desktop": { "type": "string" }, + "Terminal": { "type": "string" }, + "Files": { "type": "string" }, + "consentTimeout": { "type": "integer", "default": 30, "description": "How long in seconds to show the user consent dialog box." }, + "autoAcceptOnTimeout": { "type": "boolean", "default": false, "description": "If true, user consent is accepted after the timeout." } } }, "notificationMessages": { "type": "object", + "additionalProperties": false, "description": "This section is user to customize user notifications when a remote desktop, terminal or file session is connected to a remote system.", "properties": { - "Title": { - "type": "string" - }, - "Desktop": { - "type": "string" - }, - "Terminal": { - "type": "string" - }, - "Files": { - "type": "string" - } + "Title": { "type": "string" }, + "Desktop": { "type": "string" }, + "Terminal": { "type": "string" }, + "Files": { "type": "string" } } }, "agentCustomization": { "type": "object", + "additionalProperties": false, "description": "Use this section to customize the agent branding.", "properties": { - "displayName": { - "type": "string", - "default": "MeshCentral Agent", - "description": "The name of the agent as displayed to the user." - }, - "description": { - "type": "string", - "default": "Mesh Agent background service", - "description": "The description of the agent as displayed to the user." - }, - "companyName": { - "type": "string", - "default": "Mesh Agent", - "description": "This will be used as the path to install the agent, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's." - }, - "serviceName": { - "type": "string", - "default": "Mesh Agent", - "description": "The name of the background service, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's but should be set to an all lower case, no space string." - }, - "installText": { - "type": "string", - "default": null, - "description": "Text string to show in the agent installation dialog box." - }, - "image": { - "type": "string", - "default": null, - "description": "The filename of a image file in .png format located in meshcentral-data to display in the MeshCentral Agent installation dialog, image should be square and from 64x64 to 200x200." - }, - "fileName": { - "type": "string", - "default": "meshagent", - "description": "The agent filename." - }, - "foregroundColor": { - "type": "string", - "default": null, - "description": "Foreground text color, valid values are RBG in format 0,0,0 to 255,255,255 or format #000000 to #FFFFFF." - }, - "backgroundColor": { - "type": "string", - "default": null, - "description": "Background color, valid values are RBG in format 0,0,0 to 255,255,255 or format #000000 to #FFFFFF." - } + "displayName": { "type": "string", "default": "MeshCentral Agent", "description": "The name of the agent as displayed to the user." }, + "description": { "type": "string", "default": "Mesh Agent background service", "description": "The description of the agent as displayed to the user." }, + "companyName": { "type": "string", "default": "Mesh Agent", "description": "This will be used as the path to install the agent, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's." }, + "serviceName": { "type": "string", "default": "Mesh Agent", "description": "The name of the background service, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's but should be set to an all lower case, no space string." }, + "installText": { "type": "string", "default": null, "description": "Text string to show in the agent installation dialog box." }, + "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in the MeshCentral Agent installation dialog, image should be square and from 64x64 to 200x200." }, + "fileName": { "type": "string", "default": "meshagent", "description": "The agent filename." }, + "foregroundColor": { "type": "string", "default": null, "description": "Foreground text color, valid values are RBG in format 0,0,0 to 255,255,255 or format #000000 to #FFFFFF." }, + "backgroundColor": { "type": "string", "default": null, "description": "Background color, valid values are RBG in format 0,0,0 to 255,255,255 or format #000000 to #FFFFFF." } } }, "agentFileInfo": { "type": "object", + "additionalProperties": false, "description": "Use this section to set resource metadata of the Windows agents prior to signing. In Windows, you can right-click and select properties to view these values.", "properties": { - "icon": { - "type": "string", - "description": "Sets the agent icon, this is the name of a .ico file with the file placed in the meshcentral-data folder." - }, - "fileDescription": { - "type": "string", - "description": "Executable file description." - }, - "fileVersion": { - "type": "string", - "description": "Executable file version, in the form of 'n.n.n.n', for example: '1.2.3.4'." - }, - "internalName": { - "type": "string", - "description": "Executable internal name." - }, - "legalCopyright": { - "type": "string", - "description": "Executable legal copyright." - }, - "originalFilename": { - "type": "string", - "description": "Executable original file name." - }, - "productName": { - "type": "string", - "description": "Executable product name." - }, - "productVersion": { - "type": "string", - "description": "Executable product version. Any string format will work, but a alphabetic character is required for this value to show correctly in the Windows property box. For example: 'v1.2.3.4' will work, but '1.2.3.4' will not." - } + "fileDescription": { "type": "string", "description": "Executable file description." }, + "fileVersion": { "type": "string", "description": "Executable file version, generally in the form of 1.2.3.4." }, + "internalName": { "type": "string", "description": "Executable internal name." }, + "legalCopyright": { "type": "string", "description": "Executable legal copyright." }, + "originalFilename": { "type": "string", "description": "Executable original file name." }, + "productName": { "type": "string", "description": "Executable product name." }, + "productVersion": { "type": "string", "description": "Executable product version, generally in the form of 1.2.3.4." } } }, "assistantCustomization": { "type": "object", + "additionalProperties": false, "description": "Use this section to customize the MeshCentral Assistant.", "properties": { - "title": { - "type": "string", - "default": "MeshCentral Assistant", - "description": "Name to show as MeshCentral Assistant dialog title." - }, - "image": { - "type": "string", - "default": null, - "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Assistant, image should be square and from 64x64 to 128x128." - }, - "fileName": { - "type": "string", - "default": "meshagent", - "description": "The MeshCentral Assistant filename." - } + "title": { "type": "string", "default": "MeshCentral Assistant", "description": "Name to show as MeshCentral Assistant dialog title." }, + "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Assistant, image should be square and from 64x64 to 128x128." }, + "fileName": { "type": "string", "default": "meshagent", "description": "The MeshCentral Assistant filename." } } }, "androidCustomization": { "type": "object", + "additionalProperties": false, "description": "Use this section to customize the MeshCentral Agent for Android.", "properties": { - "title": { - "type": "string", - "default": "MeshCentral Agent", - "description": "Displayed on top of the MeshCentral Agent for Android." - }, - "subtitle": { - "type": "string", - "default": null, - "description": "Subtitle displayed until the title on the toolbar." - }, - "image": { - "type": "string", - "default": null, - "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Agent for Android, image should be square and from 64x64 to 128x128." - } + "title": { "type": "string", "default": "MeshCentral Agent", "description": "Displayed on top of the MeshCentral Agent for Android." }, + "subtitle": { "type": "string", "default": null, "description": "Subtitle displayed until the title on the toolbar." }, + "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Agent for Android, image should be square and from 64x64 to 128x128." } } }, - "ipBlockedUserRedirect": { - "type": "string", - "default": null, - "description": "If set, a user from a banned IP address will be redirected to this URL." - }, - "userRequiredHttpHeader": { - "type": "object", - "default": null, - "description": "When set, requires that a browser request have set HTTP header to allow user login. Example: \"{ \"Sec-Fetch-Dest\": \"iframe\" }\"" - }, - "userAllowedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, only users from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:userAllowedIP.txt\"" - }, - "userBlockedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, users from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:userBlockedIP.txt\"" - }, - "agentAllowedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, only agents from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:agentAllowedIP.txt\"" - }, - "agentBlockedIP": { - "type": [ - "string", - "array" - ], - "default": null, - "description": "When set, agents from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\" \"file:agentBlockedIP.txt\"" - }, - "userSessionIdleTimeout": { - "type": "integer", - "default": null, - "description": "When set, idle users will be disconnected after a set amounts of minutes." - }, - "logoutOnIdleSessionTimeout": { - "type": "boolean", - "default": true, - "description": "Determines whether MeshCentral should logout after the session idle timeout elapsed or should just disconnect remote desktop, terminal and files." - }, + "ipBlockedUserRedirect" : { "type": "string", "default": null, "description": "If set, a user from a banned IP address will be redirected to this URL." }, + "userRequiredHttpHeader": { "type": "object", "default": null, "description": "When set, requires that a browser request have set HTTP header to allow user login. Example: \"{ \"Sec-Fetch-Dest\": \"iframe\" }\"" }, + "userAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only users from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "userBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, users from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentAllowedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, only agents from allowed IP address ranges can connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "agentBlockedIP": { "type": [ "string", "array" ], "default": null, "description": "When set, agents from these denied IP address ranges will not be able to connect to the server. Example: \"192.168.2.100,192.168.1.0/24\"" }, + "userSessionIdleTimeout": { "type": "integer", "default": null, "description": "When set, idle users will be disconnected after a set amounts of minutes." }, "userConsentFlags": { "type": "object", + "additionalProperties": false, "description": "Use this section to require user consent for this domain.", "properties": { - "desktopnotify": { - "type": "boolean", - "default": false, - "description": "Enable desktop notification for this domain." - }, - "terminalnotify": { - "type": "boolean", - "default": false, - "description": "Enable terminal notification for this domain." - }, - "filenotify": { - "type": "boolean", - "default": false, - "description": "Enable files notification for this domain." - }, - "desktopprompt": { - "type": "boolean", - "default": false, - "description": "Enable desktop prompt for this domain." - }, - "terminalprompt": { - "type": "boolean", - "default": false, - "description": "Enable terminal user prompt for this domain." - }, - "fileprompt": { - "type": "boolean", - "default": false, - "description": "Enable files prompt for this domain." - }, - "desktopprivacybar": { - "type": "boolean", - "default": false, - "description": "Enable remote desktop privacy bar for this domain." - } + "desktopnotify": { "type": "boolean", "default": false, "description": "Enable desktop notification for this domain." }, + "terminalnotify": { "type": "boolean", "default": false, "description": "Enable terminal notification for this domain." }, + "filenotify": { "type": "boolean", "default": false, "description": "Enable files notification for this domain." }, + "desktopprompt": { "type": "boolean", "default": false, "description": "Enable desktop prompt for this domain." }, + "terminalprompt": { "type": "boolean", "default": false, "description": "Enable terminal user prompt for this domain." }, + "fileprompt": { "type": "boolean", "default": false, "description": "Enable files prompt for this domain." }, + "desktopprivacybar": { "type": "boolean", "default": false, "description": "Enable remote desktop privacy bar for this domain." } } }, - "urlSwitching": { - "type": "boolean", - "default": true, - "description": "When users navigate thru the web interface, the URL on top will change to point to the current screen. This allows a user to refresh or bookmark the URL and come back to the correct screen. Setting false here will disable this feature." - }, - "desktopPrivacyBarText": { - "type": "string", - "description": "This is the text that will be shown in the remote desktop privacy bar. You can use {0} to display the account realname or {1} to display the account identifier in the string." - }, + "urlSwitching": { "type": "boolean", "default": true, "description": "When users navigate thru the web interface, the URL on top will change to point to the current screen. This allows a user to refresh or bookmark the URL and come back to the correct screen. Setting false here will disable this feature." }, + "desktopPrivacyBarText": { "type": "string", "description": "This is the text that will be shown in the remote desktop privacy bar. You can use {0} to display the account realname or {1} to display the account identifier in the string." }, "limits": { "type": "object", + "additionalProperties": false, "properties": { - "MaxDevices": { - "type": "integer", - "default": null, - "description": "Maximum number of devices in this domain." - }, - "MaxUserAccounts": { - "type": "integer", - "default": null, - "description": "Maximum number of devices in this domain." - }, - "MaxUserSessions": { - "type": "integer", - "default": null, - "description": "Maximum number of user sessions that can connect to this server for this domain." - }, - "MaxAgentSessions": { - "type": "integer", - "default": null, - "description": "Maximum number of agents that can connect to this server for this domain." - }, - "MaxSingleUserSessions": { - "type": "integer", - "default": null, - "description": "Maximum number of sessions a single user can have. Each time a user opens a new browser tab or opens a new browser on a different computer, a new user session is created." - } - } - }, - "files": { - "type": "object", - "description": "Values that affect the files feature", - "properties": { - "sftpConnect": { - "type": "boolean", - "default": true, - "description": "When false, removes the 'SFTP Connect' button from the files tab unless this is the only possible option." - } + "MaxDevices": { "type": "integer", "default": null, "description": "Maximum number of devices in this domain." }, + "MaxUserAccounts": { "type": "integer", "default": null, "description": "Maximum number of devices in this domain." }, + "MaxUserSessions": { "type": "integer", "default": null, "description": "Maximum number of user sessions that can connect to this server for this domain." }, + "MaxAgentSessions": { "type": "integer", "default": null, "description": "Maximum number of agents that can connect to this server for this domain." }, + "MaxSingleUserSessions": { "type": "integer", "default": null, "description": "Maximum number of sessions a single user can have. Each time a user opens a new browser tab or opens a new browser on a different computer, a new user session is created." } } }, "terminal": { "type": "object", "description": "Values that affect the terminal feature", "properties": { - "sshConnect": { - "type": "boolean", - "default": true, - "description": "When false, removes the 'SSH Connect' button from the terminal tab unless this is the only possible option." - }, "linuxShell": { "type": "string", - "enum": [ - "any", - "root", - "user", - "login" - ], + "enum": [ "any", "root", "user", "login" ], "default": "any", - "description": "Indicates the default linux terminal thats used when the user clicks the terminal connect button and disables the right mouse button on the terminal connect button when this is set." + "description": "Indicate what terminal options are available when the user clicks the right mouse button on the terminal connect button." }, "launchCommand": { "type": "object", "description": "Indicate what string the agent must write to the shell after starting a terminal session", - "linux": { - "type": "string", - "default": " alias ls=\\'ls --color=auto\\';clear\\n", - "description": "String to write after opening a Linux terminal." - }, - "darwin": { - "type": "string", - "default": null, - "description": "String to write after opening a macOS terminal." - }, - "freebsd": { - "type": "string", - "default": null, - "description": "String to write after opening a FreeBSD terminal." - } + "linux": { "type": "string", "default": " alias ls=\\'ls --color=auto\\';clear\\n", "description": "String to write after opening a Linux terminal." }, + "darwin": { "type": "string", "default": null, "description": "String to write after opening a macOS terminal." }, + "freebsd": { "type": "string", "default": null, "description": "String to write after opening a FreeBSD terminal." } } } }, "desktop": { "type": "object", - "description": "Values that affect the desktop feature", + "description": "Values that affect the remote desktop feature", "properties": { "viewonly": { "type": "boolean", @@ -2332,32 +646,22 @@ "description": "List of local network Intel AMT scanning options offered in the user interface. For example [\"LabNetwork 192.168.15.0/23\", \"SalesNetwork 192.168.8.0/24\"].", "type": "array", "default": null, - "items": { - "type": "string" - } + "items": { "type": "string" } }, "amtManager": { "type": "object", + "additionalProperties": false, "description": "Information passed to the AMT manager module that impacts all Intel AMT device managed within this domain.", "properties": { - "TlsConnections": { - "type": "boolean", - "default": true, - "description": "When set to false, MeshCentral will NOT use TLS to connect to Intel AMT, this is not recommended." - }, - "TlsAcmActivation": { - "type": "boolean", - "default": false, - "description": "When set to true, MeshCentral will attempt a TLS ACM activation on Intel AMT v14+" - }, + "TlsConnections": { "type": "boolean", "default": true, "description": "When set to false, MeshCentral will use TLS to connect to Intel AMT, this is not recommanded." }, + "TlsAcmActivation": { "type": "boolean", "default": false, "description": "When set to false, MeshCentral will not attempt a TLS ACM activation on Intel AMT v14+" }, "AdminAccounts": { "description": "List of username and passwords to try when connecting to Intel AMT.", "type": "array", "items": { "type": "object", - "required": [ - "pass" - ], + "additionalProperties": false, + "required": [ "pass" ], "properties": { "user": { "description": "Intel AMT administrator username.", @@ -2408,9 +712,8 @@ "type": "array", "items": { "type": "object", - "required": [ - "ssid" - ], + "additionalProperties": false, + "required": [ "ssid" ], "properties": { "name": { "description": "WIFI profile name, if not specified the SSID is used.", @@ -2423,23 +726,13 @@ "authentication": { "description": "WIFI authentication.", "type": "string", - "enum": [ - "wpa-psk", - "wpa2-psk", - "wpa-8021x", - "wpa2-802.1x", - "wpa3-sae-802.1x", - "wpa3-owe-802.1x" - ], + "enum": [ "wpa-psk", "wpa2-psk", "wpa-8021x", "wpa2-802.1x", "wpa3-sae-802.1x", "wpa3-owe-802.1x" ], "default": "wpa2-psk" }, "encryption": { "description": "WIFI encryption.", "type": "string", - "enum": [ - "ccmp-aes", - "tkip-rc4" - ], + "enum": [ "ccmp-aes", "tkip-rc4" ], "default": "ccmp-aes" }, "password": { @@ -2452,54 +745,19 @@ "description": "802.1x settings for this WIFI profile. Only required if the WIFI authentication type has 802.1x", "default": null, "type": "object", - "required": [ - "authenticationProtocol" - ], + "additionalProperties": false, + "required": [ "authenticationProtocol" ], "properties": { "authenticationProtocol": { "description": "Identifies the authentication protocol used to authenticate the access requestor to the AAA server.", - "type": [ - "integer", - "string" - ], - "enum": [ - "EAP-TLS", - "EAP-TTLS/MSCHAPv2", - "PEAPv0/EAP-MSCHAPv2", - "PEAPv1/EAP-GTC", - "EAP-FAST/MSCHAPv2", - "EAP-FAST/GTC", - "EAP-MD5", - "EAP-PSK", - "EAP-SIM", - "EAP-AKA", - "EAP-FAST/TLS", - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 - ] + "type": [ "integer", "string" ], + "enum": [ "EAP-TLS", "EAP-TTLS/MSCHAPv2", "PEAPv0/EAP-MSCHAPv2", "PEAPv1/EAP-GTC", "EAP-FAST/MSCHAPv2", "EAP-FAST/GTC", "EAP-MD5", "EAP-PSK", "EAP-SIM", "EAP-AKA", "EAP-FAST/TLS", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }, "serverCertificateNameComparison": { - "type": [ - "integer", - "string" - ], + "type": [ "integer", "string" ], "default": "FullName", "description": "Determines the comparison algorithm used between the ServerCertificateName value and the subject name field of the certificate presented by the AAA server.", - "enum": [ - "FullName", - "DomainSuffix", - 2, - 3 - ] + "enum": [ "FullName", "DomainSuffix", 2, 3 ] }, "serverCertificateName": { "type": "string", @@ -2561,57 +819,19 @@ "802.1x": { "description": "802.1x settings for the Intel AMT Wired interface. If set to false, any existing 802.1x wired profile will be removed from Intel AMT.", "default": null, - "type": [ - "object", - "boolean" - ], - "required": [ - "authenticationProtocol" - ], + "type": [ "object", "boolean" ], + "additionalProperties": false, + "required": [ "authenticationProtocol" ], "properties": { "authenticationProtocol": { "description": "Identifies the authentication protocol used to authenticate the access requestor to the AAA server.", - "type": [ - "integer", - "string" - ], - "enum": [ - "EAP-TLS", - "EAP-TTLS/MSCHAPv2", - "PEAPv0/EAP-MSCHAPv2", - "PEAPv1/EAP-GTC", - "EAP-FAST/MSCHAPv2", - "EAP-FAST/GTC", - "EAP-MD5", - "EAP-PSK", - "EAP-SIM", - "EAP-AKA", - "EAP-FAST/TLS", - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 - ] + "type": [ "integer", "string" ], + "enum": [ "EAP-TLS", "EAP-TTLS/MSCHAPv2", "PEAPv0/EAP-MSCHAPv2", "PEAPv1/EAP-GTC", "EAP-FAST/MSCHAPv2", "EAP-FAST/GTC", "EAP-MD5", "EAP-PSK", "EAP-SIM", "EAP-AKA", "EAP-FAST/TLS", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }, "serverCertificateNameComparison": { - "type": [ - "integer", - "string" - ], + "type": [ "integer", "string" ], "description": "Determines the comparison algorithm used between the ServerCertificateName value and the subject name field of the certificate presented by the AAA server.", - "enum": [ - "FullName", - "DomainSuffix", - 2, - 3 - ] + "enum": [ "FullName", "DomainSuffix", 2, 3 ] }, "serverCertificateName": { "type": "string", @@ -2667,234 +887,86 @@ } } } - }, - "required": [ - "certs" - ] + } }, "amtAcmActivation": { "type": "object", + "additionalProperties": false, "properties": { - "log": { - "type": "string" - }, - "strictCommonName": { - "type": "boolean", - "default": false, - "description": "When set to true, the certificate common name needs to match exactly the Intel AMT trusted FQDN or DHCP Option 15. If false, some flexibility may be given to the matching." - }, + "log": { "type": "string" }, "certs": { "type": "object", "additionalProperties": { "type": "object", + "additionalProperties": false, "properties": { - "certfiles": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "keyfile": { - "type": "string" - } + "certfiles": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "keyfile": { "type": "string" } }, - "required": [ - "certfiles", - "keyfile" - ] + "required": [ "certfiles", "keyfile" ] } } }, - "required": [ - "certs" - ] + "required": [ "certs" ] }, "redirects": { "type": "object", - "additionalProperties": { - "type": "string" - }, + "additionalProperties": { "type": "string" }, "description": "This is used to create HTTP redirections. For example setting \"redirects\": { \"example\":\"https://example.com\" } will make it so that anyone accessing /example on the server will get redirected to the specified URL." }, - "duo2factor": { - "type": "object", - "properties": { - "integrationkey": { - "type": "string", - "default": "", - "description": "Integration key from Duo" - }, - "secretkey": { - "type": "string", - "default": "", - "description": "Secret key from Duo" - }, - "apihostname": { - "type": "string", - "default": "", - "description": "API Hostname from Duo" - } - } - }, "yubikey": { "type": "object", + "additionalProperties": false, "properties": { - "id": { - "type": "string" - }, - "secret": { - "type": "string" - }, - "proxy": { - "type": "string", - "format": "uri" - } + "id": { "type": "string" }, + "secret": { "type": "string" }, + "proxy": { "type": "string", "format": "uri" } }, - "required": [ - "id", - "secret" - ] - }, - "httpHeaders": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "agentConfig": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - }, - "default": null, - "description": "Key and values to add to the MeshAgent .msh file" - }, - "assistantConfig": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - }, - "default": null, - "description": "Key and values to add to the MeshCentral Assistant .msh file" - }, - "clipboardGet": { - "type": "boolean", - "default": true, - "description": "When false, users can't set the clipboard of a remove device." - }, - "clipboardSet": { - "type": "boolean", - "default": true, - "description": "When false, users can't get the clipboard of a remove device." - }, - "localSessionRecording": { - "type": "boolean", - "default": true, - "description": "When false, removes the local recording feature on remote desktop." + "required": [ "id", "secret" ] }, + "httpHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, + "agentConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshAgent .msh file" }, + "assistantConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshCentral Assistant .msh file" }, + "clipboardGet": { "type": "boolean", "default": true, "description": "When false, users can't set the clipboard of a remove device." }, + "clipboardSet": { "type": "boolean", "default": true, "description": "When false, users can't get the clipboard of a remove device." }, + "localSessionRecording": { "type": "boolean", "default": true, "description": "When false, removes the local recording feature on remote desktop." }, "sessionRecording": { "type": "object", + "additionalProperties": false, "properties": { - "onlySelectedUsers": { - "type": "boolean", - "default": false, - "description": "When enabled, only device users with the session recording feature turned on will be recorded. When false, all users are recorded." - }, - "onlySelectedUserGroups": { - "type": "boolean", - "default": false, - "description": "When enabled, only device user groups with the session recording feature turned on will be recorded. When false, all users are recorded." - }, - "onlySelectedDeviceGroups": { - "type": "boolean", - "default": false, - "description": "When enabled, only device groups with the session recording feature turned on will be recorded. When false, all devices are recorded." - }, - "filepath": { - "type": "string", - "default": "meshcentral-recordings", - "description": "The file path where recording files are kept. The default is \"meshcentral-recordings\" which sits next to \"meshcentral-data\"." - }, - "index": { - "type": "boolean", - "default": false, - "description": "If true, automatically index remote desktop recordings so that the plays can skip to any place in the file." - }, - "maxRecordings": { - "type": "integer", - "default": null, - "description": "Maximum number of recording files to keep." - }, - "maxRecordingDays": { - "type": "integer", - "default": null, - "description": "Maximum number of days to keep a recording." - }, - "maxRecordingSizeMegabytes": { - "type": "integer", - "default": null, - "description": "Maximum number of recordings in megabytes. Once exceed, remove the oldest recordings." - }, - "protocols": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "integer" - }, - "description": "This is an array: 1 = Terminal, 2 = Desktop, 5 = Files, 100 = Intel AMT WSMAN, 101 = Intel AMT Redirection, 200 = Messenger" - } + "onlySelectedUsers": { "type": "boolean", "default": false, "description": "When enabled, only device users with the session recording feature turned on will be recorded. When false, all users are recorded." }, + "onlySelectedUserGroups": { "type": "boolean", "default": false, "description": "When enabled, only device user groups with the session recording feature turned on will be recorded. When false, all users are recorded." }, + "onlySelectedDeviceGroups": { "type": "boolean", "default": false, "description": "When enabled, only device groups with the session recording feature turned on will be recorded. When false, all devices are recorded." }, + "filepath": { "type": "string", "description": "The file path where recording files are kept." }, + "index": { "type": "boolean", "default": false, "description": "If true, automatically index remote desktop recordings so that the plays can skip to any place in the file." }, + "maxRecordings": { "type": "integer", "default": null, "description": "Maximum number of recording files to keep." }, + "maxRecordingDays": { "type": "integer", "default": null, "description": "Maximum number of days to keep a recording." }, + "maxRecordingSizeMegabytes": { "type": "integer", "default": null, "description": "Maximum number of recordings in megabytes. Once exceed, remove the oldest recordings." }, + "protocols": { "type": "array", "uniqueItems": true, "items": { "type": "integer" }, "description": "This is an array: 1 = Terminal, 2 = Desktop, 5 = Files, 100 = Intel AMT WSMAN, 101 = Intel AMT Redirection, 200 = Messenger" } }, - "required": [ - "protocols" - ] - }, - "showPasswordLogin": { - "type": "boolean", - "default": true, - "description": "When set to false, hides the username and password prompt on login screen." + "required": [ "protocols" ] }, + "showPasswordLogin": { "type": "boolean", "default": true, "description": "When set to false, hides the username and password prompt on login screen." }, "sendgrid": { - "title": "SendGrid.com Email server", + "title" : "SendGrid.com Email server", "description": "Connects MeshCentral to the SendGrid email server, allows MeshCentral to send email messages for 2FA or user notification.", "type": "object", "properties": { - "from": { - "type": "string", - "format": "email", - "description": "Email address used in the messages from field." - }, - "apikey": { - "type": "string", - "description": "The SendGrid API key." - }, - "verifyemail": { - "type": "boolean", - "default": true, - "description": "When set to false, the email format and DNS MX record are not checked." - }, - "emailDelaySeconds": { - "type": "integer", - "default": 300, - "description": "Time to wait before sending a device connection/disconnection notification email. If many events occur, they will be merged into a single email." - } + "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, + "apikey": { "type": "string", "description": "The SendGrid API key." }, + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." } }, - "required": [ - "from", - "apikey" - ] + "required": [ "from", "apikey" ] }, "smtp": { - "title": "SMTP email server", + "title" : "SMTP email server", "description": "Connects MeshCentral to a SMTP email server, allows MeshCentral to send email messages for 2FA or user notification.", "type": "object", "properties": { "name": { "type": "string", "format": "hostname", - "description": "Optional hostname of the client, this defaults to the hostname of the machine. This is useful for SMTP relays. This can also be set to \"console\" for console output debugging." + "description": "Optional hostname of the client, this defaults to the hostname of the machine. This is useful for SMTP relays." }, "host": { "type": "string", @@ -2905,1257 +977,251 @@ "type": "integer", "minimum": 1, "maximum": 65535, - "default": 587, - "description": "SMTP server port number. This defaults to 587 if \"tls\" is false or 465 if \"tls\" is true)" + "description": "SMTP server port number." }, "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, - "user": { - "type": "string", - "description": "SMTP username." - }, - "pass": { - "type": "string", - "description": "SMTP password." - }, - "tls": { - "type": "boolean", - "default": false, - "description": "Set SMTP to use TLS on connections, the default is false" - }, + "tls": { "type": "boolean" }, "auth": { "type": "object", - "description": "This is used for OAuth2 authentication", "properties": { - "clientId": { - "type": "string" - }, - "clientSecret": { - "type": "string" - }, - "refreshToken": { - "type": "string" - }, - "type": { - "type": "string", - "default": "login", - "description": "Setting this indicates the authetication type, 'login' as default or 'oauth2'" - } + "clientId": { "type": "string" }, + "clientSecret": { "type": "string" }, + "refreshTfoken": { "type": "string" } }, - "required": [ - "clientId", - "clientSecret", - "refreshToken" - ] - }, - "tlscertcheck": { - "type": "boolean" - }, - "tlsstrict": { - "type": "boolean" + "required": [ "clientId", "clientSecret", "refreshToken" ] }, + "tlscertcheck": { "type": "boolean" }, + "tlsstrict": { "type": "boolean" }, "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." - }, - "emailDelaySeconds": { - "type": "integer", - "default": 300, - "description": "Time to wait before sending a device connection/disconnection notification email. If many events occur, they will be merged into a single email." } }, - "required": [ - "host", - "port", - "from", - "tls" - ] + "required": [ "from" ] }, "sendmail": { - "title": "Send email using the sendmail command", + "title" : "Send email using the sendmail command", "description": "Makes MeshCentral send emails using the Unix sendmail command. Allows MeshCentral to send email messages for 2FA or user notification.", "type": "object", "properties": { - "newline": { - "type": "string", - "default": "unix", - "description": "Possible values are unix or windows" - }, - "path": { - "type": "string", - "default": "sendmail", - "description": "Path to the sendmail command" - }, - "args": { - "type": "array", - "items": { - "type": "string" - }, - "default": null, - "description": "Array or arguments to pass to sendmail" - }, - "emailDelaySeconds": { - "type": "integer", - "default": 300, - "description": "Time to wait before sending a device connection/disconnection notification email. If many events occur, they will be merged into a single email." - } + "newline": { "type": "string", "default": "unix", "description": "Possible values are unix or windows" }, + "path": { "type": "string", "default": "sendmail", "description": "Path to the sendmail command" }, + "args": { "type": "array", "items": { "type": "string" }, "default": null, "description": "Array or arguments to pass to sendmail" } } }, "authStrategies": { "type": "object", + "additionalProperties": false, "properties": { "twitter": { "type": "object", + "additionalProperties": false, "properties": { - "callbackurl": { - "type": "string", - "format": "uri" - }, - "newAccounts": { - "type": "boolean", - "default": false - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "clientid": { - "type": "string" - }, - "clientsecret": { - "type": "string" - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Then set, the user will be redirected to this URL when hitting the logout link." - } + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} }, - "required": [ - "clientid", - "clientsecret" - ] + "required": [ "clientid", "clientsecret" ] }, "google": { "type": "object", "properties": { - "callbackurl": { - "type": "string", - "format": "uri" - }, - "newAccounts": { - "type": "boolean", - "default": false - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "clientid": { - "type": "string" - }, - "clientsecret": { - "type": "string" - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Then set, the user will be redirected to this URL when hitting the logout link." - } + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} }, - "required": [ - "clientid", - "clientsecret" - ] + "required": [ "clientid", "clientsecret" ] }, "github": { "type": "object", "properties": { - "callbackurl": { - "type": "string", - "format": "uri" - }, - "newAccounts": { - "type": "boolean", - "default": false - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "clientid": { - "type": "string" - }, - "clientsecret": { - "type": "string" - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Then set, the user will be redirected to this URL when hitting the logout link." - } + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} }, - "required": [ - "clientid", - "clientsecret" - ] + "required": [ "clientid", "clientsecret" ] + }, + "reddit": { + "type": "object", + "properties": { + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} + }, + "required": [ "clientid", "clientsecret" ] }, "azure": { "type": "object", "properties": { - "callbackurl": { - "type": "string", - "format": "uri" - }, - "newAccounts": { - "type": "boolean", - "default": false - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "clientid": { - "type": "string" - }, - "clientsecret": { - "type": "string" - }, - "tenantid": { - "type": "string" - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Then set, the user will be redirected to this URL when hitting the logout link." - } + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "tenantid": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} }, - "required": [ - "clientid", - "clientsecret", - "tenantid" - ] + "required": [ "clientid", "clientsecret", "tenantid" ] }, "jumpcloud": { "type": "object", "properties": { - "callbackurl": { - "type": "string", - "format": "uri" - }, - "newAccounts": { - "type": "boolean", - "default": false - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "entityid": { - "type": "string" - }, - "idpurl": { - "type": "string", - "format": "uri" - }, - "cert": { - "type": "string" - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Then set, the user will be redirected to this URL when hitting the logout link." - } + "callbackurl": { "type": "string", "format": "uri" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "entityid": { "type": "string" }, + "idpurl": { "type": "string", "format": "uri" }, + "cert": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} }, - "required": [ - "entityid", - "idpurl", - "cert" - ] + "required": [ "entityid", "idpurl", "cert" ] }, "saml": { "type": "object", "properties": { - "callbackurl": { - "type": "string", - "format": "uri" - }, - "disableRequestedAuthnContext": { - "type": "boolean" - }, - "newAccounts": { - "type": "boolean", - "default": false - }, - "newAccountsUserGroups": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "newAccountsRights": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "entityid": { - "type": "string" - }, - "idpurl": { - "type": "string", - "format": "uri" - }, - "cert": { - "type": "string" - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Then set, the user will be redirected to this URL when hitting the logout link." - } + "callbackurl": { "type": "string", "format": "uri" }, + "disableRequestedAuthnContext": { "type": "boolean" }, + "newAccounts": { "type": "boolean", "default": false }, + "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "newAccountsRights": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "entityid": { "type": "string" }, + "idpurl": { "type": "string", "format": "uri" }, + "cert": { "type": "string" }, + "logouturl": {"type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link."} }, - "required": [ - "entityid", - "idpurl", - "cert" - ] + "required": [ "entityid", "idpurl", "cert" ] }, "oidc": { "type": "object", - "description": "Enables the use of OpenID Connect SSO", - "anyOf": [ - { - "required": [ - "client" - ] - }, - { - "required": [ - "client", - "custom" - ] - }, - { - "required": [ - "client", - "issuer" - ] - }, - { - "required": [ - "clientid", - "clientsecret", - "issuer" - ] - } - ], "properties": { - "newAccounts": { - "type": "boolean", - "description": "Enable the creation of new accounts based upon Idp Authorization", - "default": true - }, - "newAccountsUserGroups": { - "type": [ - "string", - "array" - ], - "description": "Add all new users to these static MeshCentral user groups. Use this if the new groups section does not work with your preset.", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "newAccountsRights": { - "type": [ - "array", - "string" - ], - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "clientid": { - "type": "string", - "depreciated": true, - "description": "REPLACED WITH 'client.client_id'" - }, - "clientsecret": { - "type": "string", - "description": "REPLACED WITH 'client.client_secret'" - }, - "authorizationURL": { - "type": "string", - "format": "uri", - "depreciated": true, - "description": "REPLACED WITH 'issuer.authorization_endpoint'" - }, - "tokenURL": { - "type": "string", - "format": "uri", - "depreciated": true, - "description": "REPLACED WITH 'issuer.token_endpoint': If set, this will be used as the token URL." - }, - "userInfoURL": { - "type": "string", - "format": "uri", - "depreciated": true, - "description": "REPLACED WITH 'issuer.userinfo_endpoint': If set, this will be used as the user info URL." - }, - "scope": { - "type": [ - "string", - "array" - ], - "depreciated": true, - "description": "REPLACED WITH 'custom.scope': A list of scopes to request from the issuer." - }, - "callbackURL": { - "type": "string", - "format": "uri", - "depreciated": true, - "description": "REPLACED WITH 'client.redirect_uri': The URI your IdP sends you back to after successful authorization. This must match what is listed with your IdP." - }, - "logouturl": { - "type": "string", - "format": "uri", - "description": "Overrides defaults ( [issuer.end_session_endpoint]?post_logout_redirect_uri=[post_logout_redirect_uri] OR [issuer.end_session_endpoint] )" - }, - "client": { - "type": "object", - "description": "OIDC Client Options", - "properties": { - "client_id": { - "type": "string", - "description": "REQUIRED: The client ID provided by your Identity Provider (IdP)" - }, - "client_secret": { - "type": "string", - "description": "REQUIRED: The client secret provided by your Identity Provider (IdP)" - }, - "id_token_signed_response_alg": { - "type": "string", - "default": "RS256", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "id_token_encrypted_response_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "id_token_encrypted_response_enc": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "userinfo_signed_response_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "userinfo_encrypted_response_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "userinfo_encrypted_response_enc": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "redirect_uri": { - "type": "string", - "format": "uri", - "description": "URI your IdP sends you after successful authorization. This must match what is listed with your IdP. (Default is https://[currentHost][currentPath]/auth-oidc-callback)" - }, - "response_types": { - "type": [ - "string", - "array" - ], - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details", - "default": [ - "code" - ] - }, - "post_logout_redirect_uri": { - "type": "string", - "format": "uri", - "description": "URI for your IdP to send you after logging out of IdP via MeshCentral. (Default is https:[currentHost][currentPath]/login)" - }, - "default_max_age": { - "type": "number", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "require_auth_time": { - "type": "boolean", - "default": false, - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "request_object_signing_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "request_object_encryption_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "request_object_encryption_enc": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "token_endpoint_auth_method": { - "type": "string", - "default": "client_secret_basic", - "enum": [ - "none", - "client_secret_basic", - "client_secret_post", - "client_secret_jwt", - "private_key_jwt" - ], - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "introspection_endpoint_auth_method": { - "type": "string", - "default": "client_secret_basic", - "enum": [ - "none", - "client_secret_basic", - "client_secret_post", - "client_secret_jwt", - "private_key_jwt" - ], - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "revocation_endpoint_auth_method": { - "type": "string", - "default": "client_secret_basic", - "enum": [ - "none", - "client_secret_basic", - "client_secret_post", - "client_secret_jwt", - "private_key_jwt" - ], - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "token_endpoint_auth_signing_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "introspection_endpoint_auth_signing_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "revocation_endpoint_auth_signing_alg": { - "type": "string", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - }, - "tls_client_certificate_bound_access_tokens": { - "type": "boolean", - "description": "ADVANCED CONFIG: Check node-openid-client on GitHub for details" - } - }, - "required": [ - "client_id", - "client_secret" - ] - }, - "issuer": { - "type": [ - "string", - "object" - ], - "format": "uri", - "description": "Issuer options. Requires issuer URI (issuer.issuer) to discover missing information unless using preset", - "properties": { - "issuer": { - "type": "string", - "format": "uri", - "description": "URI of the issuer." - }, - "authorization_endpoint": { - "type": "string", - "format": "uri" - }, - "token_endpoint": { - "type": "string", - "format": "uri" - }, - "jwks_uri": { - "type": "string", - "format": "uri" - }, - "userinfo_endpoint": { - "type": "string", - "format": "uri" - }, - "revocation_endpoint": { - "type": "string", - "format": "uri" - }, - "introspection_endpoint": { - "type": "string", - "format": "uri" - }, - "end_session_endpoint": { - "type": "string", - "format": "uri", - "description": "URI to direct users to when logging out of MeshCentral. (Attempts to autodetect, defaults to '[issuer.issuer]/logout')" - }, - "registration_endpoint": { - "type": "string", - "format": "uri" - }, - "token_endpoint_auth_methods_supported": { - "type": "string" - }, - "token_endpoint_auth_signing_alg_values_supported": { - "type": "string" - }, - "introspection_endpoint_auth_methods_supported": { - "type": "string" - }, - "introspection_endpoint_auth_signing_alg_values_supported": { - "type": "string" - }, - "revocation_endpoint_auth_methods_supported": { - "type": "string" - }, - "revocation_endpoint_auth_signing_alg_values_supported": { - "type": "string" - }, - "request_object_signing_alg_values_supported": { - "type": "string" - }, - "mtls_endpoint_aliases": { - "type": "object", - "properties": { - "token_endpoint": { - "type": "string", - "format": "uri" - }, - "userinfo_endpoint": { - "type": "string", - "format": "uri" - }, - "revocation_endpoint": { - "type": "string", - "format": "uri" - }, - "introspection_endpoint": { - "type": "string", - "format": "uri" - } - } - } - } - }, - "custom": { - "type": "object", - "properties": { - "scope": { - "type": [ - "string", - "array" - ], - "description": "A list of scopes to request from the issuer.", - "default": "openid profile email", - "examples": [ - "openid", - [ - "openid", - "profile" - ], - "openid profile email", - "openid profile email groups" - ] - }, - "claims": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - }, - "preset": { - "type": "string", - "enum": [ - "azure", - "google" - ] - }, - "tenant_id": { - "type": "string", - "description": "REQUIRED FOR AZURE PRESET: Tenantid for Azure" - }, - "customer_id": { - "type": "string", - "description": "REQUIRED IF USING GROUPS: Customer ID from Google Workspace Admin Console (https://admin.google.com/ac/accountsettings/profile)" - } - } - }, - "groups": { - "type": "object", - "properties": { - "recursive": { - "type": "boolean", - "default": false, - "description": "When true, the group memberships will be scanned recursively." - }, - "required": { - "type": [ - "array" - ], - "description": "Access is only granted to users who are a member of at least one of the listed required groups." - }, - "siteadmin": { - "type": [ - "array" - ], - "description": "Full site admin priviledges will be granted to users who are a member of at least one of the listed admin groups." - }, - "revokeAdmin": { - "type": "boolean", - "description": "If true, admin privileges will be revoked from users who are NOT a member of at least one of the listed admin groups." - }, - "sync": { - "type": [ - "boolean", - "object" - ], - "default": false, - "description": "If true, all groups found during user login are mirrored into MeshCentral user groups.", - "properties": { - "filter": { - "type": [ - "array" - ], - "description": "Only groups listed here are mirrored into MeshCentral user groups." - } - } - }, - "scope": { - "type": "string", - "default": "groups", - "description": "Custom scope to use." - }, - "claim": { - "type": "string", - "default": "groups", - "description": "Custom claim to use." - } - } - } - } + "authorizationURL": { "type": "string", "format": "uri", "description": "If set, this will be used as the authorization URL. (If set tokenURL and userInfoURL need set also)" }, + "callbackURL": { "type": "string", "format": "uri", "description": "Required, this is the URL that your SSO provider sends auth approval to." }, + "clientid": { "type": "string" }, + "clientsecret": { "type": "string" }, + "issuer": { "type": "string", "format": "uri", "description": "Full URL of SSO portal" }, + "tokenURL": { "type": "string", "format": "uri", "description": "If set, this will be used as the token URL. (If set authorizationURL and userInfoURL need set also)" }, + "userInfoURL": { "type": "string", "format": "uri", "description": "If set, this will be used as the user info URL. (If set authorizationURL and tokenURL need set also)" }, + "logouturl": { "type": "string", "format": "uri", "description": "Then set, the user will be redirected to this URL when hitting the logout link." }, + "newAccounts": { "type": "boolean", "default": true } + }, + "required": [ "issuer", "clientid", "clientsecret", "callbackURL" ] } } - }, - "showLanguageSelect": { - "type": "string", - "default": null, - "description": "Show Language Selector on Login Page, \"top\" inside Login Box or \"bottom\" at Bottom of Page", - "enum": [ - null, - "top", - "bottom" - ] } } } }, "letsEncrypt": { - "title": "Built-in Let's Encrypt support", + "title" : "Built-in Let's Encrypt support", "description": "If your server has a proper DNS name and it public facing on the Internet with a public facing HTTP server on port 80, you can get a free TLS certificate.", "type": "object", + "additionalProperties": false, "properties": { - "email": { - "type": "string", - "format": "email", - "description": "Email address of the administrator of this server. Make sure this is a valid email address otherwise the certificate request will fail." - }, - "names": { - "type": "string" - }, - "skipChallengeVerification": { - "type": "boolean", - "default": false, - "description": "By default, MeshCentral will perform a self-test to make sure HTTP port 80 can respond correctly before making a request to Let's Encrypt. In some cases, this self-test can't work and must be skipped." - }, - "production": { - "type": "boolean", - "default": false, - "description": "By default a test certificate will be obtained from Let's Encrypt. Setting \"zerossl\", will ignore this setting. Always start by getting a test certificate and make sure that works before setting this to true and obtaining a production certificate. Making too many bad requests for a production certificate will get you banned for a long period of time." - }, - "nochecks": { - "type": "boolean", - "default": false, - "description": "If you choose \"true\", MeshCentral won't verify if \"email\" is valid, has a valid MX record, AND if \"names\" doesn't contain a wildcard, can be resolved by DNS A/AAAA record." - }, - "zerossl": { - "type": "object", - "description": "If this object is set, we will use ZeroSSL for SSL creation instead of Let's Encrypt", - "required": [ - "kid", - "hmacKey" - ], - "properties": { - "kid": { - "type": "string", - "description": "EAB KID", - "default": "" - }, - "hmackey": { - "type": "string", - "description": "EAB HMAC KEY", - "default": "" - } - } - } + "email": { "type": "string", "format": "email", "description": "Email address of the administrator of this server. Make sure this is a valid email address otherwise the certificate request will fail." }, + "names": { "type": "string" }, + "skipChallengeVerification": { "type": "boolean", "default": false, "description": "By default, MeshCentral will perform a self-test to make sure HTTP port 80 can respond correctly before making a request to Let's Encrypt. In some cases, this self-test can't work and must be skipped." }, + "production": { "type": "boolean", "default": false, "description": "By default a test certificate will be obtained from Let's Encrypt. Always start by getting a test certificate and make sure that works before setting this to true and obtaining a production certificaite. Making too many bad requests for a production certificate will get you banned for a long period of time." } }, - "required": [ - "email", - "names" - ] + "required": [ "email", "names" ] }, "peers": { - "title": "Server peering", + "title" : "Server peering", "description": "Setup peer server for load-balancing between many servers.", "type": "object", "minProperties": 1, - "propertyNames": { - "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" - }, + "propertyNames": { "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" }, + "additionalProperties": false, "properties": { - "serverId": { - "type": "string" - }, + "serverId": { "type": "string" }, "servers": { "type": "object", "additionalProperties": { "type": "object", - "properties": { - "url": { - "type": "string", - "format": "uri" - } - }, - "required": [ - "url" - ] + "properties": { "url": { "type": "string", "format": "uri" } }, + "required": [ "url" ] } } }, - "required": [ - "serverId", - "servers" - ] + "required": [ "serverId", "servers" ] }, "sendgrid": { - "title": "SendGrid.com Email server", + "title" : "SendGrid.com Email server", "description": "Connects MeshCentral to the SendGrid email server, allows MeshCentral to send email messages for 2FA or user notification.", "type": "object", "properties": { - "from": { - "type": "string", - "format": "email", - "description": "Email address used in the messages from field." - }, - "apikey": { - "type": "string", - "description": "The SendGrid API key." - }, - "verifyemail": { - "type": "boolean", - "default": true, - "description": "When set to false, the email format and DNS MX record are not checked." - } + "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, + "apikey": { "type": "string", "description": "The SendGrid API key." }, + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." } }, - "required": [ - "from", - "apikey" - ] + "required": [ "from", "apikey" ] }, "smtp": { - "title": "SMTP email server", + "title" : "SMTP email server", "description": "Connects MeshCentral to a SMTP email server, allows MeshCentral to send email messages for 2FA or user notification.", "type": "object", "properties": { - "name": { - "type": "string", - "format": "hostname", - "description": "Optional hostname of the client, this defaults to the hostname of the machine. This is useful for SMTP relays. This can also be set to \"console\" for console output debugging." - }, - "host": { - "type": "string", - "format": "hostname", - "description": "Hostname of the SMTP server." - }, - "port": { - "type": "integer", - "minimum": 1, - "maximum": 65535, - "default": 587, - "description": "SMTP server port number. This defaults to 587 if \"tls\" is false or 465 if \"tls\" is true)" - }, - "from": { - "type": "string", - "format": "email", - "description": "Email address used in the messages from field." - }, - "user": { - "type": "string", - "description": "SMTP username." - }, - "pass": { - "type": "string", - "description": "SMTP password." - }, - "tls": { - "type": "boolean", - "default": false, - "description": "Set SMTP to use TLS on connections, the default is false" - }, - "auth": { - "type": "object", - "description": "This is used for OAuth2 authentication", - "properties": { - "clientId": { - "type": "string" - }, - "clientSecret": { - "type": "string" - }, - "refreshToken": { - "type": "string" - }, - "type": { - "type": "string", - "default": "login", - "description": "Setting this indicates the authetication type, 'login' as default or 'oauth2'" - } - }, - "required": [ - "clientId", - "clientSecret", - "refreshToken" - ] - }, - "tlscertcheck": { - "type": "boolean" - }, - "tlsstrict": { - "type": "boolean" - }, - "verifyemail": { - "type": "boolean", - "default": true, - "description": "When set to false, the email format and DNS MX record are not checked." - }, - "emailDelaySeconds": { - "type": "integer", - "default": 300, - "description": "Time to wait before sending a device connection/disconnection notification email. If many events occur, they will be merged into a single email." - } + "host": { "type": "string", "format": "hostname" }, + "port": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." }, + "tls": { "type": "boolean" }, + "tlscertcheck": { "type": "boolean" }, + "tlsstrict": { "type": "boolean" }, + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." } }, - "required": [ - "host", - "port", - "from", - "tls" - ] - }, - "sendmail": { - "title": "Send email using the sendmail command", - "description": "Makes MeshCentral send emails using the Unix sendmail command. Allows MeshCentral to send email messages for 2FA or user notification.", - "type": "object", - "properties": { - "newline": { - "type": "string", - "default": "unix", - "description": "Possible values are unix or windows" - }, - "path": { - "type": "string", - "default": "sendmail", - "description": "Path to the sendmail command" - }, - "args": { - "type": "array", - "items": { - "type": "string" - }, - "default": null, - "description": "Array or arguments to pass to sendmail" - }, - "emailDelaySeconds": { - "type": "integer", - "default": 300, - "description": "Time to wait before sending a device connection/disconnection notification email. If many events occur, they will be merged into a single email." - } - } + "required": [ "host", "port", "from", "tls" ] }, "sms": { - "title": "SMS provider", + "title" : "SMS provider", "description": "Connects MeshCentral to a SMS text messaging provider, allows MeshCentral to send SMS messages for 2FA or user notification.", "oneOf": [ { - "type": "object", + "type": "object", "properties": { - "provider": { - "type": "string", - "enum": [ - "twilio" - ] - }, - "sid": { - "type": "string" - }, - "auth": { - "type": "string" - }, - "from": { - "type": "string" - } + "provider": { "type": "string", "enum": [ "twilio" ] }, + "sid": { "type": "string" }, + "auth": { "type": "string" }, + "from": { "type": "string" } }, - "required": [ - "provider", - "sid", - "auth", - "from" - ] + "required": [ "provider", "sid", "auth", "from" ] }, { - "type": "object", + "type": "object", "properties": { - "provider": { - "type": "string", - "enum": [ - "plivo" - ] - }, - "id": { - "type": "string" - }, - "token": { - "type": "string" - }, - "from": { - "type": "string" - } + "provider": { "type": "string", "enum": [ "plivo" ] }, + "id": { "type": "string" }, + "token": { "type": "string" }, + "from": { "type": "string" } }, - "required": [ - "provider", - "id", - "token", - "from" - ] + "required": [ "provider", "id", "token", "from" ] }, { - "type": "object", + "type": "object", "properties": { - "provider": { - "type": "string", - "enum": [ - "telnyx" - ] - }, - "apikey": { - "type": "string" - }, - "from": { - "type": "string" - } + "provider": { "type": "string", "enum": [ "telnyx" ] }, + "apikey": { "type": "string" }, + "from": { "type": "string" } }, - "required": [ - "provider", - "apikey", - "from" - ] - }, - { - "type": "object", - "properties": { - "provider": { - "type": "string", - "enum": [ - "url" - ] - }, - "url": { - "type": "string", - "description": "A http or https URL with {{phone}} and {{message}} in the string. These will be replaced with the URL encoded target phone number and message." - } - }, - "required": [ - "url" - ] + "required": [ "provider", "apikey", "from" ] } ] - }, - "messaging": { - "title": "Messaging server", - "description": "This section allow MeshCentral to send messages over user messaging networks like Telegram", - "type": "object", - "properties": { - "telegram": { - "type": "object", - "description": "Configure Telegram messaging system", - "properties": { - "apiid": { - "type": "number" - }, - "apihash": { - "type": "string" - }, - "session": { - "type": "string" - }, - "useWSS": { - "type": "boolean", - "description": "Whether to try to connect over Wss (or 443 port) or not" - }, - "connectionRetries": { - "type": "number", - "description": "How many times the reconnection should retry, either on the initial connection or when Telegram disconnects us. May be set to a negative value for infinite retries, but this is not recommended. Defaults to 5" - } - } - }, - "discord": { - "type": "object", - "description": "Configure Discord messaging system", - "properties": { - "serverurl": { - "type": "string", - "format": "uri", - "description": "An optional HTTP link to the discord server the user must join to get notifications." - }, - "token": { - "type": "string", - "description": "A Discord bot token that MeshCentral will use to login to Discord." - } - }, - "required": [ - "token" - ] - }, - "xmpp": { - "type": "object", - "description": "Configure XMPP messaging system", - "properties": { - "service": { - "type": "string", - "description": "Host name of the XMPP server." - }, - "credentials": { - "type": "object", - "description": "Login credentials for the XMPP server.", - "properties": { - "username": { - "type": "string" - }, - "password": { - "type": "string" - } - } - } - }, - "required": [ - "credentials" - ] - }, - "callmebot": { - "type": "boolean", - "default": false, - "description": "Enabled CallMeBot integration support." - }, - "slack": { - "type": "boolean", - "default": false, - "description": "Enabled Slack integration support." - }, - "pushover": { - "type": "object", - "description": "Configure Pushover messaging system", - "properties": { - "token": { - "type": "string", - "description": "A Pushover application token that MeshCentral will use to login." - } - }, - "required": [ - "token" - ] - }, - "ntfy": { - "type": [ - "boolean", - "object" - ], - "default": false, - "properties": { - "host": { - "type": "string", - "description": "Host name of the ntfy server." - }, - "userurl": { - "type": "string", - "description": "A URL given to users to help them setup this service." - }, - "authorization": { - "type": "string", - "description": "Authorization Header to include in the request" - } - }, - "description": "Enabled ntfy.sh integration support." - }, - "zulip": { - "type": "object", - "properties": { - "site": { - "type": "string", - "format": "uri", - "default": "https://api.zulip.com", - "description": "URL to the Zulip server" - }, - "email": { - "type": "string", - "description": "Bot email address to login as." - }, - "api_key": { - "type": "string", - "description": "Bot api key." - } - }, - "description": "Enabled Zulip integration support." - } - } } - } + }, + "required": [ "settings", "domains" ] } diff --git a/meshcentral.js b/meshcentral.js index a792dda5..3d5a0590 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -22,20 +22,18 @@ if (process.argv[2] == '--launch') { try { require('appmetrics-dash').monitor({ function CreateMeshCentralServer(config, args) { const obj = {}; obj.db = null; - obj.webserver = null; // HTTPS main web server, typically on port 443 - obj.redirserver = null; // HTTP relay web server, typically on port 80 - obj.mpsserver = null; // Intel AMT CIRA server, typically on port 4433 - obj.mqttbroker = null; // MQTT server, not is not often used - obj.swarmserver = null; // Swarm server, this is used only to update older MeshCentral v1 agents - obj.smsserver = null; // SMS server, used to send user SMS messages - obj.msgserver = null; // Messaging server, used to sent used messages + obj.webserver = null; + obj.redirserver = null; + obj.mpsserver = null; + obj.mqttbroker = null; + obj.swarmserver = null; + obj.smsserver = null; obj.amtEventHandler = null; obj.pluginHandler = null; obj.amtScanner = null; - obj.amtManager = null; // Intel AMT manager, used to oversee all Intel AMT devices, activate them and sync policies + obj.amtManager = null; obj.meshScanner = null; - obj.taskManager = null; - obj.letsencrypt = null; // Let's encrypt server, used to get and renew TLS certificates + obj.letsencrypt = null; obj.eventsDispatch = {}; obj.fs = require('fs'); obj.path = require('path'); @@ -86,7 +84,7 @@ function CreateMeshCentralServer(config, args) { obj.parentpath = obj.path.join(__dirname, '../..'); obj.datapath = obj.path.join(__dirname, '../../meshcentral-data'); obj.filespath = obj.path.join(__dirname, '../../meshcentral-files'); - obj.backuppath = obj.path.join(__dirname, '../../meshcentral-backups'); + obj.backuppath = obj.path.join(__dirname, '../../meshcentral-backup'); obj.recordpath = obj.path.join(__dirname, '../../meshcentral-recordings'); obj.webViewsPath = obj.path.join(__dirname, 'views'); obj.webPublicPath = obj.path.join(__dirname, 'public'); @@ -139,23 +137,9 @@ function CreateMeshCentralServer(config, args) { try { require('./pass').hash('test', function () { }, 0); } catch (ex) { console.log('Old version of node, must upgrade.'); return; } // TODO: Not sure if this test works or not. // Check for invalid arguments - const validArguments = ['_', 'user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'rediraliasport', 'cert', 'mpscert', 'deletedomain', 'deletedefaultdomain', 'showall', 'showusers', 'showitem', 'listuserids', 'showusergroups', 'shownodes', 'showallmeshes', 'showmeshes', 'showevents', 'showsmbios', 'showpower', 'clearpower', 'showiplocations', 'help', 'exactports', 'xinstall', 'xuninstall', 'install', 'uninstall', 'start', 'stop', 'restart', 'debug', 'filespath', 'datapath', 'noagentupdate', 'launch', 'noserverbackup', 'mongodb', 'mongodbcol', 'wanonly', 'lanonly', 'nousers', 'mpspass', 'ciralocalfqdn', 'dbexport', 'dbexportmin', 'dbimport', 'dbmerge', 'dbfix', 'dbencryptkey', 'selfupdate', 'tlsoffload', 'usenodedefaulttlsciphers', 'tlsciphers', 'userallowedip', 'userblockedip', 'swarmallowedip', 'agentallowedip', 'agentblockedip', 'fastcert', 'swarmport', 'logintoken', 'logintokenkey', 'logintokengen', 'mailtokengen', 'admin', 'unadmin', 'sessionkey', 'sessiontime', 'minify', 'minifycore', 'dblistconfigfiles', 'dbshowconfigfile', 'dbpushconfigfiles', 'oldencrypt', 'dbpullconfigfiles', 'dbdeleteconfigfiles', 'vaultpushconfigfiles', 'vaultpullconfigfiles', 'vaultdeleteconfigfiles', 'configkey', 'loadconfigfromdb', 'npmpath', 'serverid', 'recordencryptionrecode', 'vault', 'token', 'unsealkey', 'name', 'log', 'dbstats', 'translate', 'createaccount', 'setuptelegram', 'resetaccount', 'pass', 'removesubdomain', 'adminaccount', 'domain', 'email', 'configfile', 'maintenancemode', 'nedbtodb', 'removetestagents', 'agentupdatetest', 'hashpassword', 'hashpass', 'indexmcrec', 'mpsdebug', 'dumpcores', 'dev', 'mysql', 'mariadb', 'trustedproxy']; + const validArguments = ['_', 'user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'rediraliasport', 'cert', 'mpscert', 'deletedomain', 'deletedefaultdomain', 'showall', 'showusers', 'showitem', 'listuserids', 'showusergroups', 'shownodes', 'showallmeshes', 'showmeshes', 'showevents', 'showsmbios', 'showpower', 'clearpower', 'showiplocations', 'help', 'exactports', 'xinstall', 'xuninstall', 'install', 'uninstall', 'start', 'stop', 'restart', 'debug', 'filespath', 'datapath', 'noagentupdate', 'launch', 'noserverbackup', 'mongodb', 'mongodbcol', 'wanonly', 'lanonly', 'nousers', 'mpspass', 'ciralocalfqdn', 'dbexport', 'dbexportmin', 'dbimport', 'dbmerge', 'dbfix', 'dbencryptkey', 'selfupdate', 'tlsoffload', 'userallowedip', 'userblockedip', 'swarmallowedip', 'agentallowedip', 'agentblockedip', 'fastcert', 'swarmport', 'logintoken', 'logintokenkey', 'logintokengen', 'mailtokengen', 'admin', 'unadmin', 'sessionkey', 'sessiontime', 'minify', 'minifycore', 'dblistconfigfiles', 'dbshowconfigfile', 'dbpushconfigfiles', 'dbpullconfigfiles', 'dbdeleteconfigfiles', 'vaultpushconfigfiles', 'vaultpullconfigfiles', 'vaultdeleteconfigfiles', 'configkey', 'loadconfigfromdb', 'npmpath', 'serverid', 'recordencryptionrecode', 'vault', 'token', 'unsealkey', 'name', 'log', 'dbstats', 'translate', 'createaccount', 'resetaccount', 'pass', 'removesubdomain', 'adminaccount', 'domain', 'email', 'configfile', 'maintenancemode', 'nedbtodb', 'removetestagents', 'agentupdatetest', 'hashpassword', 'hashpass', 'indexmcrec', 'mpsdebug', 'dumpcores']; for (var arg in obj.args) { obj.args[arg.toLocaleLowerCase()] = obj.args[arg]; if (validArguments.indexOf(arg.toLocaleLowerCase()) == -1) { console.log('Invalid argument "' + arg + '", use --help.'); return; } } - const ENVVAR_PREFIX = "meshcentral_" - let envArgs = [] - for (let [envvar, envval] of Object.entries(process.env)) { - if (envvar.toLocaleLowerCase().startsWith(ENVVAR_PREFIX)) { - let argname = envvar.slice(ENVVAR_PREFIX.length).toLocaleLowerCase() - if (!!argname && !(validArguments.indexOf(argname) == -1)) { - envArgs = envArgs.concat([`--${argname}`, envval]) - } - } - } - envArgs = require('minimist')(envArgs) - obj.args = Object.assign(envArgs, obj.args) if (obj.args.mongodb == true) { console.log('Must specify: --mongodb [connectionstring] \r\nSee https://docs.mongodb.com/manual/reference/connection-string/ for MongoDB connection string.'); return; } - if (obj.args.mysql == true) { console.log('Must specify: --mysql [connectionstring] \r\nExample mysql://user:password@127.0.0.1:3306/database'); return; } - if (obj.args.mariadb == true) { console.log('Must specify: --mariadb [connectionstring] \r\nExample mariadb://user:password@127.0.0.1:3306/database'); return; } for (i in obj.config.settings) { obj.args[i] = obj.config.settings[i]; } // Place all settings into arguments, arguments have already been placed into settings so arguments take precedence. if ((obj.args.help == true) || (obj.args['?'] == true)) { @@ -188,14 +172,14 @@ function CreateMeshCentralServer(config, args) { // Fix a NeDB database if (obj.args.dbfix) { - var lines = null, badJsonCount = 0, fieldNames = [], fixedDb = []; + var lines = null, badJsonCount = 0, feildNames = [], fixedDb = []; try { lines = obj.fs.readFileSync(obj.getConfigFilePath(obj.args.dbfix), { encoding: 'utf8' }).split('\n'); } catch (ex) { console.log('Invalid file: ' + obj.args.dbfix + ': ' + ex); process.exit(); } for (var i = 0; i < lines.length; i++) { var x = null; try { x = JSON.parse(lines[i]); } catch (ex) { badJsonCount++; } - if (x != null) { fixedDb.push(lines[i]); for (var j in x) { if (fieldNames.indexOf(j) == -1) { fieldNames.push(j); } } } + if (x != null) { fixedDb.push(lines[i]); for (var j in x) { if (feildNames.indexOf(j) == -1) { feildNames.push(j); } } } } - console.log('Lines: ' + lines.length + ', badJSON: ' + badJsonCount + ', Feilds: ' + fieldNames); + console.log('Lines: ' + lines.length + ', badJSON: ' + badJsonCount + ', Feilds: ' + feildNames); obj.fs.writeFileSync(obj.getConfigFilePath(obj.args.dbfix) + '-fixed', fixedDb.join('\n'), { encoding: 'utf8' }); return; } @@ -209,9 +193,6 @@ function CreateMeshCentralServer(config, args) { // Dump to mesh cores if (obj.args.dumpcores) { obj.updateMeshCore(function () { console.log('Done.'); }, true); return; } - // Setup Telegram - if (obj.args.setuptelegram) { require('./meshmessaging.js').SetupTelegram(obj); return; } - // Perform web site translations into different languages if (obj.args.translate) { // Check NodeJS version @@ -220,7 +201,7 @@ function CreateMeshCentralServer(config, args) { // Check if translate.json is in the "meshcentral-data" folder, if so use that and translate default pages. var translationFile = null, customTranslation = false; - if (require('fs').existsSync(obj.path.join(obj.datapath, 'translate.json'))) { translationFile = obj.path.join(obj.datapath, 'translate.json'); console.log("Using translate.json in meshcentral-data."); customTranslation = true; } + if (require('fs').existsSync(obj.path.join(obj.datapath, 'translate.json'))) { translationFile = obj.path.join(obj.datapath, 'translate.json'); console.log("Using translate.json in meshentral-data."); customTranslation = true; } if (translationFile == null) { if (require('fs').existsSync(obj.path.join(__dirname, 'translate', 'translate.json'))) { translationFile = obj.path.join(__dirname, 'translate', 'translate.json'); console.log("Using default translate.json."); } } if (translationFile == null) { console.log("Unable to find translate.json."); process.exit(); return; } @@ -234,12 +215,6 @@ function CreateMeshCentralServer(config, args) { translateEngine.startEx(['', '', 'translateall', translationFile]); translateEngine.startEx(['', '', 'extractall', translationFile]); didSomething = true; - } else { - // Translate all of the default files - translateEngine.startEx(['', '', 'minifyall']); - translateEngine.startEx(['', '', 'translateall']); - translateEngine.startEx(['', '', 'extractall']); - didSomething = true; } // Check if "meshcentral-web" exists, if so, translate all pages in that folder. @@ -255,34 +230,11 @@ function CreateMeshCentralServer(config, args) { files = obj.fs.readdirSync(obj.webViewsOverridePath); for (var i in files) { var file = obj.path.join(obj.webViewsOverridePath, files[i]); - if (file.endsWith('.handlebars') && !file.endsWith('-min.handlebars')) { + if (file.endsWith('.handlebars') || file.endsWith('-min.handlebars')) { translateEngine.startEx(['', '', 'translate', '*', translationFile, file, '--subdir:translations']); } } } - - // Check domains and see if "meshcentral-web-DOMAIN" exists, if so, translate all pages in that folder - for (i in obj.config.domains) { - if (i == "") continue; - var path = obj.path.join(obj.datapath, '..', 'meshcentral-web-' + i, 'views'); - if (require('fs').existsSync(path)) { - didSomething = true; - var files = obj.fs.readdirSync(path); - for (var a in files) { - var file = obj.path.join(path, files[a]); - if (file.endsWith('.handlebars') && !file.endsWith('-min.handlebars')) { - translateEngine.startEx(['', '', 'minify', file]); - } - } - files = obj.fs.readdirSync(path); - for (var a in files) { - var file = obj.path.join(path, files[a]); - if (file.endsWith('.handlebars') && !file.endsWith('-min.handlebars')) { - translateEngine.startEx(['', '', 'translate', '*', translationFile, file, '--subdir:translations']); - } - } - } - } /* if (obj.webPublicOverridePath != null) { didSomething = true; @@ -297,7 +249,6 @@ function CreateMeshCentralServer(config, args) { */ if (didSomething == false) { console.log("Nothing to do."); } - console.log('Finished Translating.') process.exit(); return; } @@ -330,7 +281,7 @@ function CreateMeshCentralServer(config, args) { require('child_process').exec('which node', {}, function (error, stdout, stderr) { if ((error != null) || (stdout.indexOf('\n') == -1)) { console.log('ERROR: Unable to get node location: ' + error); process.exit(); return; } const nodePath = stdout.substring(0, stdout.indexOf('\n')); - const config = '[Unit]\nDescription=MeshCentral Server\nWants=network-online.target\nAfter=network-online.target\n\n[Service]\nType=simple\nLimitNOFILE=1000000\nExecStart=' + nodePath + ' ' + __dirname + '/meshcentral\nWorkingDirectory=' + userinfo.homedir + '\nEnvironment=NODE_ENV=production\nUser=' + userinfo.username + '\nGroup=' + userinfo.username + '\nRestart=always\n# Restart service after 10 seconds if node service crashes\nRestartSec=10\n# Set port permissions capability\nAmbientCapabilities=cap_net_bind_service\n\n[Install]\nWantedBy=multi-user.target\n'; + const config = '[Unit]\nDescription=MeshCentral Server\n\n[Service]\nType=simple\nLimitNOFILE=1000000\nExecStart=' + nodePath + ' ' + __dirname + '/meshcentral\nWorkingDirectory=' + userinfo.homedir + '\nEnvironment=NODE_ENV=production\nUser=' + userinfo.username + '\nGroup=' + userinfo.username + '\nRestart=always\n# Restart service after 10 seconds if node service crashes\nRestartSec=10\n# Set port permissions capability\nAmbientCapabilities=cap_net_bind_service\n\n[Install]\nWantedBy=multi-user.target\n'; require('child_process').exec('echo \"' + config + '\" | sudo tee ' + systemdConf, {}, function (error, stdout, stderr) { if ((error != null) && (error != '')) { console.log('ERROR: Unable to write config file: ' + error); process.exit(); return; } console.log('Enabling service...'); @@ -394,92 +345,6 @@ function CreateMeshCentralServer(config, args) { return; } } - - // FreeBSD background service handling, MUST USE SPAWN FOR SERVICE COMMANDS! - if (obj.platform == 'freebsd') { - if (obj.args.install == true) { - // Install MeshCentral in rc.d - console.log('Installing MeshCentral as background Service...'); - var systemdConf = "/usr/local/etc/rc.d/meshcentral"; - const userinfo = require('os').userInfo(); - console.log('Writing config file...'); - require('child_process').exec('which node', {}, function (error, stdout, stderr) { - if ((error != null) || (stdout.indexOf('\n') == -1)) { console.log('ERROR: Unable to get node location: ' + error); process.exit(); return; } - const nodePath = stdout.substring(0, stdout.indexOf('\n')); - const config = '#!/bin/sh\n# MeshCentral FreeBSD Service Script\n# PROVIDE: meshcentral\n# REQUIRE: NETWORKING\n# KEYWORD: shutdown\n. /etc/rc.subr\nname=meshcentral\nuser=' + userinfo.username + '\nrcvar=meshcentral_enable\n: \\${meshcentral_enable:=\\"NO\\"}\n: \\${meshcentral_args:=\\"\\"}\npidfile=/var/run/meshcentral/meshcentral.pid\ncommand=\\"/usr/sbin/daemon\\"\nmeshcentral_chdir=\\"' + obj.parentpath + '\\"\ncommand_args=\\"-r -u \\${user} -P \\${pidfile} -S -T meshcentral -m 3 ' + nodePath + ' ' + __dirname + ' \\${meshcentral_args}\\"\nload_rc_config \\$name\nrun_rc_command \\"\\$1\\"\n'; - require('child_process').exec('echo \"' + config + '\" | tee ' + systemdConf + ' && chmod +x ' + systemdConf, {}, function (error, stdout, stderr) { - if ((error != null) && (error != '')) { console.log('ERROR: Unable to write config file: ' + error); process.exit(); return; } - console.log('Enabling service...'); - require('child_process').exec('sysrc meshcentral_enable="YES"', {}, function (error, stdout, stderr) { - if ((error != null) && (error != '')) { console.log('ERROR: Unable to enable MeshCentral as a service: ' + error); process.exit(); return; } - if (stdout.length > 0) { console.log(stdout); } - console.log('Starting service...'); - const service = require('child_process').spawn('service', ['meshcentral', 'start']); - service.stdout.on('data', function (data) { console.log(data.toString()); }); - service.stderr.on('data', function (data) { console.log(data.toString()); }); - service.on('exit', function (code) { - console.log((code === 0) ? 'Done.' : 'ERROR: Unable to start MeshCentral as a service'); - process.exit(); // Must exit otherwise we just hang - }); - }); - }); - }); - return; - } else if (obj.args.uninstall == true) { - // Uninstall MeshCentral in rc.d - console.log('Uninstalling MeshCentral background service...'); - var systemdConf = "/usr/local/etc/rc.d/meshcentral"; - console.log('Stopping service...'); - const service = require('child_process').spawn('service', ['meshcentral', 'stop']); - service.stdout.on('data', function (data) { console.log(data.toString()); }); - service.stderr.on('data', function (data) { console.log(data.toString()); }); - service.on('exit', function (code) { - if (code !== 0) { console.log('ERROR: Unable to stop MeshCentral as a service'); } - console.log('Disabling service...'); - require('child_process').exec('sysrc -x meshcentral_enable', {}, function (err, stdout, stderr) { - if ((err != null) && (err != '')) { console.log('ERROR: Unable to disable MeshCentral as a service: ' + err); } - if (stdout.length > 0) { console.log(stdout); } - console.log('Removing config file...'); - require('child_process').exec('rm ' + systemdConf, {}, function (err, stdout, stderr) { - if ((err != null) && (err != '')) { console.log('ERROR: Unable to delete MeshCentral config file: ' + err); } - console.log('Done.'); - process.exit(); // Must exit otherwise we just hang - }); - }); - }); - return; - } else if (obj.args.start == true) { - // Start MeshCentral in rc.d - const service = require('child_process').spawn('service', ['meshcentral', 'start']); - service.stdout.on('data', function (data) { console.log(data.toString()); }); - service.stderr.on('data', function (data) { console.log(data.toString()); }); - service.on('exit', function (code) { - console.log((code === 0) ? 'Done.' : 'ERROR: Unable to start MeshCentral as a service: ' + error); - process.exit(); // Must exit otherwise we just hang - }); - return; - } else if (obj.args.stop == true) { - // Stop MeshCentral in rc.d - const service = require('child_process').spawn('service', ['meshcentral', 'stop']); - service.stdout.on('data', function (data) { console.log(data.toString()); }); - service.stderr.on('data', function (data) { console.log(data.toString()); }); - service.on('exit', function (code) { - console.log((code === 0) ? 'Done.' : 'ERROR: Unable to stop MeshCentral as a service: ' + error); - process.exit(); // Must exit otherwise we just hang - }); - return; - } else if (obj.args.restart == true) { - // Restart MeshCentral in rc.d - const service = require('child_process').spawn('service', ['meshcentral', 'restart']); - service.stdout.on('data', function (data) { console.log(data.toString()); }); - service.stderr.on('data', function (data) { console.log(data.toString()); }); - service.on('exit', function (code) { - console.log((code === 0) ? 'Done.' : 'ERROR: Unable to restart MeshCentral as a service: ' + error); - process.exit(); // Must exit otherwise we just hang - }); - return; - } - } // Index a recorded file if (obj.args.indexmcrec != null) { @@ -504,7 +369,7 @@ function CreateMeshCentralServer(config, args) { // Check if we need to install, start, stop, remove ourself as a background service if (((obj.args.xinstall == true) || (obj.args.xuninstall == true) || (obj.args.start == true) || (obj.args.stop == true) || (obj.args.restart == true))) { var env = [], xenv = ['user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'exactport', 'rediraliasport', 'debug']; - for (i in xenv) { if (obj.args[xenv[i]] != null) { env.push({ name: 'mesh' + xenv[i], value: obj.args[xenv[i]] }); } } // Set some args as service environment variables. + for (i in xenv) { if (obj.args[xenv[i]] != null) { env.push({ name: 'mesh' + xenv[i], value: obj.args[xenv[i]] }); } } // Set some args as service environement variables. var serviceFilePath = null; if (obj.fs.existsSync(obj.path.join(servicepath, 'winservice.js'))) { serviceFilePath = obj.path.join(servicepath, 'winservice.js'); } @@ -583,11 +448,7 @@ function CreateMeshCentralServer(config, args) { // Launch MeshCentral as a child server and monitor it. obj.launchChildServer = function (startArgs) { const child_process = require('child_process'); - const isInspectorAttached = (()=> { try { return require('node:inspector').url() !== undefined; } catch (_) { return false; } }).call(); - const logFromChildProcess = isInspectorAttached ? () => {} : console.log.bind(console); try { if (process.traceDeprecation === true) { startArgs.unshift('--trace-deprecation'); } } catch (ex) { } - try { if (process.traceProcessWarnings === true) { startArgs.unshift('--trace-warnings'); } } catch (ex) { } - if (startArgs[0] != "--disable-proto=delete") startArgs.unshift("--disable-proto=delete") childProcess = child_process.execFile(process.argv[0], startArgs, { maxBuffer: Infinity, cwd: obj.parentpath }, function (error, stdout, stderr) { if (childProcess.xrestart == 1) { setTimeout(function () { obj.launchChildServer(startArgs); }, 500); // This is an expected restart. @@ -604,10 +465,9 @@ function CreateMeshCentralServer(config, args) { const npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : ''); const env = Object.assign({}, process.env); // Shallow clone if (typeof obj.args.npmproxy == 'string') { env['HTTP_PROXY'] = env['HTTPS_PROXY'] = env['http_proxy'] = env['https_proxy'] = obj.args.npmproxy; } - // always use --save-exact - https://stackoverflow.com/a/64507176/1210734 - const xxprocess = child_process.exec(npmpath + ' install --save-exact --no-audit meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) { + const xxprocess = child_process.exec(npmpath + ' install meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) { if ((error != null) && (error != '')) { console.log('Update failed: ' + error); } - }); + }); xxprocess.data = ''; xxprocess.stdout.on('data', function (data) { xxprocess.data += data; }); xxprocess.stderr.on('data', function (data) { xxprocess.data += data; }); @@ -659,12 +519,12 @@ function CreateMeshCentralServer(config, args) { else if (data.indexOf('Starting self upgrade to: ') >= 0) { obj.args.specificupdate = data.substring(26).split('\r')[0].split('\n')[0]; childProcess.xrestart = 3; } var datastr = data; while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); } - logFromChildProcess(datastr); + console.log(datastr); }); childProcess.stderr.on('data', function (data) { var datastr = data; while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); } - logFromChildProcess('ERR: ' + datastr); + console.log('ERR: ' + datastr); if (data.startsWith('le.challenges[tls-sni-01].loopback')) { return; } // Ignore this error output from GreenLock if (data[data.length - 1] == '\n') { data = data.substring(0, data.length - 1); } obj.logError(data); @@ -751,7 +611,7 @@ function CreateMeshCentralServer(config, args) { obj.performServerUpdate = function (version) { if (obj.serverSelfWriteAllowed != true) return false; if ((version == null) || (version == '') || (typeof version != 'string')) { console.log('Starting self upgrade...'); } else { console.log('Starting self upgrade to: ' + version); } - process.exit(200); + process.exit(200); return true; }; @@ -781,7 +641,7 @@ function CreateMeshCentralServer(config, args) { // Get new instance of the client const vault = require("node-vault")({ endpoint: obj.args.vault.endpoint, token: obj.args.vault.token }); vault.unseal({ key: obj.args.vault.unsealkey }) - .then(function () { + .then(function() { if (obj.args.vaultdeleteconfigfiles) { vault.delete('secret/data/' + obj.args.vault.name) .then(function (r) { console.log('Done.'); process.exit(); }) @@ -838,7 +698,7 @@ function CreateMeshCentralServer(config, args) { obj.args = args = config2.settings; // Lower case all keys in the config file - obj.common.objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders', 'telegram/proxy']); + obj.common.objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders']); // Grad some of the values from the original config.json file if present. if ((config.settings.vault != null) && (config2.settings != null)) { config2.settings.vault = config.settings.vault; } @@ -878,6 +738,7 @@ function CreateMeshCentralServer(config, args) { obj.syslogjson.log(obj.syslogjson.LOG_INFO, "MeshCentral v" + getCurrentVersion() + " Server Start"); } if (typeof config.settings.syslogauth == 'string') { + obj.authlog = true; obj.syslogauth = require('modern-syslog'); console.log('Starting ' + config.settings.syslogauth + ' auth syslog.'); obj.syslogauth.init(config.settings.syslogauth, obj.syslogauth.LOG_PID | obj.syslogauth.LOG_ODELAY, obj.syslogauth.LOG_LOCAL0); @@ -896,8 +757,8 @@ function CreateMeshCentralServer(config, args) { obj.syslogtcp.log("MeshCentral v" + getCurrentVersion() + " Server Start", obj.syslogtcp.LOG_INFO); } - // Check top level configuration for any unrecognized values - if (config) { for (var i in config) { if ((typeof i == 'string') && (i.length > 0) && (i[0] != '_') && (['settings', 'domaindefaults', 'domains', 'configfiles', 'smtp', 'letsencrypt', 'peers', 'sms', 'messaging', 'sendgrid', 'sendmail', 'firebase', 'firebaserelay', '$schema'].indexOf(i) == -1)) { addServerWarning('Unrecognized configuration option \"' + i + '\".', 3, [i]); } } } + // Check top level configuration for any unreconized values + if (config) { for (var i in config) { if ((typeof i == 'string') && (i.length > 0) && (i[0] != '_') && (['settings', 'domaindefaults', 'domains', 'configfiles', 'smtp', 'letsencrypt', 'peers', 'sms', 'sendgrid', 'sendmail', 'firebase', 'firebaserelay', '$schema'].indexOf(i) == -1)) { addServerWarning('Unrecognized configuration option \"' + i + '\".', 3, [ i ]); } } } // Read IP lists from files if applicable config.settings.userallowedip = obj.args.userallowedip = readIpListFromFile(obj.args.userallowedip); @@ -907,11 +768,11 @@ function CreateMeshCentralServer(config, args) { config.settings.swarmallowedip = obj.args.swarmallowedip = readIpListFromFile(obj.args.swarmallowedip); // Check IP lists and ranges - if (typeof obj.args.userallowedip == 'string') { if (obj.args.userallowedip == '') { config.settings.userallowedip = obj.args.userallowedip = null; } else { config.settings.userallowedip = obj.args.userallowedip = obj.args.userallowedip.split(' ').join('').split(','); } } - if (typeof obj.args.userblockedip == 'string') { if (obj.args.userblockedip == '') { config.settings.userblockedip = obj.args.userblockedip = null; } else { config.settings.userblockedip = obj.args.userblockedip = obj.args.userblockedip.split(' ').join('').split(','); } } - if (typeof obj.args.agentallowedip == 'string') { if (obj.args.agentallowedip == '') { config.settings.agentallowedip = obj.args.agentallowedip = null; } else { config.settings.agentallowedip = obj.args.agentallowedip = obj.args.agentallowedip.split(' ').join('').split(','); } } - if (typeof obj.args.agentblockedip == 'string') { if (obj.args.agentblockedip == '') { config.settings.agentblockedip = obj.args.agentblockedip = null; } else { config.settings.agentblockedip = obj.args.agentblockedip = obj.args.agentblockedip.split(' ').join('').split(','); } } - if (typeof obj.args.swarmallowedip == 'string') { if (obj.args.swarmallowedip == '') { obj.args.swarmallowedip = null; } else { obj.args.swarmallowedip = obj.args.swarmallowedip.split(' ').join('').split(','); } } + if (typeof obj.args.userallowedip == 'string') { if (obj.args.userallowedip == '') { config.settings.userallowedip = obj.args.userallowedip = null; } else { config.settings.userallowedip = obj.args.userallowedip = obj.args.userallowedip.split(','); } } + if (typeof obj.args.userblockedip == 'string') { if (obj.args.userblockedip == '') { config.settings.userblockedip = obj.args.userblockedip = null; } else { config.settings.userblockedip = obj.args.userblockedip = obj.args.userblockedip.split(','); } } + if (typeof obj.args.agentallowedip == 'string') { if (obj.args.agentallowedip == '') { config.settings.agentallowedip = obj.args.agentallowedip = null; } else { config.settings.agentallowedip = obj.args.agentallowedip = obj.args.agentallowedip.split(','); } } + if (typeof obj.args.agentblockedip == 'string') { if (obj.args.agentblockedip == '') { config.settings.agentblockedip = obj.args.agentblockedip = null; } else { config.settings.agentblockedip = obj.args.agentblockedip = obj.args.agentblockedip.split(','); } } + if (typeof obj.args.swarmallowedip == 'string') { if (obj.args.swarmallowedip == '') { obj.args.swarmallowedip = null; } else { obj.args.swarmallowedip = obj.args.swarmallowedip.split(','); } } if ((typeof obj.args.agentupdateblocksize == 'number') && (obj.args.agentupdateblocksize >= 1024) && (obj.args.agentupdateblocksize <= 65531)) { obj.agentUpdateBlockSize = obj.args.agentupdateblocksize; } if (typeof obj.args.trustedproxy == 'string') { obj.args.trustedproxy = obj.args.trustedproxy.split(' ').join('').split(','); } if (typeof obj.args.tlsoffload == 'string') { obj.args.tlsoffload = obj.args.tlsoffload.split(' ').join('').split(','); } @@ -980,7 +841,7 @@ function CreateMeshCentralServer(config, args) { if (hashpasssplit.length != 2) { console.log("Invalid hashed password."); process.exit(); return; } user.salt = hashpasssplit[0]; user.hash = hashpasssplit[1]; - obj.db.Set(user, function () { console.log("Done. This command will only work if MeshCentral is stopped."); process.exit(); return; }); + obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); } else { // Hash the password and create the account. require('./pass').hash(obj.args.pass, function (err, salt, hash, tag) { if (err) { console.log("Unable create account password: " + err); process.exit(); return; } user.salt = salt; user.hash = hash; obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); }, 0); @@ -989,7 +850,7 @@ function CreateMeshCentralServer(config, args) { return; } if (obj.args.resetaccount) { // Unlock a user account, set a new password and remove 2FA - if ((typeof obj.args.resetaccount != 'string') || (obj.args.resetaccount.indexOf(' ') >= 0)) { console.log("Usage: --resetaccount [userid] --domain (domain) --pass [password]."); process.exit(); return; } + if ((typeof obj.args.resetaccount != 'string') || ((obj.args.pass == null) && (obj.args.hashpass == null)) || (obj.args.pass == '') || (obj.args.hashpass == '') || (obj.args.resetaccount.indexOf(' ') >= 0)) { console.log("Usage: --resetaccount [userid] --domain (domain) --pass [password]."); process.exit(); return; } var userid = 'user/' + (obj.args.domain ? obj.args.domain : '') + '/' + obj.args.resetaccount.toLowerCase(); if (obj.args.resetaccount.startsWith('user/')) { userid = obj.args.resetaccount; } if (userid.split('/').length != 3) { console.log("Invalid userid."); process.exit(); return; } @@ -997,31 +858,17 @@ function CreateMeshCentralServer(config, args) { if (err != null) { console.log("Database error: " + err); process.exit(); return; } if ((docs == null) || (docs.length == 0)) { console.log("Unknown userid, usage: --resetaccount [userid] --domain (domain) --pass [password]."); process.exit(); return; } const user = docs[0]; if ((user.siteadmin) && (user.siteadmin != 0xFFFFFFFF) && (user.siteadmin & 32) != 0) { user.siteadmin -= 32; } // Unlock the account. - delete user.phone; delete user.otpekey; delete user.otpsecret; delete user.otpkeys; delete user.otphkeys; delete user.otpdev; delete user.otpsms; delete user.otpmsg; // Disable 2FA - delete user.msghandle; // Disable users 2fa messaging too - var config = getConfig(false); - if (config.domains[user.domain].auth || config.domains[user.domain].authstrategies) { - console.log('This users domain has external authentication methods enabled so the password will not be changed if you set one') + delete user.phone; delete user.otpekey; delete user.otpsecret; delete user.otpkeys; delete user.otphkeys; delete user.otpdev; delete user.otpsms; // Disable 2FA + if (obj.args.hashpass) { + // Reset an account using a pre-hashed password. Use --hashpassword to pre-hash a password. + var hashpasssplit = obj.args.hashpass.split(','); + if (hashpasssplit.length != 2) { console.log("Invalid hashed password."); process.exit(); return; } + user.salt = hashpasssplit[0]; + user.hash = hashpasssplit[1]; obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); } else { - if (obj.args.hashpass && (typeof obj.args.hashpass == 'string')) { - // Reset an account using a pre-hashed password. Use --hashpassword to pre-hash a password. - var hashpasssplit = obj.args.hashpass.split(','); - if (hashpasssplit.length != 2) { console.log("Invalid hashed password."); process.exit(); return; } - user.salt = hashpasssplit[0]; - user.hash = hashpasssplit[1]; - obj.db.Set(user, function () { console.log("Done. This command will only work if MeshCentral is stopped."); process.exit(); return; }); - } else if (obj.args.pass && (typeof obj.args.pass == 'string')) { - // Hash the password and reset the account. - require('./pass').hash(String(obj.args.pass), user.salt, function (err, hash, tag) { - if (err) { console.log("Unable to reset password: " + err); process.exit(); return; } - user.hash = hash; - obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); - }, 0); - } else { - console.log('Not setting a users password'); - obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); - } + // Hash the password and reset the account. + require('./pass').hash(String(obj.args.pass), user.salt, function (err, hash, tag) { if (err) { console.log("Unable to reset password: " + err); process.exit(); return; } user.hash = hash; obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); }, 0); } }); return; @@ -1035,7 +882,7 @@ function CreateMeshCentralServer(config, args) { if (err != null) { console.log("Database error: " + err); process.exit(); return; } if ((docs == null) || (docs.length == 0)) { console.log("Unknown userid, usage: --adminaccount [userid] --domain (domain)."); process.exit(); return; } docs[0].siteadmin = 0xFFFFFFFF; // Set user as site administrator - obj.db.Set(docs[0], function () { console.log("Done. This command will only work if MeshCentral is stopped."); process.exit(); return; }); + obj.db.Set(docs[0], function () { console.log("Done."); process.exit(); return; }); }); return; } @@ -1118,27 +965,7 @@ function CreateMeshCentralServer(config, args) { // Show a list of all configuration files in the database if (obj.args.dblistconfigfiles) { - obj.db.GetAllType('cfile', function (err, docs) { - if (err == null) { - if (docs.length == 0) { - console.log("No files found."); - } else { - for (var i in docs) { - if (typeof obj.args.dblistconfigfiles == 'string') { - const data = obj.db.decryptData(obj.args.dblistconfigfiles, docs[i].data); - if (data == null) { - console.log(docs[i]._id.split('/')[1] + ', ' + Buffer.from(docs[i].data, 'base64').length + ' encrypted bytes - Unable to decrypt.'); - } else { - console.log(docs[i]._id.split('/')[1] + ', ' + data.length + ' bytes, decoded correctly.'); - } - } else { - console.log(docs[i]._id.split('/')[1] + ', ' + Buffer.from(docs[i].data, 'base64').length + ' encrypted bytes.'); - } - } - } - } else { console.log('Unable to read from database.'); } process.exit(); - }); - return; + obj.db.GetAllType('cfile', function (err, docs) { if (err == null) { if (docs.length == 0) { console.log("No files found."); } else { for (var i in docs) { console.log(docs[i]._id.split('/')[1] + ', ' + Buffer.from(docs[i].data, 'base64').length + ' bytes.'); } } } else { console.log('Unable to read from database.'); } process.exit(); }); return; } // Display the content of a configuration file in the database @@ -1183,11 +1010,7 @@ function CreateMeshCentralServer(config, args) { const path = obj.path.join(obj.args.dbpushconfigfiles, files[i]), binary = Buffer.from(obj.fs.readFileSync(path, { encoding: 'binary' }), 'binary'); console.log('Pushing ' + file + ', ' + binary.length + ' bytes.'); lockCount++; - if (obj.args.oldencrypt) { - obj.db.setConfigFile(file, obj.db.oldEncryptData(obj.args.configkey, binary), function () { if ((--lockCount) == 0) { console.log('Done.'); process.exit(); } }); - } else { - obj.db.setConfigFile(file, obj.db.encryptData(obj.args.configkey, binary), function () { if ((--lockCount) == 0) { console.log('Done.'); process.exit(); } }); - } + obj.db.setConfigFile(file, obj.db.encryptData(obj.args.configkey, binary), function () { if ((--lockCount) == 0) { console.log('Done.'); process.exit(); } }); } } if (--lockCount == 0) { process.exit(); } @@ -1264,7 +1087,7 @@ function CreateMeshCentralServer(config, args) { for (var j in doc) { if (j.indexOf('.') >= 0) { console.log("Invalid field name (" + j + ") in document: " + json[i]); return; } } //if ((json[i].type == 'ifinfo') && (json[i].netif2 != null)) { for (var j in json[i].netif2) { var esc = obj.common.escapeFieldName(j); if (esc !== j) { json[i].netif2[esc] = json[i].netif2[j]; delete json[i].netif2[j]; } } } //if ((json[i].type == 'mesh') && (json[i].links != null)) { for (var j in json[i].links) { var esc = obj.common.escapeFieldName(j); if (esc !== j) { json[i].links[esc] = json[i].links[j]; delete json[i].links[j]; } } } - } + } //for (i in json) { if ((json[i].type == "node") && (json[i].host != null)) { json[i].rname = json[i].host; delete json[i].host; } } // DEBUG: Change host to rname setTimeout(function () { // If the Mongo database is being created for the first time, there is a race condition here. This will get around it. obj.db.RemoveAll(function () { @@ -1351,7 +1174,7 @@ function CreateMeshCentralServer(config, args) { } // Check if the database is capable of performing a backup - // Moved behind autobackup config init in startex4: obj.db.checkBackupCapability(function (err, msg) { if (msg != null) { obj.addServerWarning(msg, true) } }); + obj.db.checkBackupCapability(function (err, msg) { if (msg != null) { obj.addServerWarning(msg, true) } }); // Load configuration for database if needed if (obj.args.loadconfigfromdb) { @@ -1362,29 +1185,25 @@ function CreateMeshCentralServer(config, args) { obj.db.getAllConfigFiles(key, function (configFiles) { if (configFiles == null) { console.log("Error, no configuration files found or invalid configkey."); process.exit(); return; } if (!configFiles['config.json']) { console.log("Error, could not file config.json from database."); process.exit(); return; } - if (typeof configFiles['config.json'] == 'object') { configFiles['config.json'] = configFiles['config.json'].toString(); } - if (configFiles['config.json'].charCodeAt(0) == 65279) { configFiles['config.json'] = configFiles['config.json'].substring(1); } obj.configurationFiles = configFiles; // Parse the new configuration file var config2 = null; - try { config2 = JSON.parse(configFiles['config.json']); } catch (ex) { console.log('Error, unable to parse config.json from database.', ex); process.exit(); return; } + try { config2 = JSON.parse(configFiles['config.json']); } catch (ex) { console.log('Error, unable to parse config.json from database.'); process.exit(); return; } // Set the command line arguments to the config file if they are not present if (!config2.settings) { config2.settings = {}; } for (i in args) { config2.settings[i] = args[i]; } // Lower case all keys in the config file - common.objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders', 'telegram/proxy']); + common.objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders']); - // Grab some of the values from the original config.json file if present. + // Grad some of the values from the original config.json file if present. config2['mysql'] = config['mysql']; config2['mariadb'] = config['mariadb']; config2['mongodb'] = config['mongodb']; config2['mongodbcol'] = config['mongodbcol']; config2['dbencryptkey'] = config['dbencryptkey']; - config2['acebase'] = config['acebase']; - config2['sqlite3'] = config['sqlite3']; // We got a new config.json from the database, let's use it. config = obj.config = config2; @@ -1400,25 +1219,19 @@ function CreateMeshCentralServer(config, args) { }; // Time to start the server of real. - obj.StartEx1b = async function () { + obj.StartEx1b = function () { var i; - // Add NodeJS version warning if needed - if (Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 16) { addServerWarning("MeshCentral will require Node v16 or above in the future, your current version is " + process.version + "."); } - // Setup certificate operations obj.certificateOperations = require('./certoperations.js').CertificateOperations(obj); // Linux format /var/log/auth.log if (obj.config.settings.authlog != null) { obj.fs.open(obj.config.settings.authlog, 'a', function (err, fd) { - if (err == null) { obj.authlogfile = fd; } else { console.log('ERROR: Unable to open: ' + obj.config.settings.authlog); } + if (err == null) { obj.authlogfile = fd; obj.authlog = true; } else { console.log('ERROR: Unable to open: ' + obj.config.settings.authlog); } }) } - // Start CrowdSec bouncer if needed: https://www.crowdsec.net/ - if (typeof obj.args.crowdsec == 'object') { obj.crowdSecBounser = require('./crowdsec.js').CreateCrowdSecBouncer(obj, obj.args.crowdsec); } - // Check if self update is allowed. If running as a Windows service, self-update is not possible. if (obj.fs.existsSync(obj.path.join(__dirname, 'daemon'))) { obj.serverSelfWriteAllowed = false; } @@ -1459,21 +1272,15 @@ function CreateMeshCentralServer(config, args) { if (obj.config.domains[i].limits == null) { obj.config.domains[i].limits = {}; } if (obj.config.domains[i].dns == null) { obj.config.domains[i].url = (i == '') ? '/' : ('/' + i + '/'); } else { obj.config.domains[i].url = '/'; } obj.config.domains[i].id = i; - if ((typeof obj.config.domains[i].maxdeviceview != 'number') || (obj.config.domains[i].maxdeviceview < 1)) { delete obj.config.domains[i].maxdeviceview; } if (typeof obj.config.domains[i].loginkey == 'string') { obj.config.domains[i].loginkey = [obj.config.domains[i].loginkey]; } if ((obj.config.domains[i].loginkey != null) && (obj.common.validateAlphaNumericArray(obj.config.domains[i].loginkey, 1, 128) == false)) { console.log("ERROR: Invalid login key, must be alpha-numeric string with no spaces."); process.exit(); return; } if (typeof obj.config.domains[i].agentkey == 'string') { obj.config.domains[i].agentkey = [obj.config.domains[i].agentkey]; } if ((obj.config.domains[i].agentkey != null) && (obj.common.validateAlphaNumericArray(obj.config.domains[i].agentkey, 1, 128) == false)) { console.log("ERROR: Invalid agent key, must be alpha-numeric string with no spaces."); process.exit(); return; } - obj.config.domains[i].userallowedip = obj.config.domains[i].userallowedip = readIpListFromFile(obj.config.domains[i].userallowedip); - obj.config.domains[i].userblockedip = obj.config.domains[i].userblockedip = readIpListFromFile(obj.config.domains[i].userblockedip); - obj.config.domains[i].agentallowedip = obj.config.domains[i].agentallowedip = readIpListFromFile(obj.config.domains[i].agentallowedip); - obj.config.domains[i].agentblockedip = obj.config.domains[i].agentblockedip = readIpListFromFile(obj.config.domains[i].agentblockedip); - if (typeof obj.config.domains[i].userallowedip == 'string') { if (obj.config.domains[i].userallowedip == '') { delete obj.config.domains[i].userallowedip; } else { obj.config.domains[i].userallowedip = obj.config.domains[i].userallowedip.split(' ').join('').split(','); } } - if (typeof obj.config.domains[i].userblockedip == 'string') { if (obj.config.domains[i].userblockedip == '') { delete obj.config.domains[i].userblockedip; } else { obj.config.domains[i].userblockedip = obj.config.domains[i].userblockedip.split(' ').join('').split(','); } } - if (typeof obj.config.domains[i].agentallowedip == 'string') { if (obj.config.domains[i].agentallowedip == '') { delete obj.config.domains[i].agentallowedip; } else { obj.config.domains[i].agentallowedip = obj.config.domains[i].agentallowedip.split(' ').join('').split(','); } } - if (typeof obj.config.domains[i].agentblockedip == 'string') { if (obj.config.domains[i].agentblockedip == '') { delete obj.config.domains[i].agentblockedip; } else { obj.config.domains[i].agentblockedip = obj.config.domains[i].agentblockedip.split(' ').join('').split(','); } } + if (typeof obj.config.domains[i].userallowedip == 'string') { if (obj.config.domains[i].userallowedip == '') { delete obj.config.domains[i].userallowedip; } else { obj.config.domains[i].userallowedip = obj.config.domains[i].userallowedip.split(','); } } + if (typeof obj.config.domains[i].userblockedip == 'string') { if (obj.config.domains[i].userblockedip == '') { delete obj.config.domains[i].userblockedip; } else { obj.config.domains[i].userblockedip = obj.config.domains[i].userblockedip.split(','); } } + if (typeof obj.config.domains[i].agentallowedip == 'string') { if (obj.config.domains[i].agentallowedip == '') { delete obj.config.domains[i].agentallowedip; } else { obj.config.domains[i].agentallowedip = obj.config.domains[i].agentallowedip.split(','); } } + if (typeof obj.config.domains[i].agentblockedip == 'string') { if (obj.config.domains[i].agentblockedip == '') { delete obj.config.domains[i].agentblockedip; } else { obj.config.domains[i].agentblockedip = obj.config.domains[i].agentblockedip.split(','); } } if (typeof obj.config.domains[i].ignoreagenthashcheck == 'string') { if (obj.config.domains[i].ignoreagenthashcheck == '') { delete obj.config.domains[i].ignoreagenthashcheck; } else { obj.config.domains[i].ignoreagenthashcheck = obj.config.domains[i].ignoreagenthashcheck.split(','); } } - if (typeof obj.config.domains[i].allowedorigin == 'string') { if (obj.config.domains[i].allowedorigin == '') { delete obj.config.domains[i].allowedorigin; } else { obj.config.domains[i].allowedorigin = obj.config.domains[i].allowedorigin.split(','); } } if ((obj.config.domains[i].passwordrequirements != null) && (typeof obj.config.domains[i].passwordrequirements == 'object')) { if (typeof obj.config.domains[i].passwordrequirements.skip2factor == 'string') { obj.config.domains[i].passwordrequirements.skip2factor = obj.config.domains[i].passwordrequirements.skip2factor.split(','); @@ -1547,50 +1354,11 @@ function CreateMeshCentralServer(config, args) { if (i == '') { addServerWarning("Unable to load Intel AMT TLS root certificate for default domain.", 5); } else { - addServerWarning("Unable to load Intel AMT TLS root certificate for domain " + i + ".", 6, [i]); + addServerWarning("Unable to load Intel AMT TLS root certificate for domain " + i + ".", 6, [ i ]); } } } } - - // Check agentfileinfo - if (typeof obj.config.domains[i].agentfileinfo == 'object') { - if ((obj.config.domains[i].agentfileinfo.fileversionnumber != null) && (obj.common.parseVersion(obj.config.domains[i].agentfileinfo.fileversionnumber) == null)) { delete obj.config.domains[i].agentfileinfo.fileversionnumber; } - if ((obj.config.domains[i].agentfileinfo.productversionnumber != null) && (obj.common.parseVersion(obj.config.domains[i].agentfileinfo.productversionnumber) == null)) { delete obj.config.domains[i].agentfileinfo.productversionnumber; } - if ((obj.config.domains[i].agentfileinfo.fileversionnumber == null) && (typeof obj.config.domains[i].agentfileinfo.fileversion == 'string') && (obj.common.parseVersion(obj.config.domains[i].agentfileinfo.fileversion) != null)) { obj.config.domains[i].agentfileinfo.fileversionnumber = obj.config.domains[i].agentfileinfo.fileversion; } - if (typeof obj.config.domains[i].agentfileinfo.icon == 'string') { - // Load the agent .ico file - var icon = null; - try { icon = require('./authenticode.js').loadIcon(obj.path.join(obj.datapath, obj.config.domains[i].agentfileinfo.icon)); } catch (ex) { } - if (icon != null) { - // The icon file was correctly loaded - obj.config.domains[i].agentfileinfo.icon = icon; - } else { - // Failed to load the icon file, display a server warning - addServerWarning("Unable to load agent icon file: " + obj.config.domains[i].agentfileinfo.icon + ".", 23, [obj.config.domains[i].agentfileinfo.icon]); - delete obj.config.domains[i].agentfileinfo.icon; - } - } else { - // Invalid icon file path - delete obj.config.domains[i].agentfileinfo.icon; - } - if (typeof obj.config.domains[i].agentfileinfo.logo == 'string') { - // Load the agent .bmp file - var logo = null; - try { logo = require('./authenticode.js').loadBitmap(obj.path.join(obj.datapath, obj.config.domains[i].agentfileinfo.logo)); } catch (ex) { } - if (logo != null) { - // The logo file was correctly loaded - obj.config.domains[i].agentfileinfo.logo = logo; - } else { - // Failed to load the icon file, display a server warning - addServerWarning("Unable to load agent logo file: " + obj.config.domains[i].agentfileinfo.logo + ".", 24, [obj.config.domains[i].agentfileinfo.logo]); - delete obj.config.domains[i].agentfileinfo.logo; - } - } else { - // Invalid icon file path - delete obj.config.domains[i].agentfileinfo.logo; - } - } } // Log passed arguments into Windows Service Log @@ -1607,19 +1375,9 @@ function CreateMeshCentralServer(config, args) { if (obj.args.mpsaliasport != null && (typeof obj.args.mpsaliasport != 'number')) obj.args.mpsaliasport = null; if (obj.args.rediraliasport != null && (typeof obj.args.rediraliasport != 'number')) obj.args.rediraliasport = null; if (obj.args.redirport == null) obj.args.redirport = 80; - if (obj.args.minifycore == null) obj.args.minifycore = false; - if (typeof obj.args.agentidletimeout != 'number') { obj.args.agentidletimeout = 150000; } else { obj.args.agentidletimeout *= 1000 } // Default agent idle timeout is 2m, 30sec. - if ((obj.args.lanonly != true) && (typeof obj.args.webrtconfig == 'object')) { // fix incase you are using an old mis-spelt webrtconfig - obj.args.webrtcconfig = obj.args.webrtconfig; - delete obj.args.webrtconfig; - } - if ((obj.args.lanonly != true) && (obj.args.webrtcconfig == null)) { obj.args.webrtcconfig = { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }, { urls: 'stun:stun.cloudflare.com:3478' }] }; } // Setup default WebRTC STUN servers - else if ((obj.args.lanonly != true) && (typeof obj.args.webrtcconfig == 'object')) { - if (obj.args.webrtcconfig.iceservers) { // webrtc is case-sensitive, so must rename iceservers to iceServers! - obj.args.webrtcconfig.iceServers = obj.args.webrtcconfig.iceservers; - delete obj.args.webrtcconfig.iceservers; - } - } + if (obj.args.minifycore === 0) obj.args.minifycore = false; + if (typeof args.agentidletimeout != 'number') { args.agentidletimeout = 150000; } else { args.agentidletimeout *= 1000 } // Default agent idle timeout is 2m, 30sec. + if ((obj.args.lanonly != true) && (obj.args.webrtconfig == null)) { obj.args.webrtconfig = { iceservers: [{ urls: 'stun:stun.l.google.com:19302' }, { urls: 'stun:stun.services.mozilla.com' }] }; } // Setup default WebRTC STUN servers if (typeof obj.args.ignoreagenthashcheck == 'string') { if (obj.args.ignoreagenthashcheck == '') { delete obj.args.ignoreagenthashcheck; } else { obj.args.ignoreagenthashcheck = obj.args.ignoreagenthashcheck.split(','); } } // Setup a site administrator @@ -1659,7 +1417,7 @@ function CreateMeshCentralServer(config, args) { } // Setup agent error log - if ((obj.config) && (obj.config.settings) && (obj.config.settings.agentlogdump)) { + if ((obj.config) && (obj.config.settings) && (obj.config.settings.agentlogdump != null)) { obj.fs.open(obj.path.join(obj.datapath, 'agenterrorlogs.txt'), 'a', function (err, fd) { obj.agentErrorLog = fd; }) } @@ -1695,11 +1453,6 @@ function CreateMeshCentralServer(config, args) { return; } - // Setup the task manager - if ((obj.config) && (obj.config.settings) && (obj.config.settings.taskmanager == true)) { - obj.taskManager = require('./taskmanager').createTaskManager(obj); - } - // Start plugin manager if configuration allows this. if ((obj.config) && (obj.config.settings) && (obj.config.settings.plugins != null) && (obj.config.settings.plugins != false) && ((typeof obj.config.settings.plugins != 'object') || (obj.config.settings.plugins.enabled != false))) { obj.pluginHandler = require('./pluginHandler.js').pluginHandler(obj); @@ -1893,12 +1646,8 @@ function CreateMeshCentralServer(config, args) { obj.webserver = require('./webserver.js').CreateWebServer(obj, obj.db, obj.args, obj.certificates, obj.StartEx5); if (obj.redirserver != null) { obj.redirserver.hookMainWebServer(obj.certificates); } - // Change RelayDNS to a array of strings - if (typeof obj.args.relaydns == 'string') { obj.args.relaydns = [obj.args.relaydns]; } - if (obj.common.validateStrArray(obj.args.relaydns, 1) == false) { delete obj.args.relaydns; } - // Start the HTTP relay web server if needed - if ((obj.args.relaydns == null) && (typeof obj.args.relayport == 'number') && (obj.args.relayport != 0)) { + if ((obj.args.relayport != null) && (obj.args.relayport != 0)) { obj.webrelayserver = require('./webrelayserver.js').CreateWebRelayServer(obj, obj.db, obj.args, obj.certificates, function () { }); } @@ -1974,11 +1723,6 @@ function CreateMeshCentralServer(config, args) { if ((obj.smsserver != null) && (obj.args.lanonly == true)) { addServerWarning("SMS gateway has limited use in LAN mode.", 19); } } - // Setup user messaging - if (config.messaging != null) { - obj.msgserver = require('./meshmessaging.js').CreateServer(obj); - } - // Setup web based push notifications if ((typeof config.settings.webpush == 'object') && (typeof config.settings.webpush.email == 'string')) { obj.webpush = require('web-push'); @@ -1987,7 +1731,6 @@ function CreateMeshCentralServer(config, args) { if ((vapidKeys == null) || (typeof vapidKeys.publicKey != 'string') || (typeof vapidKeys.privateKey != 'string')) { console.log("Generating web push VAPID keys..."); vapidKeys = obj.webpush.generateVAPIDKeys(); - obj.common.moveOldFiles([obj.path.join(obj.datapath, 'vapid.json')]); obj.fs.writeFileSync(obj.path.join(obj.datapath, 'vapid.json'), JSON.stringify(vapidKeys)); } obj.webpush.vapidPublicKey = vapidKeys.publicKey; @@ -1995,31 +1738,19 @@ function CreateMeshCentralServer(config, args) { if (typeof config.settings.webpush.gcmapi == 'string') { webpush.setGCMAPIKey(config.settings.webpush.gcmapi); } } - // Get the current node version - const verSplit = process.version.substring(1).split('.'); - var nodeVersion = parseInt(verSplit[0]) + (parseInt(verSplit[1]) / 100); - // Setup Firebase if ((config.firebase != null) && (typeof config.firebase.senderid == 'string') && (typeof config.firebase.serverkey == 'string')) { - addServerWarning('Firebase now requires a service account JSON file, Firebase disabled.', 27); - } else if ((config.firebase != null) && (typeof config.firebase.serviceaccountfile == 'string')) { - var serviceAccount; - try { serviceAccount = JSON.parse(obj.fs.readFileSync(obj.path.join(obj.datapath, config.firebase.serviceaccountfile)).toString()); } catch (ex) { console.log(ex); } - if (serviceAccount != null) { obj.firebase = require('./firebase').CreateFirebase(obj, serviceAccount); } + obj.firebase = require('./firebase').CreateFirebase(obj, config.firebase.senderid, config.firebase.serverkey); } else if ((typeof config.firebaserelay == 'object') && (typeof config.firebaserelay.url == 'string')) { // Setup the push messaging relay obj.firebase = require('./firebase').CreateFirebaseRelay(obj, config.firebaserelay.url, config.firebaserelay.key); } else if (obj.config.settings.publicpushnotifications === true) { - // Setup the Firebase push messaging relay using https://alt.meshcentral.com, this is the public push notification server. - obj.firebase = require('./firebase').CreateFirebaseRelay(obj, 'https://alt.meshcentral.com/firebaserelay.aspx'); + // Setup the Firebase push messaging relay using https://meshcentral.com, this is the public push notification server. + obj.firebase = require('./firebase').CreateFirebaseRelay(obj, 'https://meshcentral.com/firebaserelay.aspx'); } - // Setup monitoring - obj.monitoring = require('./monitoring.js').CreateMonitoring(obj, obj.args); - // Start periodic maintenance obj.maintenanceTimer = setInterval(obj.maintenanceActions, 1000 * 60 * 60); // Run this every hour - //obj.maintenanceTimer = setInterval(obj.maintenanceActions, 1000 * 10 * 1); // DEBUG: Run this more often // Dispatch an event that the server is now running obj.DispatchEvent(['*'], obj, { etype: 'server', action: 'started', msg: 'Server started' }); @@ -2104,24 +1835,14 @@ function CreateMeshCentralServer(config, args) { obj.updateServerState('state', "running"); // Setup auto-backup defaults - if (obj.config.settings.autobackup == false || obj.config.settings.autobackup == 'false') { obj.config.settings.autobackup = {backupintervalhours: 0}; } //no schedule, but able to console autobackup - else { - if (obj.config.settings.autobackup == null || obj.config.settings.autobackup === true) { obj.config.settings.autobackup = {backupintervalhours: 24, keeplastdaysbackup: 10}; }; - if (typeof obj.config.settings.autobackup.backupintervalhours != 'number') { obj.config.settings.autobackup.backupintervalhours = 24; }; - if (typeof obj.config.settings.autobackup.keeplastdaysbackup != 'number') { obj.config.settings.autobackup.keeplastdaysbackup = 10; }; - if (obj.config.settings.autobackup.backuphour != null ) { obj.config.settings.autobackup.backupintervalhours = 24; if ((typeof obj.config.settings.autobackup.backuphour != 'number') || (obj.config.settings.autobackup.backuphour > 23 || obj.config.settings.autobackup.backuphour < 0 )) { obj.config.settings.autobackup.backuphour = 0; }} - else {obj.config.settings.autobackup.backuphour = -1 }; - //arrayfi in case of string and remove possible ', ' space. !! If a string instead of an array is passed, it will be split by ',' so *{.txt,.log} won't work in that case !! - if (!obj.config.settings.autobackup.backupignorefilesglob) {obj.config.settings.autobackup.backupignorefilesglob = []} - else if (typeof obj.config.settings.autobackup.backupignorefilesglob == 'string') { obj.config.settings.autobackup.backupignorefilesglob = obj.config.settings.autobackup.backupignorefilesglob.replaceAll(', ', ',').split(','); }; - if (!obj.config.settings.autobackup.backupskipfoldersglob) {obj.config.settings.autobackup.backupskipfoldersglob = []} - else if (typeof obj.config.settings.autobackup.backupskipfoldersglob == 'string') { obj.config.settings.autobackup.backupskipfoldersglob = obj.config.settings.autobackup.backupskipfoldersglob.replaceAll(', ', ',').split(','); }; - if (typeof obj.config.settings.autobackup.backuppath == 'string') { obj.backuppath = (obj.config.settings.autobackup.backuppath = (obj.path.resolve(obj.config.settings.autobackup.backuppath))) } else { obj.config.settings.autobackup.backuppath = obj.backuppath }; - if (typeof obj.config.settings.autobackup.backupname != 'string') { obj.config.settings.autobackup.backupname = 'meshcentral-autobackup-'}; - } + if (obj.config.settings.autobackup == null) { obj.config.settings.autobackup = { backupintervalhours: 24, keeplastdaysbackup: 10 }; } + else if (obj.config.settings.autobackup === false) { delete obj.config.settings.autobackup; } - // Check if the database is capable of performing a backup - obj.db.checkBackupCapability(function (err, msg) { if (msg != null) { obj.addServerWarning(msg, true) } }); + // Check that autobackup path is not within the "meshcentral-data" folder. + if ((typeof obj.config.settings.autobackup == 'object') && (typeof obj.config.settings.autobackup.backuppath == 'string') && (obj.path.normalize(obj.config.settings.autobackup.backuppath).startsWith(obj.path.normalize(obj.datapath)))) { + addServerWarning("Backup path can't be set within meshcentral-data folder, backup settings ignored.", 21); + delete obj.config.settings.autobackup; + } // Load Intel AMT passwords from the "amtactivation.log" file obj.loadAmtActivationLogPasswords(function (amtPasswords) { @@ -2283,19 +2004,14 @@ function CreateMeshCentralServer(config, args) { // Check if we need to perform an automatic backup function checkAutobackup() { - if (obj.config.settings.autobackup.backupintervalhours >= 1 ) { + if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupintervalhours == 'number')) { obj.db.Get('LastAutoBackupTime', function (err, docs) { - if (err != null) { console.error("checkAutobackup: Error getting LastBackupTime from DB"); return} + if (err != null) return; var lastBackup = 0; - const currentdate = new Date(); - let currentHour = currentdate.getHours(); - let now = currentdate.getTime(); + const now = new Date().getTime(); if (docs.length == 1) { lastBackup = docs[0].value; } const delta = now - lastBackup; - //const delta = 9999999999; // DEBUG: backup always - obj.debug ('backup', 'Entering checkAutobackup, lastAutoBackupTime: ' + new Date(lastBackup).toLocaleString('default', { dateStyle: 'medium', timeStyle: 'short' }) + ', delta: ' + (delta/(1000*60*60)).toFixed(2) + ' hours'); - //start autobackup if interval has passed or at configured hour, whichever comes first. When an hour schedule is missed, it will make a backup immediately. - if ((delta > (obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000)) || ((currentHour == obj.config.settings.autobackup.backuphour) && (delta >= 2 * 60 * 60 * 1000))) { + if (delta > (obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000)) { // A new auto-backup is required. obj.db.Set({ _id: 'LastAutoBackupTime', value: now }); // Save the current time in the database obj.db.performBackup(); // Perform the backup @@ -2354,7 +2070,7 @@ function CreateMeshCentralServer(config, args) { // Update the server state obj.updateServerState('state', "stopped"); }; - + // Event Dispatch obj.AddEventDispatch = function (ids, target) { obj.debug('dispatch', 'AddEventDispatch', ids); @@ -2417,10 +2133,6 @@ function CreateMeshCentralServer(config, args) { storeEvent.links = Object.assign({}, storeEvent.links); for (var i in storeEvent.links) { var ue = obj.common.escapeFieldName(i); if (ue !== i) { storeEvent.links[ue] = storeEvent.links[i]; delete storeEvent.links[i]; } } } - if (storeEvent.mesh) { - // Escape "mesh" names that may have "." and/or "$" - storeEvent.mesh = obj.common.escapeLinksFieldNameEx(storeEvent.mesh); - } storeEvent.ids = ids; obj.db.StoreEvent(storeEvent); } @@ -2511,7 +2223,7 @@ function CreateMeshCentralServer(config, args) { // Event any changes on this server only if ((newConnectivity != oldPowerState) || (newPowerState != oldPowerState)) { - obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: newConnectivity, pwr: newPowerState, nolog: 1, nopeers: 1, id: Math.random() }); + obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: newConnectivity, pwr: newPowerState, nolog: 1, nopeers: 1 }); } } }; @@ -2524,7 +2236,7 @@ function CreateMeshCentralServer(config, args) { const domainId = meshSplit[1]; if (obj.config.domains[domainId] == null) return; const mailserver = obj.config.domains[domainId].mailserver; - if ((mailserver == null) && (obj.msgserver == null)) return; + if (mailserver == null) return; // Get the device group for this device const mesh = obj.webserver.meshes[meshid]; @@ -2544,7 +2256,7 @@ function CreateMeshCentralServer(config, args) { // Check if any user needs email notification for (var i in users) { const user = obj.webserver.users[users[i]]; - if (user != null) { + if ((user != null) && (user.email != null) && (user.emailVerified == true)) { var notify = 0; // Device group notifications @@ -2557,8 +2269,7 @@ function CreateMeshCentralServer(config, args) { if (user.notify[nodeid] != null) { notify |= user.notify[nodeid]; } } - // Email notifications - if ((user.email != null) && (user.emailVerified == true) && (mailserver != null) && ((notify & 48) != 0)) { + if ((notify & 48) != 0) { if (stateSet == true) { if ((notify & 16) != 0) { mailserver.notifyDeviceConnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo); @@ -2574,76 +2285,6 @@ function CreateMeshCentralServer(config, args) { } } } - - // Messaging notifications - if ((obj.msgserver != null) && ((notify & 384) != 0)) { - if (stateSet == true) { - if ((notify & 128) != 0) { - obj.msgserver.notifyDeviceConnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo); - } else { - obj.msgserver.cancelNotifyDeviceDisconnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo); - } - } - else if (stateSet == false) { - if ((notify & 256) != 0) { - obj.msgserver.notifyDeviceDisconnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo); - } else { - obj.msgserver.cancelNotifyDeviceConnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo); - } - } - } - } - } - } - - // See if we need to notifiy any user of device requested help - //if (typeof device.name == 'string') { parent.parent.NotifyUserOfDeviceHelpRequest(domain, device._id, device.meshid, device.name, command.msgArgs[0], command.msgArgs[1]); } - - obj.NotifyUserOfDeviceHelpRequest = function (domain, meshid, nodeid, devicename, helpusername, helprequest) { - // Check if there is a email server for this domain - const meshSplit = meshid.split('/'); - if (meshSplit.length != 3) return; - const domainId = meshSplit[1]; - if (obj.config.domains[domainId] == null) return; - const mailserver = obj.config.domains[domainId].mailserver; - if ((mailserver == null) && (obj.msgserver == null)) return; - - // Get the device group for this device - const mesh = obj.webserver.meshes[meshid]; - if ((mesh == null) || (mesh.links == null)) return; - - // Get the list of users that have visibility to this device - // This includes users that are part of user groups - const users = []; - for (var i in mesh.links) { - if (i.startsWith('user/') && (users.indexOf(i) < 0)) { users.push(i); } - if (i.startsWith('ugrp/')) { - var usergrp = obj.webserver.userGroups[i]; - if (usergrp.links != null) { for (var j in usergrp.links) { if (j.startsWith('user/') && (users.indexOf(j) < 0)) { users.push(j); } } } - } - } - - // Check if any user needs email notification - for (var i in users) { - const user = obj.webserver.users[users[i]]; - if (user != null) { - var notify = 0; - - // Device group notifications - const meshLinks = user.links[meshid]; - if ((meshLinks != null) && (meshLinks.notify != null)) { notify |= meshLinks.notify; } - - // User notifications - if (user.notify != null) { - if (user.notify[meshid] != null) { notify |= user.notify[meshid]; } - if (user.notify[nodeid] != null) { notify |= user.notify[nodeid]; } - } - - // Mail help request - if ((user.email != null) && (user.emailVerified == true) && ((notify & 64) != 0)) { mailserver.sendDeviceHelpMail(domain, user.name, user.email, devicename, nodeid, helpusername, helprequest, user.llang); } - - // Message help request - if ((user.msghandle != null) && ((notify & 512) != 0)) { obj.msgserver.sendDeviceHelpRequest(domain, user.name, user.msghandle, devicename, nodeid, helpusername, helprequest, user.llang); } } } } @@ -2680,7 +2321,7 @@ function CreateMeshCentralServer(config, args) { if (connectType == 1) { state.agentPower = powerState; } else if (connectType == 2) { state.ciraPower = powerState; } else if (connectType == 4) { state.amtPower = powerState; } var powerState = 0, oldPowerState = state.powerState; if ((state.connectivity & 1) != 0) { powerState = state.agentPower; } else if ((state.connectivity & 2) != 0) { powerState = state.ciraPower; } else if ((state.connectivity & 4) != 0) { powerState = state.amtPower; } - if ((state.powerState == null) || (state.powerState == undefined) || (state.powerState != powerState)) { + if ((state.powerState == null) || (state.powerState != powerState)) { state.powerState = powerState; eventConnectChange = 1; @@ -2692,7 +2333,7 @@ function CreateMeshCentralServer(config, args) { // Event the node connection change if (eventConnectChange == 1) { - obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, ct: connectTime, nolog: 1, nopeers: 1, id: Math.random() }); + obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, ct: connectTime, nolog: 1, nopeers: 1 }); // Save indication of node connection change const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], meshid: meshid, time: Date.now(), cause: 1, connectType: connectType }; @@ -2709,7 +2350,7 @@ function CreateMeshCentralServer(config, args) { if (serverid == null) { serverid = obj.serverId; } if (obj.peerConnectivityByNode[serverid] == null) return; // Guard against unknown serverid's var eventConnectChange = 0; - var state = obj.peerConnectivityByNode[serverid][nodeid]; + const state = obj.peerConnectivityByNode[serverid][nodeid]; if (state) { // Change the connection in the node and mesh state lists if ((state.connectivity & connectType) == 0) { state.connectivity |= connectType; eventConnectChange = 1; } @@ -2724,7 +2365,7 @@ function CreateMeshCentralServer(config, args) { if (connectType == 1) { state.agentPower = powerState; } else if (connectType == 2) { state.ciraPower = powerState; } else if (connectType == 4) { state.amtPower = powerState; } var powerState = 0, oldPowerState = state.powerState; if ((state.connectivity & 1) != 0) { powerState = state.agentPower; } else if ((state.connectivity & 2) != 0) { powerState = state.ciraPower; } else if ((state.connectivity & 4) != 0) { powerState = state.amtPower; } - if ((state.powerState == null) || (state.powerState == undefined) || (state.powerState != powerState)) { + if ((state.powerState == null) || (state.powerState != powerState)) { state.powerState = powerState; eventConnectChange = 1; @@ -2796,7 +2437,7 @@ function CreateMeshCentralServer(config, args) { // Event the node connection change if (eventConnectChange == 1) { - obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, nolog: 1, nopeers: 1, id: Math.random() }); + obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, nolog: 1, nopeers: 1 }); // Notify any users of device disconnection obj.NotifyUserOfDeviceStateChange(meshid, nodeid, Date.now(), connectType, -1, serverid, false, extraInfo); @@ -2807,7 +2448,7 @@ function CreateMeshCentralServer(config, args) { // Remove the agent connection from the nodes connection list if (serverid == null) { serverid = obj.serverId; } if (obj.peerConnectivityByNode[serverid] == null) return; // Guard against unknown serverid's - var state = obj.peerConnectivityByNode[serverid][nodeid]; + const state = obj.peerConnectivityByNode[serverid][nodeid]; if (state == null) return; // If existing state exist, remove this connection @@ -2866,7 +2507,7 @@ function CreateMeshCentralServer(config, args) { if (obj.fs.existsSync(obj.path.join(meshcorePath, 'meshcore.js')) == false) { meshcorePath = obj.path.join(__dirname, 'agents'); if (obj.fs.existsSync(obj.path.join(meshcorePath, 'meshcore.js')) == false) { - obj.defaultMeshCores = obj.defaultMeshCoresHash = {}; if (func != null) { func(false); } // meshcore.js not found + obj.defaultMeshCores = obj.defaultMeshCoresHash = { }; if (func != null) { func(false); } // meshcore.js not found } } @@ -2932,7 +2573,7 @@ function CreateMeshCentralServer(config, args) { // We are adding a JS file to the meshcores var moduleName = modulesDir[i].substring(0, modulesDir[i].length - 3); if (moduleName.endsWith('.min')) { moduleName = moduleName.substring(0, moduleName.length - 4); } // Remove the ".min" for ".min.js" files. - const moduleData = ['try { addModule("', moduleName, '", "', obj.escapeCodeString(obj.fs.readFileSync(obj.path.join(moduleDirPath, modulesDir[i])).toString('binary')), '"); addedModules.push("', moduleName, '"); } catch (ex) { }\r\n']; + const moduleData = [ 'try { addModule("', moduleName, '", "', obj.escapeCodeString(obj.fs.readFileSync(obj.path.join(moduleDirPath, modulesDir[i])).toString('binary')), '"); addedModules.push("', moduleName, '"); } catch (ex) { }\r\n' ]; // Merge this module // NOTE: "smbios" module makes some non-AI Linux segfault, only include for IA platforms. @@ -3161,7 +2802,7 @@ function CreateMeshCentralServer(config, args) { } catch (ex) { } } }; - + // List of possible mesh agents obj.meshAgentsArchitectureNumbers = { 0: { id: 0, localname: 'Unknown', rname: 'meshconsole.exe', desc: 'Unknown agent', update: false, amt: true, platform: 'unknown', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, @@ -3178,7 +2819,7 @@ function CreateMeshCentralServer(config, args) { 11: { id: 11, localname: 'meshagent_osx-x86-32', rname: 'meshosx', desc: 'Apple macOS x86-32', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // Apple x86-32 binary, no longer supported. 12: { id: 12, localname: 'MeshAgent-Android-x86', rname: 'meshandroid', desc: 'Android x86-32', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, 13: { id: 13, localname: 'meshagent_pogo', rname: 'meshagent', desc: 'Linux ARM PogoPlug', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, - 14: { id: 14, localname: 'meshagent_android.apk', rname: 'meshandroid.apk', desc: 'Android', update: false, amt: false, platform: 'android', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // Get this one from Google Play + 14: { id: 14, localname: 'MeshAgent-Android-APK', rname: 'meshandroid', desc: 'Android', update: false, amt: false, platform: 'android', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // Get this one from Google Play 15: { id: 15, localname: 'meshagent_poky', rname: 'meshagent', desc: 'Linux Poky x86-32', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, 16: { id: 16, localname: 'meshagent_osx-x86-64', rname: 'meshagent', desc: 'Apple macOS x86-64', update: true, amt: false, platform: 'osx', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // Apple x86-64 binary 17: { id: 17, localname: 'MeshAgent-ChromeOS', rname: 'meshagent', desc: 'Google ChromeOS', update: false, amt: false, platform: 'chromeos', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // Get this one from Chrome store @@ -3203,15 +2844,8 @@ function CreateMeshCentralServer(config, args) { 37: { id: 37, localname: 'meshagent_openbsd_x86-64', rname: 'meshagent', desc: 'OpenBSD x86-64', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // OpenBSD x86-64 40: { id: 40, localname: 'meshagent_mipsel24kc', rname: 'meshagent', desc: 'Linux MIPSEL24KC (OpenWRT)', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // MIPS Router with OpenWRT 41: { id: 41, localname: 'meshagent_aarch64-cortex-a53', rname: 'meshagent', desc: 'ARMADA/CORTEX-A53/MUSL (OpenWRT)', update: true, amt: false, platform: 'linux', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // OpenWRT Routers - 42: { id: 42, localname: 'MeshConsoleARM64.exe', rname: 'meshconsolearm64.exe', desc: 'Windows ARM-64 console', update: true, amt: true, platform: 'win32', core: 'windows-amt', rcore: 'windows-recovery', arcore: 'windows-agentrecovery', tcore: 'windows-tiny' }, - 43: { id: 43, localname: 'MeshServiceARM64.exe', rname: 'meshagentarm64.exe', desc: 'Windows ARM-64 service', update: true, amt: true, platform: 'win32', core: 'windows-amt', rcore: 'windows-recovery', arcore: 'windows-agentrecovery', tcore: 'windows-tiny', codesign: true }, - 10003: { id: 10003, localname: 'MeshService.exe', rname: 'meshagent32.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32', core: 'windows-amt', rcore: 'windows-recovery', arcore: 'windows-agentrecovery', tcore: 'windows-tiny', unsigned: true }, - 10004: { id: 10004, localname: 'MeshService64.exe', rname: 'meshagent64.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32', core: 'windows-amt', rcore: 'windows-recovery', arcore: 'windows-agentrecovery', tcore: 'windows-tiny', unsigned: true }, 10005: { id: 10005, localname: 'meshagent_osx-universal-64', rname: 'meshagent', desc: 'Apple macOS Universal Binary', update: true, amt: false, platform: 'osx', core: 'linux-noamt', rcore: 'linux-recovery', arcore: 'linux-agentrecovery', tcore: 'linux-tiny' }, // Apple Silicon + x86 universal binary - 10006: { id: 10006, localname: 'MeshCentralAssistant.exe', rname: 'MeshCentralAssistant.exe', desc: 'MeshCentral Assistant for Windows', update: false, amt: false, platform: 'win32' }, // MeshCentral Assistant - 11000: { id: 11000, localname: 'MeshCmd.exe', rname: 'MeshCmd.exe', desc: 'Windows x86-32 meshcmd', update: false, amt: true, platform: 'win32', codesign: true }, // MeshCMD for Windows x86 32-bit - 11001: { id: 11001, localname: 'MeshCmd64.exe', rname: 'MeshCmd64.exe', desc: 'Windows x86-64 meshcmd', update: false, amt: true, platform: 'win32', codesign: true }, // MeshCMD for Windows x86 64-bit - 11002: { id: 11002, localname: 'MeshCmdARM64.exe', rname: 'MeshCmdARM64.exe', desc: 'Windows ARM-64 meshcmd', update: false, amt: true, platform: 'win32', codesign: true } // MeshCMD for Windows ARM 64-bit + 10006: { id: 10006, localname: 'MeshCentralAssistant.exe', rname: 'MeshCentralAssistant.exe', desc: 'MeshCentral Assistant for Windows', update: false, amt: false, platform: 'win32' } // MeshCentral Assistant }; // Sign windows agents @@ -3254,13 +2888,13 @@ function CreateMeshCentralServer(config, args) { // Setup the time server var timeStampUrl = 'http://timestamp.comodoca.com/authenticode'; - if (obj.args.agenttimestampserver === false) { timeStampUrl = null; } - else if (typeof obj.args.agenttimestampserver == 'string') { timeStampUrl = obj.args.agenttimestampserver; } + if (args.agenttimestampserver === false) { timeStampUrl = null; } + else if (typeof args.agenttimestampserver == 'string') { timeStampUrl = args.agenttimestampserver; } // Setup the time server proxy var timeStampProxy = null; - if (typeof obj.args.agenttimestampproxy == 'string') { timeStampProxy = obj.args.agenttimestampproxy; } - else if ((obj.args.agenttimestampproxy !== false) && (typeof obj.args.npmproxy == 'string')) { timeStampProxy = obj.args.npmproxy; } + if (typeof args.agenttimestampproxy == 'string') { timeStampProxy = args.agenttimestampproxy; } + else if ((args.agenttimestampproxy !== false) && (typeof args.npmproxy == 'string')) { timeStampProxy = args.npmproxy; } // Setup the pending operations counter var pendingOperations = 1; @@ -3276,7 +2910,7 @@ function CreateMeshCentralServer(config, args) { if (obj.fs.existsSync(agentpath2)) { agentpath = agentpath2; delete obj.meshAgentsArchitectureNumbers[archid].codesign; } // If the agent is present in "meshcentral-data/agents", use that one instead. } else { // When processing an extra domain, only load agents that are specific to that domain - agentpath = obj.path.join(obj.datapath, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); + var agentpath = obj.path.join(obj.datapath, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); if (obj.fs.existsSync(agentpath)) { delete obj.meshAgentsArchitectureNumbers[archid].codesign; } else { continue; } // If the agent is not present in "meshcentral-data/agents" skip. } @@ -3298,101 +2932,20 @@ function CreateMeshCentralServer(config, args) { // If the agent is signed correctly, look to see if the resources in the destination agent are correct var orgVersionStrings = originalAgent.getVersionInfo(); if (destinationAgentOk == true) { - const versionStrings = destinationAgent.getVersionInfo(); - const versionProperties = ['FileDescription', 'FileVersion', 'InternalName', 'LegalCopyright', 'OriginalFilename', 'ProductName', 'ProductVersion']; + var versionStrings = destinationAgent.getVersionInfo(); + var versionProperties = ['FileDescription', 'FileVersion', 'InternalName', 'LegalCopyright', 'OriginalFilename', 'ProductName', 'ProductVersion']; for (var i in versionProperties) { const prop = versionProperties[i], propl = prop.toLowerCase(); if ((domain.agentfileinfo != null) && (typeof domain.agentfileinfo == 'object') && (typeof domain.agentfileinfo[propl] == 'string')) { - if (domain.agentfileinfo[propl] != versionStrings[prop]) { destinationAgentOk = false; break; } // If the resource we want is not the same as the destination executable, we need to re-sign the agent. + if (domain.agentfileinfo[propl] != versionStrings[prop]) { destinationAgentOk = false; } // If the resource we want is not the same as the destination executable, we need to re-sign the agent. } else { - if (orgVersionStrings[prop] != versionStrings[prop]) { destinationAgentOk = false; break; } // if the resource of the orginal agent not the same as the destination executable, we need to re-sign the agent. - } - } - - // Check file version number - if (destinationAgentOk == true) { - if ((domain.agentfileinfo != null) && (typeof domain.agentfileinfo == 'object') && (typeof domain.agentfileinfo['fileversionnumber'] == 'string')) { - if (domain.agentfileinfo['fileversionnumber'] != versionStrings['~FileVersion']) { destinationAgentOk = false; } // If the resource we want is not the same as the destination executable, we need to re-sign the agent. - } else { - if (orgVersionStrings['~FileVersion'] != versionStrings['~FileVersion']) { destinationAgentOk = false; } // if the resource of the orginal agent not the same as the destination executable, we need to re-sign the agent. - } - } - - // Check product version number - if (destinationAgentOk == true) { - if ((domain.agentfileinfo != null) && (typeof domain.agentfileinfo == 'object') && (typeof domain.agentfileinfo['productversionnumber'] == 'string')) { - if (domain.agentfileinfo['productversionnumber'] != versionStrings['~ProductVersion']) { destinationAgentOk = false; } // If the resource we want is not the same as the destination executable, we need to re-sign the agent. - } else { - if (orgVersionStrings['~ProductVersion'] != versionStrings['~ProductVersion']) { destinationAgentOk = false; } // if the resource of the orginal agent not the same as the destination executable, we need to re-sign the agent. - } - } - - // Check the agent icon - if (destinationAgentOk == true) { - if ((domain.agentfileinfo != null) && (domain.agentfileinfo.icon != null)) { - // Check if the destination agent matches the icon we want - const agentIconGroups = destinationAgent.getIconInfo(); - if (agentIconGroups != null) { - const agentIconGroupNames = Object.keys(agentIconGroups); - if (agentIconGroupNames.length > 0) { - const agentMainIconGroup = agentIconGroups[agentIconGroupNames[0]]; - if (agentMainIconGroup.resCount != domain.agentfileinfo.icon.resCount) { - destinationAgentOk = false; // The icon image count is different, don't bother hashing to see if the icons are different. - } else { - const agentMainIconGroupHash = require('./authenticode.js').hashObject(agentMainIconGroup); - const iconHash = require('./authenticode.js').hashObject(domain.agentfileinfo.icon); - if (agentMainIconGroupHash != iconHash) { destinationAgentOk = false; } // If the existing agent icon does not match the desired icon, we need to re-sign the agent. - } - } - } - } else { - // Check if the destination agent has the default icon - const agentIconGroups1 = destinationAgent.getIconInfo(); - const agentIconGroups2 = originalAgent.getIconInfo(); - if (agentIconGroups1.resCount != agentIconGroups2.resCount) { - destinationAgentOk = false; // The icon image count is different, don't bother hashing to see if the icons are different. - } else { - const iconHash1 = require('./authenticode.js').hashObject(agentIconGroups1); - const iconHash2 = require('./authenticode.js').hashObject(agentIconGroups2); - if (iconHash1 != iconHash2) { destinationAgentOk = false; } // If the existing agent icon does not match the desired icon, we need to re-sign the agent. - } - } - } - - // Check the agent logo - if (destinationAgentOk == true) { - if ((domain.agentfileinfo != null) && (domain.agentfileinfo.logo != null)) { - // Check if the destination agent matches the logo we want - const agentBitmaps = destinationAgent.getBitmapInfo(); - if (agentBitmaps != null) { - const agentBitmapNames = Object.keys(agentBitmaps); - if (agentBitmapNames.length > 0) { - const agentMainBitmap = agentBitmaps[agentBitmapNames[0]]; - const agentMainBitmapHash = require('./authenticode.js').hashObject(agentMainBitmap); - const bitmapHash = require('./authenticode.js').hashObject(domain.agentfileinfo.logo); - if (agentMainBitmapHash != bitmapHash) { destinationAgentOk = false; } // If the existing agent logo does not match the desired logo, we need to re-sign the agent. - } - } - } else { - // Check if the destination agent has the default icon - const agentBitmaps1 = destinationAgent.getBitmapInfo(); - const agentBitmaps2 = originalAgent.getBitmapInfo(); - const agentBitmapNames = Object.keys(agentBitmaps1); - if (agentBitmapNames.length == 0) { - destinationAgentOk = false; - } else { - const iconHash1 = require('./authenticode.js').hashObject(agentBitmaps1[agentBitmapNames[0]]); - const iconHash2 = require('./authenticode.js').hashObject(agentBitmaps2[agentBitmapNames[0]]); - if (iconHash1 != iconHash2) { destinationAgentOk = false; } // If the existing agent icon does not match the desired icon, we need to re-sign the agent. - } + if (orgVersionStrings[prop] != versionStrings[prop]) { destinationAgentOk = false; } // if the resource of the orginal agent not the same as the destination executable, we need to re-sign the agent. } } } - // If everything looks ok, runs a hash of the original and destination agent .text, .data and .rdata sections. If different, sign the agent again. - if ((destinationAgentOk == true) && (originalAgent.getHashOfSection('sha384', '.text').compare(destinationAgent.getHashOfSection('sha384', '.text')) != 0)) { destinationAgentOk = false; } - if ((destinationAgentOk == true) && (originalAgent.getHashOfSection('sha384', '.data').compare(destinationAgent.getHashOfSection('sha384', '.data')) != 0)) { destinationAgentOk = false; } - if ((destinationAgentOk == true) && (originalAgent.getHashOfSection('sha384', '.rdata').compare(destinationAgent.getHashOfSection('sha384', '.rdata')) != 0)) { destinationAgentOk = false; } + // If everything looks ok, runs a hash of the original and destination agent skipping the CRC, resource and signature blocks. If different, sign the agent again. + if ((destinationAgentOk == true) && (originalAgent.getHashNoResources('sha384').compare(destinationAgent.getHashNoResources('sha384')) != 0)) { destinationAgentOk = false; } // We are done comparing the destination agent, close it. destinationAgent.close(); @@ -3404,10 +2957,10 @@ function CreateMeshCentralServer(config, args) { const xagentSignedFunc = function agentSignedFunc(err, size) { if (err == null) { // Agent was signed succesfuly - console.log(obj.common.format('Code signed {0}.', agentSignedFunc.objx.meshAgentsArchitectureNumbers[agentSignedFunc.archid].localname)); + console.log(obj.common.format('Code signed agent {0}.', agentSignedFunc.objx.meshAgentsArchitectureNumbers[agentSignedFunc.archid].localname)); } else { // Failed to sign agent - addServerWarning('Failed to sign \"' + agentSignedFunc.objx.meshAgentsArchitectureNumbers[agentSignedFunc.archid].localname + '\": ' + err, 22, [agentSignedFunc.objx.meshAgentsArchitectureNumbers[agentSignedFunc.archid].localname, err]); + addServerWarning('Failed to sign agent \"' + agentSignedFunc.objx.meshAgentsArchitectureNumbers[agentSignedFunc.archid].localname + '\": ' + err, 22, [ agentSignedFunc.objx.meshAgentsArchitectureNumbers[agentSignedFunc.archid].localname, err ]); } if (--pendingOperations === 0) { agentSignedFunc.func(); } } @@ -3422,49 +2975,15 @@ function CreateMeshCentralServer(config, args) { if ((domain.agentfileinfo != null) && (typeof domain.agentfileinfo == 'object')) { versionStrings = originalAgent.getVersionInfo(); var versionProperties = ['FileDescription', 'FileVersion', 'InternalName', 'LegalCopyright', 'OriginalFilename', 'ProductName', 'ProductVersion']; - // Change the agent string properties for (var i in versionProperties) { const prop = versionProperties[i], propl = prop.toLowerCase(); if (domain.agentfileinfo[propl] && (domain.agentfileinfo[propl] != versionStrings[prop])) { versionStrings[prop] = domain.agentfileinfo[propl]; resChanges = true; } } - // Change the agent file version - if (domain.agentfileinfo['fileversionnumber'] && (domain.agentfileinfo['fileversionnumber'] != versionStrings['~FileVersion'])) { - versionStrings['~FileVersion'] = domain.agentfileinfo['fileversionnumber']; resChanges = true; - } - // Change the agent product version - if (domain.agentfileinfo['productversionnumber'] && (domain.agentfileinfo['productversionnumber'] != versionStrings['~ProductVersion'])) { - versionStrings['~ProductVersion'] = domain.agentfileinfo['productversionnumber']; resChanges = true; - } if (resChanges == true) { originalAgent.setVersionInfo(versionStrings); } - - // Change the agent icon - if (domain.agentfileinfo.icon != null) { - const agentIconGroups = originalAgent.getIconInfo(); - if (agentIconGroups != null) { - const agentIconGroupNames = Object.keys(agentIconGroups); - if (agentIconGroupNames.length > 0) { - const agentMainIconGroupName = agentIconGroupNames[0]; - agentIconGroups[agentIconGroupNames[0]] = domain.agentfileinfo.icon; - originalAgent.setIconInfo(agentIconGroups); - } - } - } - - // Change the agent logo - if (domain.agentfileinfo.logo != null) { - const agentBitmaps = originalAgent.getBitmapInfo(); - if (agentBitmaps != null) { - const agentBitmapNames = Object.keys(agentBitmaps); - if (agentBitmapNames.length > 0) { - agentBitmaps[agentBitmapNames[0]] = domain.agentfileinfo.logo; - originalAgent.setBitmapInfo(agentBitmaps); - } - } - } } const signingArguments = { out: signeedagentpath, desc: signDesc, url: signUrl, time: timeStampUrl, proxy: timeStampProxy }; // Shallow clone - obj.debug('main', "Code signing with arguments: " + JSON.stringify(signingArguments)); + obj.debug('main', "Code signing agent with arguments: " + JSON.stringify(signingArguments)); if (resChanges == false) { // Sign the agent the simple way, without changing any resources. originalAgent.sign(agentSignCertInfo, signingArguments, xagentSignedFunc); @@ -3511,15 +3030,13 @@ function CreateMeshCentralServer(config, args) { if (domain.id == '') { // Load all agents when processing the default domain agentpath = obj.path.join(__dirname, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); - if (obj.meshAgentsArchitectureNumbers[archid].unsigned !== true) { - const agentpath2 = obj.path.join(obj.datapath, 'signedagents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); - if (obj.fs.existsSync(agentpath2)) { agentpath = agentpath2; } // If the agent is present in "meshcentral-data/signedagents", use that one instead. - const agentpath3 = obj.path.join(obj.datapath, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); - if (obj.fs.existsSync(agentpath3)) { agentpath = agentpath3; } // If the agent is present in "meshcentral-data/agents", use that one instead. - } + const agentpath2 = obj.path.join(obj.datapath, 'signedagents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); + if (obj.fs.existsSync(agentpath2)) { agentpath = agentpath2; } // If the agent is present in "meshcentral-data/signedagents", use that one instead. + const agentpath3 = obj.path.join(obj.datapath, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); + if (obj.fs.existsSync(agentpath3)) { agentpath = agentpath3; } // If the agent is present in "meshcentral-data/agents", use that one instead. } else { // When processing an extra domain, only load agents that are specific to that domain - agentpath = obj.path.join(obj.datapath, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); + var agentpath = obj.path.join(obj.datapath, 'agents' + suffix, obj.meshAgentsArchitectureNumbers[archid].localname); if (obj.fs.existsSync(agentpath)) { delete obj.meshAgentsArchitectureNumbers[archid].codesign; } else { continue; } // If the agent is not present in "meshcentral-data/agents" skip. } @@ -3738,29 +3255,6 @@ function CreateMeshCentralServer(config, args) { }); } - // Encrypt session data - obj.encryptSessionData = function (data, key) { - if (data == null) return null; - if (key == null) { key = obj.loginCookieEncryptionKey; } - try { - const iv = Buffer.from(obj.crypto.randomBytes(12), 'binary'), cipher = obj.crypto.createCipheriv('aes-256-gcm', key.slice(0, 32), iv); - const crypted = Buffer.concat([cipher.update(JSON.stringify(data), 'utf8'), cipher.final()]); - return Buffer.concat([iv, cipher.getAuthTag(), crypted]).toString(obj.args.cookieencoding ? obj.args.cookieencoding : 'base64').replace(/\+/g, '@').replace(/\//g, '$'); - } catch (ex) { return null; } - } - - // Decrypt the session data - obj.decryptSessionData = function (data, key) { - if ((typeof data != 'string') || (data.length < 13)) return {}; - if (key == null) { key = obj.loginCookieEncryptionKey; } - try { - const buf = Buffer.from(data.replace(/\@/g, '+').replace(/\$/g, '/'), obj.args.cookieencoding ? obj.args.cookieencoding : 'base64'); - const decipher = obj.crypto.createDecipheriv('aes-256-gcm', key.slice(0, 32), buf.slice(0, 12)); - decipher.setAuthTag(buf.slice(12, 28)); - return JSON.parse(decipher.update(buf.slice(28), 'binary', 'utf8') + decipher.final('utf8')); - } catch (ex) { return {}; } - } - // Generate a cryptographic key used to encode and decode cookies obj.generateCookieKey = function () { return Buffer.from(obj.crypto.randomBytes(80), 'binary'); @@ -3784,7 +3278,7 @@ function CreateMeshCentralServer(config, args) { obj.decodeCookie = function (cookie, key, timeout) { if (cookie == null) return null; var r = obj.decodeCookieAESGCM(cookie, key, timeout); - if (r === -1) { r = obj.decodeCookieAESSHA(cookie, key, timeout); } // If decodeCookieAESGCM() failed to decode, try decodeCookieAESSHA() + if (r == null) { r = obj.decodeCookieAESSHA(cookie, key, timeout); } if ((r == null) && (obj.args.cookieencoding == null) && (cookie.length != 64) && ((cookie == cookie.toLowerCase()) || (cookie == cookie.toUpperCase()))) { obj.debug('cookie', 'Upper/Lowercase cookie, try "CookieEncoding":"hex" in settings section of config.json.'); console.log('Upper/Lowercase cookie, try "CookieEncoding":"hex" in settings section of config.json.'); @@ -3836,7 +3330,7 @@ function CreateMeshCentralServer(config, args) { } obj.debug('cookie', 'Decoded AESGCM cookie: ' + JSON.stringify(o)); return o; - } catch (ex) { obj.debug('cookie', 'ERR: Bad AESGCM cookie due to exception: ' + ex); return -1; } + } catch (ex) { obj.debug('cookie', 'ERR: Bad AESGCM cookie due to exception: ' + ex); return null; } }; // Decode a cookie back into an object using a key using AES256 / HMAC-SHA384. Return null if it's not a valid cookie. (key must be 80 bytes or more) @@ -3876,7 +3370,7 @@ function CreateMeshCentralServer(config, args) { // Send event to log file if (obj.config.settings && obj.config.settings.log) { if (typeof obj.args.log == 'string') { obj.args.log = obj.args.log.split(','); } - if ((obj.args.log.indexOf(source) >= 0) || (obj.args.log[0] == '*')) { + if (obj.args.log.indexOf(source) >= 0) { const d = new Date(); if (obj.xxLogFile == null) { try { @@ -3888,8 +3382,7 @@ function CreateMeshCentralServer(config, args) { if (obj.xxLogFile != null) { try { if (obj.xxLogDateStr != d.toLocaleDateString()) { obj.xxLogDateStr = d.toLocaleDateString(); obj.fs.writeSync(obj.xxLogFile, '---- ' + d.toLocaleDateString() + ' ----\r\n'); } - const formattedArgs = args.map(function (arg) { return (typeof arg === 'object' && arg !== null) ? JSON.stringify(arg) : arg; }); - obj.fs.writeSync(obj.xxLogFile, new Date().toLocaleTimeString() + ' - ' + source + ': ' + formattedArgs.join(', ') + '\r\n'); + obj.fs.writeSync(obj.xxLogFile, new Date().toLocaleTimeString() + ' - ' + source + ': ' + args.join(', ') + '\r\n'); } catch (ex) { } } } @@ -3933,7 +3426,7 @@ function CreateMeshCentralServer(config, args) { function readIpListFromFile(arg) { if ((typeof arg != 'string') || (!arg.startsWith('file:'))) return arg; var lines = null; - try { lines = obj.fs.readFileSync(obj.path.join(obj.datapath, arg.substring(5))).toString().split(/\r?\n/).join('\r').split('\r'); } catch (ex) { } + try { lines = obj.fs.readFileSync(obj.path.join(obj.datapath, arg.substring(5))).toString().split('\r\n').join('\r').split('\r'); } catch (ex) { } if (lines == null) return null; const validLines = []; for (var i in lines) { if ((lines[i].length > 0) && (((lines[i].charAt(0) > '0') && (lines[i].charAt(0) < '9')) || (lines[i].charAt(0) == ':'))) validLines.push(lines[i]); } @@ -3946,25 +3439,18 @@ function CreateMeshCentralServer(config, args) { function logWarnEvent(msg) { if (obj.servicelog != null) { obj.servicelog.warn(msg); } console.log(msg); } function logErrorEvent(msg) { if (obj.servicelog != null) { obj.servicelog.error(msg); } console.error(msg); } obj.getServerWarnings = function () { return serverWarnings; } - // TODO: migrate from other addServerWarning function and add timestamp obj.addServerWarning = function (msg, id, args, print) { serverWarnings.push({ msg: msg, id: id, args: args }); if (print !== false) { console.log("WARNING: " + msg); } } // auth.log functions - obj.authLog = function (server, msg, args) { + obj.authLog = function (server, msg) { if (typeof msg != 'string') return; - var str = msg; - if (args != null) { - if (typeof args.sessionid == 'string') { str += ', SessionID: ' + args.sessionid; } - if (typeof args.useragent == 'string') { const userAgentInfo = obj.webserver.getUserAgentInfo(args.useragent); str += ', Browser: ' + userAgentInfo.browserStr + ', OS: ' + userAgentInfo.osStr; } - } - obj.debug('authlog', str); - if (obj.syslogauth != null) { try { obj.syslogauth.log(obj.syslogauth.LOG_INFO, str); } catch (ex) { } } + if (obj.syslogauth != null) { try { obj.syslogauth.log(obj.syslogauth.LOG_INFO, msg); } catch (ex) { } } if (obj.authlogfile != null) { // Write authlog to file try { const d = new Date(), month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()]; - str = month + ' ' + d.getDate() + ' ' + obj.common.zeroPad(d.getHours(), 2) + ':' + obj.common.zeroPad(d.getMinutes(), 2) + ':' + d.getSeconds() + ' meshcentral ' + server + '[' + process.pid + ']: ' + msg + ((obj.platform == 'win32') ? '\r\n' : '\n'); - obj.fs.write(obj.authlogfile, str, function (err, written, string) { if (err) { console.error(err); } }); - } catch (ex) { console.error(ex); } + msg = month + ' ' + d.getDate() + ' ' + obj.common.zeroPad(d.getHours(), 2) + ':' + obj.common.zeroPad(d.getMinutes(), 2) + ':' + d.getSeconds() + ' meshcentral ' + server + '[' + process.pid + ']: ' + msg + ((obj.platform == 'win32') ? '\r\n' : '\n'); + obj.fs.write(obj.authlogfile, msg, function (err, written, string) { }); + } catch (ex) { console.log(ex); } } } @@ -3985,7 +3471,7 @@ function CreateMeshCentralServer(config, args) { function checkResolveAll(names, func) { const dns = require('dns'), state = { func: func, count: names.length, err: null }; for (var i in names) { - dns.lookup(names[i], { all: true }, function (err, records) { + dns.resolve(names[i], function (err, records) { if (err != null) { if (this.state.err == null) { this.state.err = [this.name]; } else { this.state.err.push(this.name); } } if (--this.state.count == 0) { this.state.func(this.state.err); } }.bind({ name: names[i], state: state })) @@ -4007,7 +3493,9 @@ function getConfig(createSampleConfig) { // Read configuration file if present and change arguments. var config = {}, configFilePath = path.join(datapath, 'config.json'); - if (args.configfile) { configFilePath = common.joinPath(datapath, args.configfile); } + if (args.configfile) { + configFilePath = common.joinPath(datapath, args.configfile); + } if (fs.existsSync(configFilePath)) { // Load and validate the configuration file try { config = require(configFilePath); } catch (ex) { console.log('ERROR: Unable to parse ' + configFilePath + '.'); return null; } @@ -4027,7 +3515,7 @@ function getConfig(createSampleConfig) { // Lower case all keys in the config file try { - require('./common.js').objKeysToLower(config, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders', 'telegram/proxy']); + require('./common.js').objKeysToLower(config, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders']); } catch (ex) { console.log('CRITICAL ERROR: Unable to access the file \"./common.js\".\r\nCheck folder & file permissions.'); process.exit(); @@ -4037,38 +3525,21 @@ function getConfig(createSampleConfig) { } // Check if a list of modules are present and install any missing ones -function InstallModules(modules, args, func) { - var missingModules = []; +function InstallModules(modules, func) { + const missingModules = []; if (modules.length > 0) { const dependencies = require('./package.json').dependencies; for (var i in modules) { // Modules may contain a version tag (foobar@1.0.0), remove it so the module can be found using require const moduleNameAndVersion = modules[i]; - const moduleInfo = moduleNameAndVersion.split('@', 3); - var moduleName = null; - var moduleVersion = null; - if(moduleInfo.length == 1){ // normal package without version - moduleName = moduleInfo[0]; - } else if (moduleInfo.length == 2) { // normal package with a version OR custom repo package with no version - moduleName = moduleInfo[0] === '' ? moduleNameAndVersion : moduleInfo[0]; - moduleVersion = moduleInfo[0] === '' ? null : moduleInfo[1]; - } else if (moduleInfo.length == 3) { // custom repo package and package with a version - moduleName = "@" + moduleInfo[1]; - moduleVersion = moduleInfo[2]; - } + const moduleInfo = moduleNameAndVersion.split('@', 2); + var moduleName = moduleInfo[0]; + var moduleVersion = moduleInfo[1]; + if (moduleName == '') { moduleName = moduleNameAndVersion; moduleVersion = null; } // If the module name starts with @, don't use @ as a version seperator. try { // Does the module need a specific version? if (moduleVersion) { - var versionMatch = false; - var modulePath = null; - // This is the first way to test if a module is already installed. - try { versionMatch = (require(`${moduleName}/package.json`).version == moduleVersion) } catch (ex) { - if (ex.code == "ERR_PACKAGE_PATH_NOT_EXPORTED") { modulePath = ("" + ex).split(' ').at(-1); } else { throw new Error(); } - } - // If the module is not installed, but we get the ERR_PACKAGE_PATH_NOT_EXPORTED error, try a second way. - if ((versionMatch == false) && (modulePath != null)) { - if (JSON.parse(require('fs').readFileSync(modulePath, 'utf8')).version != moduleVersion) { throw new Error(); } - } + if (require(`${moduleName}/package.json`).version != moduleVersion) { throw new Error(); } } else { // For all other modules, do the check here. // Is the module in package.json? Install exact version. @@ -4076,39 +3547,32 @@ function InstallModules(modules, args, func) { require(moduleName); } } catch (ex) { - missingModules.push(moduleNameAndVersion); + if (previouslyInstalledModules[modules[i]] !== true) { missingModules.push(moduleNameAndVersion); } } } - - if (missingModules.length > 0) { if (args.debug) { console.log('Missing Modules: ' + missingModules.join(', ')); } InstallModuleEx(missingModules, args, func); } else { func(); } + if (missingModules.length > 0) { InstallModule(missingModules.shift(), InstallModules, modules, func); } else { func(); } } } -// Install all missing modules at once. We will be running "npm install" once, with a full list of all modules we need, no matter if they area already installed or not, -// this is to make sure NPM gives us exactly what we need. Also, we install the meshcentral with current version, so that NPM does not update it - which it will do if obmitted. -function InstallModuleEx(modulenames, args, func) { - var names = modulenames.join(' '); - console.log('Installing modules', modulenames); +// Check if a module is present and install it if missing +function InstallModule(modulename, func, tag1, tag2) { + console.log('Installing ' + modulename + '...'); const child_process = require('child_process'); var parentpath = __dirname; - function getCurrentVersion() { try { return JSON.parse(require('fs').readFileSync(require('path').join(__dirname, 'package.json'), 'utf8')).version; } catch (ex) { } return null; } // Fetch server version - //const meshCentralVersion = getCurrentVersion(); - //if ((meshCentralVersion != null) && (args.dev == null)) { names = 'meshcentral@' + getCurrentVersion() + ' ' + names; } // Get the working directory if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); } - if (args.debug) { console.log('NPM Command Line: ' + npmpath + ` install --save-exact --no-audit --omit=optional --no-fund ${names}`); } - // always use --save-exact - https://stackoverflow.com/a/64507176/1210734 - child_process.exec(npmpath + ` install --save-exact --no-audit --no-optional --omit=optional ${names}`, { maxBuffer: 512000, timeout: 300000, cwd: parentpath }, function (error, stdout, stderr) { + child_process.exec(npmpath + ` install --no-optional ${modulename}`, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) { if ((error != null) && (error != '')) { var mcpath = __dirname; if (mcpath.endsWith('\\node_modules\\meshcentral') || mcpath.endsWith('/node_modules/meshcentral')) { mcpath = require('path').join(mcpath, '..', '..'); } - console.log('ERROR: Unable to install required modules. MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. To manualy install this module try:\r\n\r\n cd "' + mcpath + '"\r\n npm install --no-audit --no-optional --omit=optional ' + names + '\r\n node node_modules' + ((require('os').platform() == 'win32') ? '\\' : '/') + 'meshcentral'); + console.log('ERROR: Unable to install required module "' + modulename + '". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. To manualy install this module try:\r\n\r\n cd "' + mcpath + '"\r\n npm install ' + modulename + '\r\n node node_modules' + ((require('os').platform() == 'win32') ? '\\' : '/') + 'meshcentral'); process.exit(); return; } - func(); + previouslyInstalledModules[modulename] = true; + func(tag1, tag2); return; }); } @@ -4117,13 +3581,12 @@ function InstallModuleEx(modulenames, args, func) { process.on('SIGINT', function () { if (meshserver != null) { meshserver.Stop(); meshserver = null; } console.log('Server Ctrl-C exit...'); process.exit(); }); // Add a server warning, warnings will be shown to the administrator on the web application -// TODO: migrate to obj.addServerWarning? const serverWarnings = []; function addServerWarning(msg, id, args, print) { serverWarnings.push({ msg: msg, id: id, args: args }); if (print !== false) { console.log("WARNING: " + msg); } } /* var ServerWarnings = { - 1: "", + 1: "MeshCentral SSH support requires NodeJS 11 or higher.", 2: "Missing WebDAV parameters.", 3: "Unrecognized configuration option \"{0}\".", 4: "WebSocket compression is disabled, this feature is broken in NodeJS v11.11 to v12.15 and v13.2", @@ -4142,14 +3605,7 @@ var ServerWarnings = { 17: "SendGrid server has limited use in LAN mode.", 18: "SMTP server has limited use in LAN mode.", 19: "SMS gateway has limited use in LAN mode.", - 20: "Invalid \"LoginCookieEncryptionKey\" in config.json.", - 21: "Backup path can't be set within meshcentral-data folder, backup settings ignored.", - 22: "Failed to sign agent {0}: {1}", - 23: "Unable to load agent icon file: {0}.", - 24: "Unable to load agent logo file: {0}.", - 25: "This NodeJS version does not support OpenID.", - 26: "This NodeJS version does not support Discord.js.", - 27: "Firebase now requires a service account JSON file, Firebase disabled." + 20: "Invalid \"LoginCookieEncryptionKey\" in config.json." }; */ @@ -4159,14 +3615,14 @@ var meshserver = null; var childProcess = null; var previouslyInstalledModules = {}; function mainStart() { - // Check the NodeJS is version 16 or better. - if (Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 16) { console.log("MeshCentral requires Node v16 or above, current version is " + process.version + "."); return; } + // Check the NodeJS is version 10 or better. + if (Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 10) { console.log("MeshCentral requires Node v10 or above, current version is " + process.version + "."); return; } // If running within the node_modules folder, move working directory to the parent of the node_modules folder. if (__dirname.endsWith('\\node_modules\\meshcentral') || __dirname.endsWith('/node_modules/meshcentral')) { process.chdir(require('path').join(__dirname, '..', '..')); } // Check for any missing modules. - InstallModules(['minimist'], {}, function () { + InstallModules(['minimist'], function () { // Parse inbound arguments const args = require('minimist')(process.argv.slice(2)); @@ -4203,7 +3659,7 @@ function mainStart() { // Check if Windows SSPI, LDAP, Passport and YubiKey OTP will be used var sspi = false; var ldap = false; - var passport = []; + var passport = null; var allsspi = true; var yubikey = false; var ssh = false; @@ -4212,82 +3668,61 @@ function mainStart() { var wildleek = false; var nodemailer = false; var sendgrid = false; - var captcha = false; if (require('os').platform() == 'win32') { for (var i in config.domains) { domainCount++; if (config.domains[i].auth == 'sspi') { sspi = true; } else { allsspi = false; } } } else { allsspi = false; } if (domainCount == 0) { allsspi = false; } for (var i in config.domains) { if (i.startsWith('_')) continue; - if (((config.domains[i].smtp != null) && (config.domains[i].smtp.name != 'console')) || (config.domains[i].sendmail != null)) { nodemailer = true; } + if ((config.domains[i].smtp != null) || (config.domains[i].sendmail != null)) { nodemailer = true; } if (config.domains[i].sendgrid != null) { sendgrid = true; } if (config.domains[i].yubikey != null) { yubikey = true; } if (config.domains[i].auth == 'ldap') { ldap = true; } if (mstsc == false) { config.domains[i].mstsc = false; } - if (config.domains[i].ssh == true) { ssh = true; } + if (config.domains[i].ssh == true) { if (nodeVersion < 11) { config.domains[i].ssh = false; } ssh = true; } if ((typeof config.domains[i].authstrategies == 'object')) { - if (passport.indexOf('passport') == -1) { passport.push('passport','connect-flash'); } // Passport v0.6.0 requires a patch, see https://github.com/jaredhanson/passport/issues/904 and include connect-flash here to display errors + if (passport == null) { passport = ['passport@0.5.3']; } // Passport v0.6.0 is broken with cookie-session, see https://github.com/jaredhanson/passport/issues/904 if ((typeof config.domains[i].authstrategies.twitter == 'object') && (typeof config.domains[i].authstrategies.twitter.clientid == 'string') && (typeof config.domains[i].authstrategies.twitter.clientsecret == 'string') && (passport.indexOf('passport-twitter') == -1)) { passport.push('passport-twitter'); } if ((typeof config.domains[i].authstrategies.google == 'object') && (typeof config.domains[i].authstrategies.google.clientid == 'string') && (typeof config.domains[i].authstrategies.google.clientsecret == 'string') && (passport.indexOf('passport-google-oauth20') == -1)) { passport.push('passport-google-oauth20'); } if ((typeof config.domains[i].authstrategies.github == 'object') && (typeof config.domains[i].authstrategies.github.clientid == 'string') && (typeof config.domains[i].authstrategies.github.clientsecret == 'string') && (passport.indexOf('passport-github2') == -1)) { passport.push('passport-github2'); } + if ((typeof config.domains[i].authstrategies.reddit == 'object') && (typeof config.domains[i].authstrategies.reddit.clientid == 'string') && (typeof config.domains[i].authstrategies.reddit.clientsecret == 'string') && (passport.indexOf('passport-reddit') == -1)) { passport.push('passport-reddit'); } if ((typeof config.domains[i].authstrategies.azure == 'object') && (typeof config.domains[i].authstrategies.azure.clientid == 'string') && (typeof config.domains[i].authstrategies.azure.clientsecret == 'string') && (typeof config.domains[i].authstrategies.azure.tenantid == 'string') && (passport.indexOf('passport-azure-oauth2') == -1)) { passport.push('passport-azure-oauth2'); passport.push('jwt-simple'); } - if ((typeof config.domains[i].authstrategies.oidc == 'object') && (passport.indexOf('openid-client@5.7.1') == -1)) { - if ((nodeVersion >= 17) - || ((Math.floor(nodeVersion) == 16) && (nodeVersion >= 16.13)) - || ((Math.floor(nodeVersion) == 14) && (nodeVersion >= 14.15)) - || ((Math.floor(nodeVersion) == 12) && (nodeVersion >= 12.19))) { - passport.push('openid-client@5.7.1'); - } else { - addServerWarning('This NodeJS version does not support OpenID Connect on MeshCentral.', 25); - delete config.domains[i].authstrategies.oidc; - } - } + if ((typeof config.domains[i].authstrategies.oidc == 'object') && (typeof config.domains[i].authstrategies.oidc.clientid == 'string') && (typeof config.domains[i].authstrategies.oidc.clientsecret == 'string') && (passport.indexOf('@mstrhakr/passport-generic-oidc') == -1)) { passport.push('@mstrhakr/passport-generic-oidc'); } if ((typeof config.domains[i].authstrategies.saml == 'object') || (typeof config.domains[i].authstrategies.jumpcloud == 'object')) { passport.push('passport-saml'); } } if (config.domains[i].sessionrecording != null) { sessionRecording = true; } if ((config.domains[i].passwordrequirements != null) && (config.domains[i].passwordrequirements.bancommonpasswords == true)) { wildleek = true; } - if ((config.domains[i].newaccountscaptcha != null) && (config.domains[i].newaccountscaptcha !== false)) { captcha = true; } - if ((typeof config.domains[i].duo2factor == 'object') && (passport.indexOf('@duosecurity/duo_universal') == -1)) { passport.push('@duosecurity/duo_universal'); } } // Build the list of required modules - // NOTE: ALL MODULES MUST HAVE A VERSION NUMBER AND THE VERSION MUST MATCH THAT USED IN Dockerfile - var modules = ['archiver@7.0.1', 'body-parser@1.20.3', 'cbor@5.2.0', 'compression@1.7.5', 'cookie-session@2.1.0', 'express@4.21.2', 'express-handlebars@7.1.3', 'express-ws@5.0.2', 'ipcheck@0.1.0', 'minimist@1.2.8', 'multiparty@4.2.3', '@seald-io/nedb', 'node-forge@1.3.1', 'ua-parser-js@1.0.39', 'ws@8.18.0', 'yauzl@2.10.0']; - if (require('os').platform() == 'win32') { modules.push('node-windows@0.1.14'); modules.push('loadavg-windows@1.1.1'); if (sspi == true) { modules.push('node-sspi@0.2.10'); } } // Add Windows modules - if (ldap == true) { modules.push('ldapauth-fork@5.0.5'); } - if (ssh == true) { modules.push('ssh2@1.16.0'); } + var modules = ['ws@5.2.3', 'cbor@5.2.0', '@yetzt/nedb', 'https', 'yauzl', 'ipcheck', 'express', 'archiver@5.3.1', 'multiparty', 'node-forge', 'express-ws@4.0.0', 'compression', 'body-parser', 'cookie-session@1.4.0', 'express-handlebars']; + if (require('os').platform() == 'win32') { modules.push('node-windows@0.1.4'); modules.push('loadavg-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules + if (ldap == true) { modules.push('ldapauth-fork'); } + if (ssh == true) { if (nodeVersion < 11) { addServerWarning('MeshCentral SSH support requires NodeJS 11 or higher.', 1); } else { modules.push('ssh2'); } } if (passport != null) { modules.push(...passport); } - if (captcha == true) { modules.push('svg-captcha@1.4.0'); } - - if (sessionRecording == true) { modules.push('image-size@1.1.1'); } // Need to get the remote desktop JPEG sizes to index the recodring file. - if (config.letsencrypt != null) { modules.push('acme-client@4.2.5'); } // Add acme-client module. We need to force v4.2.4 or higher since olver versions using SHA-1 which is no longer supported by Let's Encrypt. + if (sessionRecording == true) { modules.push('image-size'); } // Need to get the remote desktop JPEG sizes to index the recodring file. + if (config.letsencrypt != null) { modules.push('acme-client'); } // Add acme-client module if (config.settings.mqtt != null) { modules.push('aedes@0.39.0'); } // Add MQTT Modules - if (config.settings.mysql != null) { modules.push('mysql2@3.11.4'); } // Add MySQL. - //if (config.settings.mysql != null) { modules.push('@mysql/xdevapi@8.0.33'); } // Add MySQL, official driver (https://dev.mysql.com/doc/dev/connector-nodejs/8.0/) - if (config.settings.mongodb != null) { modules.push('mongodb@4.13.0'); modules.push('saslprep@1.0.3'); } // Add MongoDB, official driver. - if (config.settings.postgres != null) { modules.push('pg@8.13.1') } // Add Postgres, official driver. - if (config.settings.mariadb != null) { modules.push('mariadb@3.4.0'); } // Add MariaDB, official driver. - if (config.settings.acebase != null) { modules.push('acebase@1.29.5'); } // Add AceBase, official driver. - if (config.settings.sqlite3 != null) { modules.push('sqlite3@5.1.7'); } // Add sqlite3, official driver. - if (config.settings.vault != null) { modules.push('node-vault@0.10.2'); } // Add official HashiCorp's Vault module. - if (config.settings.plugins != null) { modules.push('semver@7.5.4'); } // Required for version compat testing and update checks - if ((config.settings.plugins != null) && (config.settings.plugins.proxy != null)) { modules.push('https-proxy-agent@7.0.2'); } // Required for HTTP/HTTPS proxy support - else if (config.settings.xmongodb != null) { modules.push('mongojs@3.1.0'); } // Add MongoJS, old driver. - if (nodemailer || ((config.smtp != null) && (config.smtp.name != 'console')) || (config.sendmail != null)) { modules.push('nodemailer@6.9.16'); } // Add SMTP support + if (config.settings.mysql != null) { modules.push('mysql'); } // Add MySQL. + //if (config.settings.mysql != null) { modules.push('@mysql/xdevapi'); } // Add MySQL, official driver (https://dev.mysql.com/doc/dev/connector-nodejs/8.0/) + if (config.settings.mongodb != null) { modules.push('mongodb@4.1.0'); modules.push('saslprep'); } // Add MongoDB, official driver. + if (config.settings.postgres != null) { modules.push('pg@8.7.1'); modules.push('pgtools@0.3.2'); } // Add Postgres, Postgres driver. + if (config.settings.mariadb != null) { modules.push('mariadb'); } // Add MariaDB, official driver. + if (config.settings.vault != null) { modules.push('node-vault'); } // Add official HashiCorp's Vault module. + if (config.settings.plugins != null) { modules.push('semver'); } // Required for version compat testing and update checks + if ((config.settings.plugins != null) && (config.settings.plugins.proxy != null)) { modules.push('https-proxy-agent'); } // Required for HTTP/HTTPS proxy support + else if (config.settings.xmongodb != null) { modules.push('mongojs'); } // Add MongoJS, old driver. + if (nodemailer || (config.smtp != null) || (config.sendmail != null)) { modules.push('nodemailer'); } // Add SMTP support if (sendgrid || (config.sendgrid != null)) { modules.push('@sendgrid/mail'); } // Add SendGrid support - if ((args.translate || args.dev) && (Number(process.version.match(/^v(\d+\.\d+)/)[1]) >= 16)) { modules.push('jsdom@22.1.0'); modules.push('esprima@4.0.1'); modules.push('html-minifier@4.0.0'); } // Translation support - if (typeof config.settings.crowdsec == 'object') { modules.push('@crowdsec/express-bouncer@0.1.0'); } // Add CrowdSec bounser module (https://www.npmjs.com/package/@crowdsec/express-bouncer) - if (config.settings.prometheus != null) { modules.push('prom-client'); } // Add Prometheus Metrics support + if (args.translate) { modules.push('jsdom'); modules.push('esprima'); modules.push('minify-js'); modules.push('html-minifier'); } // Translation support - if (typeof config.settings.autobackup == 'object') { - // Setup encrypted zip support if needed - if (config.settings.autobackup.zippassword) { modules.push('archiver-zip-encrypted@2.0.0'); } + // Setup encrypted zip support if needed + if (config.settings.autobackup && config.settings.autobackup.zippassword) { + modules.push('archiver-zip-encrypted'); // Enable Google Drive Support - if (typeof config.settings.autobackup.googledrive == 'object') { modules.push('googleapis@128.0.0'); } + if (typeof config.settings.autobackup.googledrive == 'object') { modules.push('googleapis'); } // Enable WebDAV Support if (typeof config.settings.autobackup.webdav == 'object') { - if ((typeof config.settings.autobackup.webdav.url != 'string') || (typeof config.settings.autobackup.webdav.username != 'string') || (typeof config.settings.autobackup.webdav.password != 'string')) { addServerWarning("Missing WebDAV parameters.", 2, null, !args.launch); } else { modules.push('webdav@4.11.4'); } + if ((typeof config.settings.autobackup.webdav.url != 'string') || (typeof config.settings.autobackup.webdav.username != 'string') || (typeof config.settings.autobackup.webdav.password != 'string')) { addServerWarning("Missing WebDAV parameters.", 2, null, !args.launch); } else { modules.push('webdav'); } } - // Enable S3 Support - if (typeof config.settings.autobackup.s3 == 'object') { modules.push('minio@8.0.2'); } } // Setup common password blocking @@ -4296,45 +3731,34 @@ function mainStart() { // Setup 2nd factor authentication if (config.settings.no2factorauth !== true) { // Setup YubiKey OTP if configured - if (yubikey == true) { modules.push('yubikeyotp@0.2.0'); } // Add YubiKey OTP support + if (yubikey == true) { modules.push('yubikeyotp'); } // Add YubiKey OTP support if (allsspi == false) { modules.push('otplib@10.2.3'); } // Google Authenticator support (v10 supports older NodeJS versions). } // Desktop multiplexor support - if (config.settings.desktopmultiplex === true) { modules.push('image-size@1.1.1'); } + if (config.settings.desktopmultiplex === true) { modules.push('image-size'); } // SMS support - if (config.sms != null) { - if (config.sms.provider == 'twilio') { modules.push('twilio@4.19.0'); } - if (config.sms.provider == 'plivo') { modules.push('plivo@4.58.0'); } - if (config.sms.provider == 'telnyx') { modules.push('telnyx@1.25.5'); } - } - - // Messaging support - if (config.messaging != null) { - if (config.messaging.telegram != null) { modules.push('telegram@2.19.8'); modules.push('input@1.0.1'); } - if (config.messaging.discord != null) { if (nodeVersion >= 17) { modules.push('discord.js@14.6.0'); } else { delete config.messaging.discord; addServerWarning('This NodeJS version does not support Discord.js.', 26); } } - if (config.messaging.xmpp != null) { modules.push('@xmpp/client@0.13.1'); } - if (config.messaging.pushover != null) { modules.push('node-pushover@1.0.0'); } - if (config.messaging.zulip != null) { modules.push('zulip@0.1.0'); } - } + if ((config.sms != null) && (config.sms.provider == 'twilio')) { modules.push('twilio'); } + if ((config.sms != null) && (config.sms.provider == 'plivo')) { modules.push('plivo'); } + if ((config.sms != null) && (config.sms.provider == 'telnyx')) { modules.push('telnyx'); } // Setup web based push notifications - if ((typeof config.settings.webpush == 'object') && (typeof config.settings.webpush.email == 'string')) { modules.push('web-push@3.6.6'); } + if ((typeof config.settings.webpush == 'object') && (typeof config.settings.webpush.email == 'string')) { modules.push('web-push'); } // Firebase Support - if ((config.firebase != null) && (typeof config.firebase.serviceaccountfile == 'string')) { modules.push('firebase-admin@12.7.0'); } + if (config.firebase != null) { modules.push('node-xcs'); } // Syslog support - if ((require('os').platform() != 'win32') && (config.settings.syslog || config.settings.syslogjson)) { modules.push('modern-syslog@1.2.0'); } - if (config.settings.syslogtcp) { modules.push('syslog@0.1.1-1'); } + if ((require('os').platform() != 'win32') && (config.settings.syslog || config.settings.syslogjson)) { modules.push('modern-syslog'); } + if (config.settings.syslogtcp) { modules.push('syslog'); } // Setup heapdump support if needed, useful for memory leak debugging // https://www.arbazsiddiqui.me/a-practical-guide-to-memory-leaks-in-nodejs/ - if (config.settings.heapdump === true) { modules.push('heapdump@0.3.15'); } + if (config.settings.heapdump === true) { modules.push('heapdump'); } // Install any missing modules and launch the server - InstallModules(modules, args, function () { + InstallModules(modules, function () { if (require('os').platform() == 'win32') { try { require('node-windows'); } catch (ex) { console.log("Module node-windows can't be loaded. Restart MeshCentral."); process.exit(); return; } } meshserver = CreateMeshCentralServer(config, args); meshserver.Start(); diff --git a/meshctrl.js b/meshctrl.js index af4f1626..5f068888 100644 --- a/meshctrl.js +++ b/meshctrl.js @@ -16,7 +16,7 @@ var settings = {}; const crypto = require('crypto'); const args = require('minimist')(process.argv.slice(2)); const path = require('path'); -const possibleCommands = ['edituser', 'listusers', 'listusersessions', 'listdevicegroups', 'listdevices', 'listusersofdevicegroup', 'listevents', 'logintokens', 'serverinfo', 'userinfo', 'adduser', 'removeuser', 'adddevicegroup', 'removedevicegroup', 'editdevicegroup', 'broadcast', 'showevents', 'addusertodevicegroup', 'removeuserfromdevicegroup', 'addusertodevice', 'removeuserfromdevice', 'sendinviteemail', 'generateinvitelink', 'config', 'movetodevicegroup', 'deviceinfo', 'removedevice', 'editdevice', 'addlocaldevice', 'addamtdevice', 'addusergroup', 'listusergroups', 'removeusergroup', 'runcommand', 'shell', 'upload', 'download', 'deviceopenurl', 'devicemessage', 'devicetoast', 'addtousergroup', 'removefromusergroup', 'removeallusersfromusergroup', 'devicesharing', 'devicepower', 'indexagenterrorlog', 'agentdownload', 'report', 'grouptoast', 'groupmessage', 'webrelay']; +const possibleCommands = ['edituser', 'listusers', 'listusersessions', 'listdevicegroups', 'listdevices', 'listusersofdevicegroup', 'listevents', 'logintokens', 'serverinfo', 'userinfo', 'adduser', 'removeuser', 'adddevicegroup', 'removedevicegroup', 'editdevicegroup', 'broadcast', 'showevents', 'addusertodevicegroup', 'removeuserfromdevicegroup', 'addusertodevice', 'removeuserfromdevice', 'sendinviteemail', 'generateinvitelink', 'config', 'movetodevicegroup', 'deviceinfo', 'editdevice', 'addusergroup', 'listusergroups', 'removeusergroup', 'runcommand', 'shell', 'upload', 'download', 'deviceopenurl', 'devicemessage', 'devicetoast', 'addtousergroup', 'removefromusergroup', 'removeallusersfromusergroup', 'devicesharing', 'devicepower', 'indexagenterrorlog', 'agentdownload']; if (args.proxy != null) { try { require('https-proxy-agent'); } catch (ex) { console.log('Missing module "https-proxy-agent", type "npm install https-proxy-agent" to install it.'); return; } } if (args['_'].length == 0) { @@ -36,10 +36,7 @@ if (args['_'].length == 0) { console.log(" ListEvents - List server events."); console.log(" LoginTokens - List, create and remove login tokens."); console.log(" DeviceInfo - Show information about a device."); - console.log(" AddLocalDevice - Add a local device."); - console.log(" AddAmtDevice - Add a AMT device."); console.log(" EditDevice - Make changes to a device."); - console.log(" RemoveDevice - Delete a device."); console.log(" Config - Perform operation on config.json file."); console.log(" AddUser - Create a new user account."); console.log(" EditUser - Change a user account."); @@ -65,21 +62,17 @@ if (args['_'].length == 0) { console.log(" Shell - Access command shell of a remote device."); console.log(" Upload - Upload a file to a remote device."); console.log(" Download - Download a file from a remote device."); - console.log(" WebRelay - Creates a HTTP/HTTPS webrelay link for a remote device."); console.log(" DeviceOpenUrl - Open a URL on a remote device."); console.log(" DeviceMessage - Open a message box on a remote device."); console.log(" DeviceToast - Display a toast notification on a remote device."); - console.log(" GroupMessage - Open a message box on remote devices in a specific device group."); - console.log(" GroupToast - Display a toast notification on remote devices in a specific device group."); console.log(" DevicePower - Perform wake/sleep/reset/off operations on remote devices."); console.log(" DeviceSharing - View, add and remove sharing links for a given device."); console.log(" AgentDownload - Download an agent of a specific type for a device group."); - console.log(" Report - Create and show a CSV report."); console.log("\r\nSupported login arguments:"); console.log(" --url [wss://server] - Server url, wss://localhost:443 is default."); console.log(" - Use wss://localhost:443?key=xxx if login key is required."); console.log(" --loginuser [username] - Login username, admin is default."); - console.log(" --loginpass [password] - Login password OR Leave blank to enter password at prompt"); + console.log(" --loginpass [password] - Login password."); console.log(" --token [number] - 2nd factor authentication token."); console.log(" --loginkey [hex] - Server login key in hex."); console.log(" --loginkeyfile [file] - File containing server login key in hex."); @@ -104,30 +97,21 @@ if (args['_'].length == 0) { case 'listdevices': { ok = true; break; } case 'listevents': { ok = true; break; } case 'logintokens': { ok = true; break; } - case 'listusersofdevicegroup': - case 'deviceinfo': - case 'removedevice': + case 'listusersofdevicegroup': { + if (args.id == null) { console.log(winRemoveSingleQuotes("Missing group id, use --id '[groupid]'")); } + else { ok = true; } + break; + } + case 'deviceinfo': { + if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[deviceid]'")); } + else { ok = true; } + break; + } case 'editdevice': { if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[deviceid]'")); } else { ok = true; } break; } - case 'addlocaldevice': { - if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[deviceid]'")); } - else if (args.devicename == null) { console.log(winRemoveSingleQuotes("Missing devicename, use --devicename [devicename]")); } - else if (args.hostname == null) { console.log(winRemoveSingleQuotes("Missing hostname, use --hostname [hostname]")); } - else { ok = true; } - break; - } - case 'addamtdevice': { - if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[deviceid]'")); } - else if (args.devicename == null) { console.log(winRemoveSingleQuotes("Missing devicename, use --devicename [devicename]")); } - else if (args.hostname == null) { console.log(winRemoveSingleQuotes("Missing hostname, use --hostname [hostname]")); } - else if (args.user == null) { console.log(winRemoveSingleQuotes("Missing user, use --user [user]")); } - else if (args.pass == null) { console.log(winRemoveSingleQuotes("Missing pass, use --pass [pass]")); } - else { ok = true; } - break; - } case 'addusertodevicegroup': { if ((args.id == null) && (args.group == null)) { console.log(winRemoveSingleQuotes("Device group identifier missing, use --id '[groupid]' or --group [groupname]")); } else if (args.userid == null) { console.log("Add user to group missing useid, use --userid [userid]"); } @@ -224,7 +208,7 @@ if (args['_'].length == 0) { case 'sendinviteemail': { if ((args.id == null) && (args.group == null)) { console.log("Device group identifier missing, use --id '[groupid]' or --group [groupname]"); } else if (args.email == null) { console.log("Device email is missing, use --email [email]"); } - else { ok = true; } + else { ok = true; } break; } case 'generateinvitelink': { @@ -257,9 +241,10 @@ if (args['_'].length == 0) { } case 'agentdownload': { if (args.type == null) { console.log(winRemoveSingleQuotes("Missing device type, use --type [agenttype]")); } - else if ((parseInt(args.type) == null) || isNaN(parseInt(args.type)) || (parseInt(args.type) < 1) || (parseInt(args.type) > 11000)) { console.log(winRemoveSingleQuotes("Invalid agent type, must be a number.")); } - else if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[meshid]'")); } - else if ((typeof args.id != 'string') || (args.id.length != 64)) { console.log(winRemoveSingleQuotes("Invalid meshid.")); } + var at = parseInt(args.type); + if ((at == null) || isNaN(at) || (at < 1) || (at > 11000)) { console.log(winRemoveSingleQuotes("Invalid agent type, must be a number.")); } + if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[meshid]'")); } + if ((typeof args.id != 'string') || (args.id.length != 64)) { console.log(winRemoveSingleQuotes("Invalid meshid.")); } else { ok = true; } break; } @@ -278,12 +263,6 @@ if (args['_'].length == 0) { else { ok = true; } break; } - case 'webrelay': { - if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[deviceid]'")); } - else if (args.type == null) { console.log(winRemoveSingleQuotes("Missing protocol type, use --type [http,https]")); } - else { ok = true; } - break; - } case 'deviceopenurl': { if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device id, use --id '[deviceid]'")); } else if (args.openurl == null) { console.log("Remote URL, use --openurl [url] specify the link to open."); } @@ -302,23 +281,6 @@ if (args['_'].length == 0) { else { ok = true; } break; } - case 'groupmessage': { - if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device group id, use --id '[devicegroupid]'")); } - else if (args.msg == null) { console.log("Remote message, use --msg \"[message]\" specify a remote message."); } - else { ok = true; } - break; - } - case 'grouptoast': { - if (args.id == null) { console.log(winRemoveSingleQuotes("Missing device group id, use --id '[devicegroupid]'")); } - else if (args.msg == null) { console.log("Remote message, use --msg \"[message]\" specify a remote message."); } - else { ok = true; } - break; - } - case 'report': { - if (args.type == null) { console.log(winRemoveSingleQuotes("Missing report type, use --type '[reporttype]'")); } - else { ok = true; } - break; - } case 'help': { if (args['_'].length < 2) { console.log("Get help on an action. Type:\r\n\r\n help [action]\r\n\r\nPossible actions are: " + possibleCommands.join(', ') + '.'); @@ -342,7 +304,7 @@ if (args['_'].length == 0) { console.log(" --email [email] - Email address."); console.log("\r\nOptional arguments:\r\n"); console.log(" --name (name) - Name of recipient to be included in the email."); - console.log(" --message (msg) - Message to be included in the email."); + console.log(" --message (msg) - Message to be included in the email."); break; } case 'generateinvitelink': { @@ -356,7 +318,7 @@ if (args['_'].length == 0) { console.log(" --id '[groupid]' - Device group identifier (or --group)."); } console.log(" --group [groupname] - Device group name (or --id)."); - console.log(" --hours [hours] - Validity period in hours or 0 for infinite."); + console.log(" --hours [hours] - Validity period in hours or 0 for infinit."); console.log("\r\nOptional arguments:\r\n"); console.log(" --flags [mode] - Mode flag for link type (0 = both, 1 = interactive only, 2 = background only)"); break; @@ -436,7 +398,7 @@ if (args['_'].length == 0) { console.log(" --group [groupname] - Filter by group name (or --id)."); console.log(" --count - Only return the device count."); console.log(" --json - Show result as JSON."); - console.log(" --csv - Show result as comma separated values."); + console.log(" --csv - Show result as comma seperated values."); console.log(" --filter \"[filter]\" - Filter devices using a filter string."); console.log(" \"x\" - Devices with \"x\" in the name."); console.log(" \"user:x or u:x\" - Devices with \"x\" in the name of currently logged in user."); @@ -507,8 +469,8 @@ if (args['_'].length == 0) { console.log(" --resetpass - Request password reset on next login."); console.log(" --realname [name] - Set the real name for this account."); console.log(" --phone [number] - Set the account phone number."); - console.log(" --rights [none|full|a,b,c] - Comma separated list of server permissions. Possible values:"); - console.log(" manageusers,serverbackup,serverrestore,serverupdate,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents,nonewdevices"); + console.log(" --rights [none|full|a,b,c] - Comma seperated list of server permissions. Possible values:"); + console.log(" manageusers,backup,restore,update,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents"); break; } case 'edituser': { @@ -524,8 +486,8 @@ if (args['_'].length == 0) { console.log(" --resetpass - Request password reset on next login."); console.log(" --realname [name] - Set the real name for this account."); console.log(" --phone [number] - Set the account phone number."); - console.log(" --rights [none|full|a,b,c] - Comma separated list of server permissions. Possible values:"); - console.log(" manageusers,serverbackup,serverrestore,serverupdate,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents,nonewdevices"); + console.log(" --rights [none|full|a,b,c] - Comma seperated list of server permissions. Possible values:"); + console.log(" manageusers,backup,restore,update,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents"); break; } case 'removeuser': { @@ -617,7 +579,6 @@ if (args['_'].length == 0) { console.log("\r\nOptional arguments:\r\n"); console.log(" --desc [description] - New group description."); console.log(" --amtonly - New group is agent-less, Intel AMT only."); - console.log(" --agentless - New group is agent-less only."); console.log(" --features [number] - Set device group features, sum of numbers below."); console.log(" 1 = Auto-Remove 2 = Hostname Sync"); console.log(" 4 = Record Sessions"); @@ -666,7 +627,7 @@ if (args['_'].length == 0) { console.log(" 16 = Terminal prompt for user consent."); console.log(" 32 = Files prompt for user consent."); console.log(" 64 = Desktop show connection toolbar."); - console.log(" --invitecodes [aa,bb] - Comma separated list of invite codes, blank to clear."); + console.log(" --invitecodes [aa,bb] - Comma seperated list of invite codes, blank to clear."); console.log(" --backgroundonly - When used with invitecodes, set agent to only install in background."); console.log(" --interactiveonly - When used with invitecodes, set agent to only run on demand."); break; @@ -784,7 +745,7 @@ if (args['_'].length == 0) { console.log("\r\nRequired arguments:\r\n"); console.log(" --msg [message] - Message to display."); console.log("\r\nOptional arguments:\r\n"); - console.log(" --user [userid] - Send the message to the specified user."); + console.log(" --user [userid] - Send the message to the speficied user."); break; } case 'deviceinfo': { @@ -802,66 +763,6 @@ if (args['_'].length == 0) { console.log(" --json - Give results in JSON format."); break; } - case 'removedevice': { - console.log("Delete a device, Example usages:\r\n"); - console.log(winRemoveSingleQuotes(" MeshCtrl RemoveDevice --id 'deviceid'")); - console.log("\r\nRequired arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --id [deviceid] - The device identifier."); - } else { - console.log(" --id '[deviceid]' - The device identifier."); - } - break; - } - case 'addlocaldevice': { - console.log("Add a Local Device, Example usages:\r\n"); - console.log(winRemoveSingleQuotes(" MeshCtrl AddLocalDevice --id 'meshid' --devicename 'devicename' --hostname 'hostname'")); - console.log(winRemoveSingleQuotes(" MeshCtrl AddLocalDevice --id 'meshid' --devicename 'devicename' --hostname 'hostname' --type 6")); - console.log("\r\nRequired arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --id [meshid] - The mesh identifier."); - console.log(" --devicename [devicename] - The device name."); - console.log(" --hostname [hostname] - The devices hostname or ip address."); - } else { - console.log(" --id '[meshid]' - The mesh identifier."); - console.log(" --devicename '[devicename]' - The device name."); - console.log(" --hostname '[hostname]' - The devices hostname or ip address."); - } - - console.log("\r\nOptional arguments:\r\n"); - console.log(" --type [TypeNumber] - With the following choices:"); - console.log(" type 4 - Default, Windows (RDP)"); - console.log(" type 6 - Linux (SSH/SCP/VNC)"); - console.log(" type 29 - macOS (SSH/SCP/VNC)"); - break; - } - case 'addamtdevice': { - console.log("Add an Intel AMT Device, Example usages:\r\n"); - console.log(winRemoveSingleQuotes(" MeshCtrl AddAmtDevice --id 'meshid' --devicename 'devicename' --hostname 'hostname --user 'admin' --pass 'admin'")); - console.log(winRemoveSingleQuotes(" MeshCtrl AddAmtDevice --id 'meshid' --devicename 'devicename' --hostname 'hostname --user 'admin' --pass 'admin' --notls")); - console.log("\r\nRequired arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --id [meshid] - The mesh identifier."); - console.log(" --devicename [devicename] - The device name."); - console.log(" --hostname [hostname] - The devices hostname or ip address."); - console.log(" --user [user] - The devices AMT username."); - console.log(" --pass [pass] - The devices AMT password."); - console.log("") - } else { - console.log(" --id '[meshid]' - The mesh identifier."); - console.log(" --devicename '[devicename]' - The device name."); - console.log(" --hostname '[hostname]' - The devices hostname or ip address."); - console.log(" --user '[user]' - The devices AMT username."); - console.log(" --pass '[pass]' - The devices AMT password."); - } - console.log("\r\nOptional arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --notls - Use No TLS Security."); - } else { - console.log(" --notls - Use No TLS Security."); - } - break; - } case 'editdevice': { console.log("Change information about a device, Example usages:\r\n"); console.log(winRemoveSingleQuotes(" MeshCtrl EditDevice --id 'deviceid' --name 'device1'")); @@ -893,7 +794,6 @@ if (args['_'].length == 0) { console.log("Run a shell command on a remote device, Example usages:\r\n"); console.log(winRemoveSingleQuotes(" MeshCtrl RunCommand --id 'deviceid' --run \"command\"")); console.log(winRemoveSingleQuotes(" MeshCtrl RunCommand --id 'deviceid' --run \"command\" --powershell")); - console.log(winRemoveSingleQuotes(" MeshCtrl RunCommand --id 'deviceid' --run \"command\" --reply")); console.log("\r\nRequired arguments:\r\n"); if (process.platform == 'win32') { console.log(" --id [deviceid] - The device identifier."); @@ -905,7 +805,6 @@ if (args['_'].length == 0) { console.log(" --powershell - Run in Windows PowerShell."); console.log(" --runasuser - Attempt to run the command as logged in user."); console.log(" --runasuseronly - Only run the command as the logged in user."); - console.log(" --reply - Return with the output from running the command."); break; } case 'shell': { @@ -954,7 +853,6 @@ if (args['_'].length == 0) { console.log(winRemoveSingleQuotes(" MeshCtrl DeviceSharing --id 'deviceid' --add Guest --start " + localISOTime + " --duration 30")); console.log(winRemoveSingleQuotes(" MeshCtrl DeviceSharing --id 'deviceid' --add Guest --start " + localISOTime + " --duration 30 --daily")); console.log(winRemoveSingleQuotes(" MeshCtrl DeviceSharing --id 'deviceid' --add Guest --type desktop,terminal --consent prompt")); - console.log(winRemoveSingleQuotes(" MeshCtrl DeviceSharing --id 'deviceid' --add Guest --type http --port 80")); console.log("\r\nRequired arguments:\r\n"); if (process.platform == 'win32') { console.log(" --id [deviceid] - The device identifier."); @@ -962,23 +860,21 @@ if (args['_'].length == 0) { console.log(" --id '[deviceid]' - The device identifier."); } console.log("\r\nOptional arguments:\r\n"); - console.log(" --remove [shareid] - Remove a device sharing link."); - console.log(" --add [guestname] - Add a device sharing link."); - console.log(" --type [desktop,terminal,files,http,https] - Type of sharing to add, can be combined. default is desktop."); - console.log(" --viewonly - Make desktop sharing view only."); - console.log(" --consent [notify,prompt,none] - Consent flags, default is notify."); - console.log(" --start [yyyy-mm-ddThh:mm:ss] - Start time, default is now."); - console.log(" --end [yyyy-mm-ddThh:mm:ss] - End time."); - console.log(" --duration [minutes] - Duration of the share, default is 60 minutes."); - console.log(" --daily - Add recurring daily device share."); - console.log(" --weekly - Add recurring weekly device share."); - console.log(" --port [portnumber] - Set alternative port for http or https, default is 80 for http and 443 for https."); + console.log(" --remove [shareid] - Remove a device sharing link."); + console.log(" --add [guestname] - Add a device sharing link."); + console.log(" --type [desktop,terminal,files] - Type of sharing to add, can be combined. default is desktop."); + console.log(" --viewonly - Make desktop sharing view only."); + console.log(" --consent [notify,prompt] - Consent flags, default is notify."); + console.log(" --start [yyyy-mm-ddThh:mm:ss] - Start time, default is now."); + console.log(" --end [yyyy-mm-ddThh:mm:ss] - End time."); + console.log(" --duration [minutes] - Duration of the share, default is 60 minutes."); + console.log(" --daily - Add recurring daily device share."); + console.log(" --weekly - Add recurring weekly device share."); break; } case 'agentdownload': { console.log("Download an agent of a specific type for a given device group, Example usages:\r\n"); console.log(winRemoveSingleQuotes(" MeshCtrl AgentDownload --id 'groupid' --type 3")); - console.log(winRemoveSingleQuotes(" MeshCtrl AgentDownload --id 'groupid' --type 3 --installflags 1")); console.log("\r\nRequired arguments:\r\n"); console.log(" --type [ArchitectureNumber] - Agent architecture number."); if (process.platform == 'win32') { @@ -986,11 +882,6 @@ if (args['_'].length == 0) { } else { console.log(" --id '[groupid]' - The device group identifier."); } - console.log("\r\nOptional arguments:\r\n"); - console.log(" --installflags [InstallFlagsNumber] - With the following choices:"); - console.log(" installflags 0 - Default, Interactive & Background, offers connect button & install/uninstall"); - console.log(" installflags 1 - Interactive only, offers only connect button, not install/uninstall"); - console.log(" installflags 2 - Background only, offers only install/uninstall, not connect"); break; } case 'upload': { @@ -1022,21 +913,6 @@ if (args['_'].length == 0) { console.log(" --target [localpath] - The local path to download the file to."); break; } - case 'webrelay': { - console.log("Generate a webrelay URL to access a HTTP/HTTPS service on a remote device, Example usages:\r\n"); - console.log(winRemoveSingleQuotes(" MeshCtrl WebRelay --id 'deviceid' --type http --port 80")); - console.log(winRemoveSingleQuotes(" MeshCtrl WebRelay --id 'deviceid' --type https --port 443")); - console.log("\r\nRequired arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --id [deviceid] - The device identifier."); - } else { - console.log(" --id '[deviceid]' - The device identifier."); - } - console.log(" --type [http,https] - Type of relay from remote device, http or https."); - console.log("\r\nOptional arguments:\r\n"); - console.log(" --port [portnumber] - Set alternative port for http or https, default is 80 for http and 443 for https."); - break; - } case 'deviceopenurl': { console.log("Open a web page on a remote device, Example usages:\r\n"); console.log(winRemoveSingleQuotes(" MeshCtrl DeviceOpenUrl --id 'deviceid' --openurl http://meshcentral.com")); @@ -1053,17 +929,15 @@ if (args['_'].length == 0) { console.log("Display a message on the remote device, Example usages:\r\n"); console.log(winRemoveSingleQuotes(" MeshCtrl DeviceMessage --id 'deviceid' --msg \"message\"")); console.log(winRemoveSingleQuotes(" MeshCtrl DeviceMessage --id 'deviceid' --msg \"message\" --title \"title\"")); - console.log(winRemoveSingleQuotes(" MeshCtrl DeviceMessage --id 'deviceid' --msg \"message\" --title \"title\" --timeout 120000")); console.log("\r\nRequired arguments:\r\n"); if (process.platform == 'win32') { - console.log(" --id [deviceid] - The device identifier."); + console.log(" --id [deviceid] - The device identifier."); } else { - console.log(" --id '[deviceid]' - The device identifier."); + console.log(" --id '[deviceid]' - The device identifier."); } - console.log(" --msg [message] - The message to display."); + console.log(" --msg [message] - The message to display."); console.log("\r\nOptional arguments:\r\n"); - console.log(" --title [title] - Messagebox title, default is \"MeshCentral\"."); - console.log(" --timeout [miliseconds] - After timeout messagebox vanishes, 0 keeps messagebox open until closed manually, default is 120000 (2 Minutes)."); + console.log(" --title [title] - Messagebox title, default is \"MeshCentral\"."); break; } case 'devicetoast': { @@ -1081,52 +955,6 @@ if (args['_'].length == 0) { console.log(" --title [title] - Toast title, default is \"MeshCentral\"."); break; } - case 'groupmessage': { - console.log("Open a message box on remote devices in a specific device group, Example usages:\r\n"); - console.log(winRemoveSingleQuotes(" MeshCtrl GroupMessage --id 'devicegroupid' --msg \"message\"")); - console.log(winRemoveSingleQuotes(" MeshCtrl GroupMessage --id 'devicegroupid' --msg \"message\" --title \"title\"")); - console.log(winRemoveSingleQuotes(" MeshCtrl GroupMessage --id 'devicegroupid' --msg \"message\" --title \"title\" --timeout 120000")); - console.log("\r\nRequired arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --id [devicegroupid] - The device identifier."); - } else { - console.log(" --id '[devicegroupid]' - The device identifier."); - } - console.log(" --msg [message] - The message to display."); - console.log("\r\nOptional arguments:\r\n"); - console.log(" --title [title] - Messagebox title, default is \"MeshCentral\"."); - console.log(" --timeout [miliseconds] - After timeout messagebox vanishes, 0 keeps messagebox open until closed manually, default is 120000 (2 Minutes)."); - break; - } - case 'grouptoast': { - console.log("Display a toast notification on remote devices in a specific device group, Example usages:\r\n"); - console.log(winRemoveSingleQuotes(" MeshCtrl GroupToast --id 'devicegroupid' --msg \"message\"")); - console.log(winRemoveSingleQuotes(" MeshCtrl GroupToast --id 'devicegroupid' --msg \"message\" --title \"title\"")); - console.log("\r\nRequired arguments:\r\n"); - if (process.platform == 'win32') { - console.log(" --id [devicegroupid] - The device identifier."); - } else { - console.log(" --id '[devicegroupid]' - The device identifier."); - } - console.log(" --msg [message] - The message to display."); - console.log("\r\nOptional arguments:\r\n"); - console.log(" --title [title] - Toast title, default is \"MeshCentral\"."); - break; - } - case 'report': { - console.log("Generate a CSV report, Example usages:\r\n"); - console.log(" MeshCtrl Report --type sessions --devicegroup mesh//..."); - console.log(" MeshCtrl Report --type traffic --json"); - console.log(" MeshCtrl Report --type logins --groupby day"); - console.log(" MeshCtrl Report --type db"); - console.log("\r\nOptional arguments:\r\n"); - console.log(" --start [yyyy-mm-ddThh:mm:ss] - Filter the results starting at that date. Defaults to last 24h and last week when used with --groupby day. Usable with sessions, traffic and logins"); - console.log(" --end [yyyy-mm-ddThh:mm:ss] - Filter the results ending at that date. Defaults to now. Usable with sessions, traffic and logins"); - console.log(" --groupby [name] - How to group results. Options: user, day, device. Defaults to user. User and day usable in sessions and logins, device usable in sessions."); - console.log(" --devicegroup [devicegroupid] - Filter the results by device group. Usable in sessions"); - console.log(" --showtraffic - Add traffic data in sessions report"); - break; - } default: { console.log("Get help on an action. Type:\r\n\r\n help [action]\r\n\r\nPossible actions are: " + possibleCommands.join(', ') + '.'); } @@ -1136,46 +964,7 @@ if (args['_'].length == 0) { } } - if (ok) { - if(args.loginpass===true){ - const readline = require('readline'); - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - terminal: false - }); - process.stdout.write('Enter your password: '); - const stdin = process.openStdin(); - stdin.setRawMode(true); // Set raw mode to prevent echoing of characters - stdin.resume(); - args.loginpass = ''; - process.stdin.on('data', (char) => { - char = char + ''; - switch (char) { - case '\n': - case '\r': - case '\u0004': // They've finished entering their password - stdin.setRawMode(false); - stdin.pause(); - process.stdout.clearLine(); process.stdout.cursorTo(0); - rl.close(); - serverConnect(); - break; - case '\u0003': // Ctrl+C - process.stdout.write('\n'); - process.exit(); - break; - default: // Mask the password with "*" - args.loginpass += char; - process.stdout.clearLine(); process.stdout.cursorTo(0); - process.stdout.write('Enter your password: ' + '*'.repeat(args.loginpass.length)); - break; - } - }); - }else{ - serverConnect(); - } - } + if (ok) { serverConnect(); } } function displayConfigHelp() { @@ -1196,8 +985,8 @@ function displayConfigHelp() { function performConfigOperations(args) { var domainValues = ['title', 'title2', 'titlepicture', 'trustedcert', 'welcomepicture', 'welcometext', 'userquota', 'meshquota', 'newaccounts', 'usernameisemail', 'newaccountemaildomains', 'newaccountspass', 'newaccountsrights', 'geolocation', 'lockagentdownload', 'userconsentflags', 'Usersessionidletimeout', 'auth', 'ldapoptions', 'ldapusername', 'ldapuserbinarykey', 'ldapuseremail', 'footer', 'certurl', 'loginKey', 'userallowedip', 'agentallowedip', 'agentnoproxy', 'agentconfig', 'orphanagentuser', 'httpheaders', 'yubikey', 'passwordrequirements', 'limits', 'amtacmactivation', 'redirects', 'sessionrecording', 'hide']; - var domainObjectValues = ['ldapoptions', 'httpheaders', 'yubikey', 'passwordrequirements', 'limits', 'amtacmactivation', 'redirects', 'sessionrecording']; - var domainArrayValues = ['newaccountemaildomains', 'newaccountsrights', 'loginkey', 'agentconfig']; + var domainObjectValues = [ 'ldapoptions', 'httpheaders', 'yubikey', 'passwordrequirements', 'limits', 'amtacmactivation', 'redirects', 'sessionrecording' ]; + var domainArrayValues = [ 'newaccountemaildomains', 'newaccountsrights', 'loginkey', 'agentconfig' ]; var configChange = false; var fs = require('fs'); var path = require('path'); @@ -1211,7 +1000,7 @@ function performConfigOperations(args) { if (fs.existsSync(configFile) == false) { console.log("Unable to find config.json."); return; } var config = null; try { config = fs.readFileSync(configFile).toString('utf8'); } catch (ex) { console.log("Error: Unable to read config.json"); return; } - try { config = JSON.parse(fs.readFileSync(configFile)); } catch (e) { console.log('ERROR: Unable to parse ' + configFile + '.'); return null; } + try { config = require(configFile); } catch (e) { console.log('ERROR: Unable to parse ' + configFilePath + '.'); return null; } if (args.adddomain != null) { didSomething++; if (config.domains == null) { config.domains = {}; } @@ -1359,10 +1148,10 @@ function serverConnect() { var domainid = '', username = 'admin'; if (args.logindomain != null) { domainid = args.logindomain; } if (args.loginuser != null) { username = args.loginuser; } - url += (url.indexOf('?key=') >= 0 ? '&auth=' : '?auth=') + encodeCookie({ userid: 'user/' + domainid + '/' + username, domainid: domainid }, ckey); + url += '?auth=' + encodeCookie({ userid: 'user/' + domainid + '/' + username, domainid: domainid }, ckey); } else { if (args.logindomain != null) { console.log("--logindomain can only be used along with --loginkey."); process.exit(); return; } - if (loginCookie != null) { url += (url.indexOf('?key=') >= 0 ? '&auth=' : '?auth=') + loginCookie; } + if (loginCookie != null) { url += '?auth=' + loginCookie; } } const ws = new WebSocket(url, options); @@ -1382,7 +1171,7 @@ function serverConnect() { case 'listdevices': { if (args.details) { // Get list of devices with lots of details - ws.send(JSON.stringify({ action: 'getDeviceDetails', type: (args.csv) ? 'csv' : 'json' })); + ws.send(JSON.stringify({ action: 'getDeviceDetails', type: (args.csv)?'csv':'json' })); } else if (args.group) { ws.send(JSON.stringify({ action: 'nodes', meshname: args.group, responseid: 'meshctrl' })); } else if (args.id) { @@ -1395,7 +1184,7 @@ function serverConnect() { } case 'listevents': { limit = null; - if (args.limit) { limit = parseInt(args.limit); } + if (args.limit) { limit = parseInt(args.limit); } if ((typeof limit != 'number') || (limit < 1)) { limit = null; } var cmd = null; @@ -1567,7 +1356,6 @@ function serverConnect() { var op = { action: 'createmesh', meshname: args.name, meshtype: 2, responseid: 'meshctrl' }; if (args.desc) { op.desc = args.desc; } if (args.amtonly) { op.meshtype = 1; } - if (args.agentless) { op.meshtype = 3; } if (args.features) { op.flags = parseInt(args.features); } if (args.consent) { op.consent = parseInt(args.consent); } ws.send(JSON.stringify(op)); @@ -1579,29 +1367,6 @@ function serverConnect() { ws.send(JSON.stringify(op)); break; } - case 'addamtdevice': { - var op = { action: 'addamtdevice', amttls: 1, responseid: 'meshctrl' }; - if (args.id) { op.meshid = args.id; } - if ((typeof args.devicename == 'string') && (args.devicename != '')) { op.devicename = args.devicename; } - if ((typeof args.hostname == 'string') && (args.hostname != '')) { op.hostname = args.hostname; } - if ((typeof args.user == 'string') && (args.user != '')) { op.amtusername = args.user; } - if ((typeof args.pass == 'string') && (args.pass != '')) { op.amtpassword = args.pass; } - if (args.notls) { op.amttls = 0; } - ws.send(JSON.stringify(op)); - break; - } - case 'addlocaldevice': { - var op = { action: 'addlocaldevice', type: 4, responseid: 'meshctrl' }; - if (args.id) { op.meshid = args.id; } - if ((typeof args.devicename == 'string') && (args.devicename != '')) { op.devicename = args.devicename; } - if ((typeof args.hostname == 'string') && (args.hostname != '')) { op.hostname = args.hostname; } - if (args.type) { - if ((typeof parseInt(args.type) != 'number') || isNaN(parseInt(args.type))) { console.log("Invalid type."); process.exit(1); return; } - op.type = args.type; - } - ws.send(JSON.stringify(op)); - break; - } case 'editdevicegroup': { var op = { action: 'editmesh', responseid: 'meshctrl' }; if (args.id) { op.meshid = args.id; } else if (args.group) { op.meshidname = args.group; } @@ -1628,7 +1393,7 @@ function serverConnect() { break; } case 'movetodevicegroup': { - var op = { action: 'changeDeviceMesh', responseid: 'meshctrl', nodeids: [args.devid] }; + var op = { action: 'changeDeviceMesh', responseid: 'meshctrl', nodeids: [ args.devid ] }; if (args.id) { op.meshid = args.id; } else if (args.group) { op.meshname = args.group; } ws.send(JSON.stringify(op)); break; @@ -1721,11 +1486,6 @@ function serverConnect() { ws.send(JSON.stringify({ action: 'getsysinfo', nodeid: args.id, nodeinfo: true, responseid: 'meshctrl' })); break; } - case 'removedevice': { - var op = { action: 'removedevices', nodeids: [ args.id ], responseid: 'meshctrl' }; - ws.send(JSON.stringify(op)); - break; - } case 'editdevice': { var op = { action: 'changedevice', nodeid: args.id, responseid: 'meshctrl' }; if (typeof args.name == 'string') { op.name = args.name; } @@ -1740,9 +1500,7 @@ function serverConnect() { case 'runcommand': { var runAsUser = 0; if (args.runasuser) { runAsUser = 1; } else if (args.runasuseronly) { runAsUser = 2; } - var reply = false; - if (args.reply) { reply = true; } - ws.send(JSON.stringify({ action: 'runcommands', nodeids: [args.id], type: ((args.powershell) ? 2 : 0), cmds: args.run, responseid: 'meshctrl', runAsUser: runAsUser, reply: reply })); + ws.send(JSON.stringify({ action: 'runcommands', nodeids: [args.id], type: ((args.powershell) ? 2 : 0), cmds: args.run, responseid: 'meshctrl', runAsUser: runAsUser })); break; } case 'shell': @@ -1785,10 +1543,6 @@ function serverConnect() { var u = settings.xxurl.replace('wss://', 'https://').replace('/control.ashx', '/meshagents'); if (u.indexOf('?') > 0) { u += '&'; } else { u += '?'; } u += 'id=' + args.type + '&meshid=' + args.id; - if (args.installflags) { - if ((typeof parseInt(args.installflags) != 'number') || isNaN(parseInt(args.installflags)) || (parseInt(args.installflags) < 0) || (parseInt(args.installflags) > 2)) { console.log("Invalid Installflags."); process.exit(1); return; } - u += '&installflags=' + args.installflags; - } const options = { rejectUnauthorized: false, checkServerIdentity: onVerifyServer } const fs = require('fs'); const https = require('https'); @@ -1826,29 +1580,6 @@ function serverConnect() { req.end() break; } - case 'webrelay': { - var protocol = null; - if (args.type != null) { - if (args.type == 'http') { - protocol = 1; - } else if (args.type == 'https') { - protocol = 2; - } else { - console.log("Unknown protocol type: " + args.type); process.exit(1); - } - } - var port = null; - if (typeof args.port == 'number') { - if ((args.port < 1) || (args.port > 65535)) { console.log("Port number must be between 1 and 65535."); process.exit(1); } - port = args.port; - } else if (protocol == 1) { - port = 80; - } else if (protocol == 2) { - port = 443; - } - ws.send(JSON.stringify({ action: 'webrelay', nodeid: args.id, port: port, appid: protocol, responseid: 'meshctrl' })); - break; - } case 'devicesharing': { if (args.add) { if (args.add.length == 0) { console.log("Invalid guest name."); process.exit(1); } @@ -1857,12 +1588,10 @@ function serverConnect() { var p = 0; if (args.type != null) { var shareTypes = args.type.toLowerCase().split(','); - for (var i in shareTypes) { if ((shareTypes[i] != 'terminal') && (shareTypes[i] != 'desktop') && (shareTypes[i] != 'files') && (shareTypes[i] != 'http') && (shareTypes[i] != 'https')) { console.log("Unknown sharing type: " + shareTypes[i]); process.exit(1); } } + for (var i in shareTypes) { if ((shareTypes[i] != 'terminal') && (shareTypes[i] != 'desktop') && (shareTypes[i] != 'files')) { console.log("Unknown sharing type: " + shareTypes[i]); process.exit(1); } } if (shareTypes.indexOf('terminal') >= 0) { p |= 1; } if (shareTypes.indexOf('desktop') >= 0) { p |= 2; } if (shareTypes.indexOf('files') >= 0) { p |= 4; } - if (shareTypes.indexOf('http') >= 0) { p |= 8; } - if (shareTypes.indexOf('https') >= 0) { p |= 16; } } if (p == 0) { p = 2; } // Desktop @@ -1897,19 +1626,6 @@ function serverConnect() { } } - var port = null; - // Set Port Number if http or https - if ((p & 8) || (p & 16)) { - if (typeof args.port == 'number') { - if ((args.port < 1) || (args.port > 65535)) { console.log("Port number must be between 1 and 65535."); process.exit(1); } - port = args.port; - } else if ((p & 8)) { - port = 80; - } else if ((p & 16)) { - port = 443; - } - } - // Start and end time var start = null, end = null; if (args.start) { start = Math.floor(Date.parse(args.start) / 1000); end = start + (60 * 60); } @@ -1926,14 +1642,14 @@ function serverConnect() { if ((typeof args.duration != 'number') || (args.duration < 1)) { console.log("Invalid duration value."); process.exit(1); return; } // Recurring sharing - ws.send(JSON.stringify({ action: 'createDeviceShareLink', nodeid: args.id, guestname: args.add, p: p, consent: consent, start: start, expire: args.duration, recurring: recurring, viewOnly: viewOnly, port: port, responseid: 'meshctrl' })); + ws.send(JSON.stringify({ action: 'createDeviceShareLink', nodeid: args.id, guestname: args.add, p: p, consent: consent, start: start, expire: args.duration, recurring: recurring, viewOnly: viewOnly, responseid: 'meshctrl' })); } else { if ((start == null) && (end == null)) { // Unlimited sharing - ws.send(JSON.stringify({ action: 'createDeviceShareLink', nodeid: args.id, guestname: args.add, p: p, consent: consent, expire: 0, viewOnly: viewOnly, port: port, responseid: 'meshctrl' })); + ws.send(JSON.stringify({ action: 'createDeviceShareLink', nodeid: args.id, guestname: args.add, p: p, consent: consent, expire: 0, viewOnly: viewOnly, responseid: 'meshctrl' })); } else { // Time limited sharing - ws.send(JSON.stringify({ action: 'createDeviceShareLink', nodeid: args.id, guestname: args.add, p: p, consent: consent, start: start, end: end, viewOnly: viewOnly, port: port, responseid: 'meshctrl' })); + ws.send(JSON.stringify({ action: 'createDeviceShareLink', nodeid: args.id, guestname: args.add, p: p, consent: consent, start: start, end: end, viewOnly: viewOnly, responseid: 'meshctrl' })); } } } else if (args.remove) { @@ -1948,56 +1664,13 @@ function serverConnect() { break; } case 'devicemessage': { - ws.send(JSON.stringify({ action: 'msg', type: 'messagebox', nodeid: args.id, title: args.title ? args.title : "MeshCentral", msg: args.msg, timeout: args.timeout ? args.timeout : 120000, responseid: 'meshctrl' })); + ws.send(JSON.stringify({ action: 'msg', type: 'messagebox', nodeid: args.id, title: args.title ? args.title : "MeshCentral", msg: args.msg, responseid: 'meshctrl' })); break; } case 'devicetoast': { ws.send(JSON.stringify({ action: 'toast', nodeids: [args.id], title: args.title ? args.title : "MeshCentral", msg: args.msg, responseid: 'meshctrl' })); break; } - case 'groupmessage': { - ws.send(JSON.stringify({ action: 'nodes', meshid: args.id, responseid: 'meshctrl' })); - break; - } - case 'grouptoast': { - ws.send(JSON.stringify({ action: 'nodes', meshid: args.id, responseid: 'meshctrl' })); - break; - } - case 'report': { - var reporttype = 1; - switch(args.type) { - case 'traffic': - reporttype = 2; - break; - case 'logins': - reporttype = 3; - break; - case 'db': - reporttype = 4; - break; - } - - var reportgroupby = 1; - if(args.groupby){ - reportgroupby = args.groupby === 'device' ? 2 : args.groupby === 'day' ? 3: 1; - } - - var start = null, end = null; - if (args.start) { - start = Math.floor(Date.parse(args.start) / 1000); - } else { - start = reportgroupby === 3 ? Math.round(new Date().getTime() / 1000) - (168 * 3600) : Math.round(new Date().getTime() / 1000) - (24 * 3600); - } - if (args.end) { - end = Math.floor(Date.parse(args.end) / 1000); - } else { - end = Math.round(new Date().getTime() / 1000); - } - if (end <= start) { console.log("End time must be ahead of start time."); process.exit(1); return; } - - ws.send(JSON.stringify({ action: 'report', type: reporttype, groupBy: reportgroupby, devGroup: args.devicegroup || null, start, end, tz: Intl.DateTimeFormat().resolvedOptions().timeZone, tf: new Date().getTimezoneOffset(), showTraffic: args.hasOwnProperty('showtraffic'), l: 'en', responseid: 'meshctrl' })); - break; - } } }); @@ -2010,11 +1683,11 @@ function serverConnect() { var srights = args.rights.toLowerCase().split(','); if (srights.indexOf('full') != -1) { siteadmin = 0xFFFFFFFF; } if (srights.indexOf('none') != -1) { siteadmin = 0x00000000; } - if (srights.indexOf('backup') != -1 || srights.indexOf('serverbackup') != -1) { siteadmin |= 0x00000001; } + if (srights.indexOf('backup') != -1) { siteadmin |= 0x00000001; } if (srights.indexOf('manageusers') != -1) { siteadmin |= 0x00000002; } - if (srights.indexOf('restore') != -1 || srights.indexOf('serverrestore') != -1) { siteadmin |= 0x00000004; } + if (srights.indexOf('restore') != -1) { siteadmin |= 0x00000004; } if (srights.indexOf('fileaccess') != -1) { siteadmin |= 0x00000008; } - if (srights.indexOf('update') != -1 || srights.indexOf('serverupdate') != -1) { siteadmin |= 0x00000010; } + if (srights.indexOf('update') != -1) { siteadmin |= 0x00000010; } if (srights.indexOf('locked') != -1) { siteadmin |= 0x00000020; } if (srights.indexOf('nonewgroups') != -1) { siteadmin |= 0x00000040; } if (srights.indexOf('notools') != -1) { siteadmin |= 0x00000080; } @@ -2022,7 +1695,6 @@ function serverConnect() { if (srights.indexOf('recordings') != -1) { siteadmin |= 0x00000200; } if (srights.indexOf('locksettings') != -1) { siteadmin |= 0x00000400; } if (srights.indexOf('allevents') != -1) { siteadmin |= 0x00000800; } - if (srights.indexOf('nonewdevices') != -1) { siteadmin |= 0x00001000; } } if (args.siteadmin) { siteadmin = 0xFFFFFFFF; } @@ -2035,7 +1707,7 @@ function serverConnect() { return siteadmin; } - ws.on('close', function () { process.exit(); }); + ws.on('close', function() { process.exit(); }); ws.on('error', function (err) { if (err.code == 'ENOTFOUND') { console.log('Unable to resolve ' + url); } else if (err.code == 'ECONNREFUSED') { console.log('Unable to connect to ' + url); } @@ -2219,9 +1891,6 @@ function serverConnect() { case 'toast': // TOAST case 'adduser': // ADDUSER case 'edituser': // EDITUSER - case 'addamtdevice': // ADDAMTDEVICE - case 'addlocaldevice': // ADDLOCALDEVICE - case 'removedevices': // REMOVEDEVICE case 'changedevice': // EDITDEVICE case 'deleteuser': // REMOVEUSER case 'createmesh': // ADDDEVICEGROUP @@ -2243,7 +1912,6 @@ function serverConnect() { case 'removeDeviceShare': case 'userbroadcast': { // BROADCAST if ((settings.cmd == 'shell') || (settings.cmd == 'upload') || (settings.cmd == 'download')) return; - if ((data.type == 'runcommands') && (settings.cmd != 'runcommand')) return; if ((settings.multiresponse != null) && (settings.multiresponse > 1)) { settings.multiresponse--; break; } if (data.responseid == 'meshctrl') { if (data.meshid) { console.log(data.result, data.meshid); } @@ -2254,7 +1922,6 @@ function serverConnect() { break; } case 'createDeviceShareLink': - case 'webrelay': if (data.result == 'OK') { if (data.publicid) { console.log('ID: ' + data.publicid); } console.log('URL: ' + data.url); @@ -2290,11 +1957,11 @@ function serverConnect() { console.log(x); var mesh = [], user = [], node = []; if (data.ugroups[i].links != null) { for (var j in data.ugroups[i].links) { if (j.startsWith('mesh/')) { mesh.push(j); } if (j.startsWith('user/')) { user.push(j); } if (j.startsWith('node/')) { node.push(j); } } } - console.log(' Users:'); + console.log(' Users:'); if (user.length > 0) { for (var j in user) { console.log(' ' + user[j]); } } else { console.log(' (None)'); } - console.log(' Device Groups:'); + console.log(' Device Groups:'); if (mesh.length > 0) { for (var j in mesh) { console.log(' ' + mesh[j] + ', ' + data.ugroups[i].links[mesh[j]].rights); } } else { console.log(' (None)'); } - console.log(' Devices:'); + console.log(' Devices:'); if (node.length > 0) { for (var j in node) { console.log(' ' + node[j] + ', ' + data.ugroups[i].links[node[j]].rights); } } else { console.log(' (None)'); } } } @@ -2389,7 +2056,7 @@ function serverConnect() { if (args.filter != null) { for (var meshid in data.nodes) { for (var d in data.nodes[meshid]) { data.nodes[meshid][d].meshid = meshid; } - data.nodes[meshid] = parseSearchOrInput(data.nodes[meshid], args.filter.toString().toLowerCase()); + data.nodes[meshid] = parseSearchOrInput(data.nodes[meshid], args.filter.toLowerCase()); } } @@ -2417,7 +2084,7 @@ function serverConnect() { } else if (args.json) { // Return all devices in JSON format var nodes = []; - + for (var i in data.nodes) { const devicesInMesh = data.nodes[i]; for (var j in devicesInMesh) { @@ -2447,30 +2114,6 @@ function serverConnect() { } process.exit(); } - if ((settings.cmd == 'groupmessage') && (data.responseid == 'meshctrl')) { - if ((data.nodes != null)) { - for (var i in data.nodes) { - for (let index = 0; index < data.nodes[i].length; index++) { - const element = data.nodes[i][index]; - ws.send(JSON.stringify({ action: 'msg', type: 'messagebox', nodeid: element._id, title: args.title ? args.title : "MeshCentral", msg: args.msg, timeout: args.timeout ? args.timeout : 120000 })); - } - } - } - - setTimeout(function(){ console.log('ok'); process.exit(); }, 1000); - } - if ((settings.cmd == 'grouptoast') && (data.responseid == 'meshctrl')) { - if (data.nodes != null) { - for (var i in data.nodes) { - var nodes = []; - for (let index = 0; index < data.nodes[i].length; index++) { - const element = data.nodes[i][index]; - nodes.push(element._id); - } - ws.send(JSON.stringify({ action: 'toast', nodeids: nodes, title: args.title ? args.title : "MeshCentral", msg: args.msg, responseid: 'meshctrl' })); - } - } - } break; } case 'meshes': { // LISTDEVICEGROUPS @@ -2540,8 +2183,6 @@ function serverConnect() { if (data.cause == 'noauth') { if (data.msg == 'tokenrequired') { console.log('Authentication token required, use --token [number].'); - } else if (data.msg == 'nokey') { - console.log('URL key is invalid or missing, please specify ?key=xxx in url'); } else { if ((args.loginkeyfile != null) || (args.loginkey != null)) { console.log('Invalid login, check the login key and that this computer has the correct time.'); @@ -2595,15 +2236,6 @@ function serverConnect() { console.log(data.data); process.exit(); } - case 'report': { - console.log('group,' + data.data.columns.flatMap(c => c.id).join(',')); - Object.keys(data.data.groups).forEach(gk => { - data.data.groups[gk].entries.forEach(e => { - console.log(gk + ',' + Object.values(e).join(',')); - }); - }); - process.exit(); - } default: { break; } } //console.log('Data', data); @@ -2666,8 +2298,8 @@ function getDevicesThatMatchFilter(nodes, x) { } else if (tagSearch != null) { // Tag filter for (var d in nodes) { - if ((nodes[d].tags == null) && (tagSearch == '')) { r.push(nodes[d]); } - else if (nodes[d].tags != null) { for (var j in nodes[d].tags) { if (nodes[d].tags[j].toLowerCase() == tagSearch) { r.push(nodes[d]); break; } } } + if ((nodes[d].tags == null) && (tagSearch == '')) { r.push(d); } + else if (nodes[d].tags != null) { for (var j in nodes[d].tags) { if (nodes[d].tags[j].toLowerCase() == tagSearch) { r.push(d); break; } } } } } else if (agentTagSearch != null) { // Agent Tag filter @@ -2707,9 +2339,9 @@ function getDevicesThatMatchFilter(nodes, x) { var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception. for (var d in nodes) { //if (showRealNames) { - //if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(nodes[d]); } + //if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(nodes[d]); } //} else { - if (rx.test(nodes[d].name.toLowerCase())) { r.push(nodes[d]); } + if (rx.test(nodes[d].name.toLowerCase())) { r.push(nodes[d]); } //} } } catch (ex) { for (var d in nodes) { r.push(nodes[d]); } } @@ -2782,7 +2414,7 @@ function connectTunnel(url) { if ((cmd.action == 'uploadack') || (cmd.action == 'uploadstart')) { settings.inFlight--; if (settings.uploadFile == null) { if (settings.inFlight == 0) { process.exit(); } return; } // If the file is closed and there is no more in-flight data, exit. - var loops = (cmd.action == 'uploadstart') ? 16 : 1; // If this is the first data to be sent, hot start now. We are going to have 16 blocks of data in-flight. + var loops = (cmd.action == 'uploadstart')?16:1; // If this is the first data to be sent, hot start now. We are going to have 16 blocks of data in-flight. for (var i = 0; i < loops; i++) { if (settings.uploadFile == null) continue; var buf = Buffer.alloc(65565); @@ -2824,7 +2456,7 @@ function connectTunnel(url) { // node meshctrl download --id oL4Y6Eg0qjnpHFrp1AxfxnBPenbDGnDSkC@HSOnAheIyd51pKhqSCUgJZakzwfKl --file c:\temp\MC-8Languages.png --target c:\temp\bob.png settings.tunnelws.on('message', function (rawdata) { if (settings.tunnelwsstate == 1) { - if ((rawdata.length > 0) && (rawdata.toString()[0] != '{')) { + if ((rawdata.length > 0) && (rawdata[0] != '{')) { // This is binary data, this test is ok because 4 first bytes is a control value. if ((rawdata.length > 4) && (settings.downloadFile != null)) { settings.downloadSize += (rawdata.length - 4); require('fs').writeSync(settings.downloadFile, rawdata, 4, rawdata.length - 4); } if ((rawdata[3] & 1) != 0) { // Check end flag @@ -2905,7 +2537,7 @@ function displayDeviceInfo(sysinfo, lastconnect, network, nodes) { } } } - if ((sysinfo == null && lastconnect == null && network == null) || (node == null)) { + if (node == null) { console.log("Invalid device id"); process.exit(); return; } @@ -2958,7 +2590,7 @@ function displayDeviceInfo(sysinfo, lastconnect, network, nodes) { // MeshAgent if (node.agent) { var output = {}, outputCount = 0; - var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android", "Linux ARM", "macOS x86-32bit", "Android x86", "PogoPlug ARM", "Android", "Linux Poky x86-32bit", "macOS x86-64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "MIPS24KC (OpenWRT)", "Apple Silicon", "FreeBSD x86-64", "Unknown", "Linux ARM 64 bit (glibc/2.24 NOKVM)", "Alpine Linux x86 64 Bit (MUSL)", "Assistant (Windows)", "Armada370 - ARM32/HF (libc/2.26)", "OpenWRT x86-64", "OpenBSD x86-64", "Unknown", "Unknown", "MIPSEL24KC (OpenWRT)", "ARMADA/CORTEX-A53/MUSL (OpenWRT)", "Windows ARM 64bit console", "Windows ARM 64bit service"]; + var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "FreeBSD x86-64"]; if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) { var str = ''; if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; } diff --git a/meshdesktopmultiplex.js b/meshdesktopmultiplex.js index 9b6d1e19..80bcad27 100644 --- a/meshdesktopmultiplex.js +++ b/meshdesktopmultiplex.js @@ -342,7 +342,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, id, func) { parent.parent.fs.close(fd); // Now that the recording file is closed, check if we need to index this file. - if (domain.sessionrecording.index && domain.sessionrecording.index !== false) { parent.parent.certificateOperations.acceleratorPerformOperation('indexMcRec', filename); } + if (domain.sessionrecording.index !== false) { parent.parent.certificateOperations.acceleratorPerformOperation('indexMcRec', filename); } // Add a event entry about this recording var basefile = parent.parent.path.basename(filename); @@ -847,7 +847,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, id, func) { return; } // Write the recording file header - parent.parent.debug('relay', 'Relay: Started recording to file: ' + recFullFilename); + parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename); var metadata = { magic: 'MeshCentralRelaySession', ver: 1, nodeid: obj.nodeid, meshid: obj.meshid, time: new Date().toLocaleString(), protocol: 2, devicename: obj.name, devicegroup: obj.meshname }; var firstBlock = JSON.stringify(metadata); recordingEntry(fd, 1, 0, firstBlock, function () { @@ -1347,8 +1347,6 @@ function CreateMeshRelayEx2(parent, ws, req, domain, user, cookie) { if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; } if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; } if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; } - if (domain.consentmessages.autoacceptifnouser === true) { command.soptions.consentAutoAcceptIfNoUser = true; } - if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; } } if (typeof domain.notificationmessages == 'object') { if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; } @@ -1438,4 +1436,4 @@ a given size and timestamp. When looking at network traffic the flags are import - If traffic has the first (0x0001) flag set, the data is binary otherwise it's a string. - If the traffic has the second (0x0002) flag set, traffic is coming from the user's browser, if not, it's coming from the MeshAgent. -*/ +*/ \ No newline at end of file diff --git a/meshmail.js b/meshmail.js index c5977ea1..168b6769 100644 --- a/meshmail.js +++ b/meshmail.js @@ -26,7 +26,6 @@ module.exports.CreateMeshMail = function (parent, domain) { obj.mailCookieEncryptionKey = null; obj.verifyemail = false; obj.domain = domain; - obj.emailDelay = 5 * 60 * 1000; // Default of 5 minute email delay. //obj.mailTemplates = {}; const sortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }) const constants = (obj.parent.crypto.constants ? obj.parent.crypto.constants : require('constants')); // require('constants') is deprecated in Node 11.10, use require('crypto').constants instead. @@ -42,38 +41,30 @@ module.exports.CreateMeshMail = function (parent, domain) { obj.sendGridServer = require('@sendgrid/mail'); obj.sendGridServer.setApiKey(obj.config.sendgrid.apikey); if (obj.config.sendgrid.verifyemail == true) { obj.verifyemail = true; } - if ((typeof obj.config.sendgrid.emaildelayseconds == 'number') && (obj.config.sendgrid.emaildelayseconds > 0)) { obj.emailDelay = obj.config.sendgrid.emaildelayseconds * 1000; } } else if (obj.config.smtp != null) { // Setup SMTP mail server - if ((typeof obj.config.smtp.emaildelayseconds == 'number') && (obj.config.smtp.emaildelayseconds > 0)) { obj.emailDelay = obj.config.smtp.emaildelayseconds * 1000; } - if (obj.config.smtp.name == 'console') { - // This is for debugging, the mails will be displayed on the console - obj.smtpServer = 'console'; - } else { - const nodemailer = require('nodemailer'); - var options = { name: obj.config.smtp.name, host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: {} }; - //var options = { host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: { secureProtocol: 'SSLv23_method', ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false } }; - if (obj.config.smtp.port != null) { options.port = obj.config.smtp.port; } - if (obj.config.smtp.tlscertcheck === false) { options.tls.rejectUnauthorized = false; } - if (obj.config.smtp.tlsstrict === true) { options.tls.secureProtocol = 'SSLv23_method'; options.tls.ciphers = 'RSA+AES:!aNULL:!MD5:!DSS'; options.tls.secureOptions = constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE; } - if ((obj.config.smtp.auth != null) && (typeof obj.config.smtp.auth == 'object')) { - var user = obj.config.smtp.from; - if ((user == null) && (obj.config.smtp.user != null)) { user = obj.config.smtp.user; } - if ((obj.config.smtp.auth.user != null) && (typeof obj.config.smtp.auth.user == 'string')) { user = obj.config.smtp.auth.user; } - if (user.toLowerCase().endsWith('@gmail.com')) { options = { service: 'gmail', auth: { user: user } }; obj.config.smtp.host = 'gmail'; } else { options.auth = { user: user } } - if (obj.config.smtp.auth.type) { options.auth.type = obj.config.smtp.auth.type; } - if (obj.config.smtp.auth.clientid) { options.auth.clientId = obj.config.smtp.auth.clientid; options.auth.type = 'OAuth2'; } - if (obj.config.smtp.auth.clientsecret) { options.auth.clientSecret = obj.config.smtp.auth.clientsecret; } - if (obj.config.smtp.auth.refreshtoken) { options.auth.refreshToken = obj.config.smtp.auth.refreshtoken; } - } - else if ((obj.config.smtp.user != null) && (obj.config.smtp.pass != null)) { options.auth = { user: obj.config.smtp.user, pass: obj.config.smtp.pass }; } - if (obj.config.smtp.verifyemail == true) { obj.verifyemail = true; } - - obj.smtpServer = nodemailer.createTransport(options); + const nodemailer = require('nodemailer'); + var options = { name: obj.config.smtp.name, host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: {} }; + //var options = { host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: { secureProtocol: 'SSLv23_method', ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false } }; + if (obj.config.smtp.port != null) { options.port = obj.config.smtp.port; } + if (obj.config.smtp.tlscertcheck === false) { options.tls.rejectUnauthorized = false; } + if (obj.config.smtp.tlsstrict === true) { options.tls.secureProtocol = 'SSLv23_method'; options.tls.ciphers = 'RSA+AES:!aNULL:!MD5:!DSS'; options.tls.secureOptions = constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE; } + if ((obj.config.smtp.auth != null) && (typeof obj.config.smtp.auth == 'object')) { + var user = obj.config.smtp.from; + if ((user == null) && (obj.config.smtp.user != null)) { user = obj.config.smtp.user; } + if ((obj.config.smtp.auth.user != null) && (typeof obj.config.smtp.auth.user == 'string')) { user = obj.config.smtp.auth.user; } + if (user.toLowerCase().endsWith('@gmail.com')) { options = { service: 'gmail', auth: { user: user } }; obj.config.smtp.host = 'gmail'; } else { options.auth = { user: user } } + if (obj.config.smtp.auth.type) { options.auth.type = obj.config.smtp.auth.type; } + if (obj.config.smtp.auth.clientid) { options.auth.clientId = obj.config.smtp.auth.clientid; options.auth.type = 'OAuth2'; } + if (obj.config.smtp.auth.clientsecret) { options.auth.clientSecret = obj.config.smtp.auth.clientsecret; } + if (obj.config.smtp.auth.refreshtoken) { options.auth.refreshToken = obj.config.smtp.auth.refreshtoken; } } + else if ((obj.config.smtp.user != null) && (obj.config.smtp.pass != null)) { options.auth = { user: obj.config.smtp.user, pass: obj.config.smtp.pass }; } + if (obj.config.smtp.verifyemail == true) { obj.verifyemail = true; } + + obj.smtpServer = nodemailer.createTransport(options); } else if (obj.config.sendmail != null) { // Setup Sendmail - if ((typeof obj.config.sendmail.emaildelayseconds == 'number') && (obj.config.sendmail.emaildelayseconds > 0)) { obj.emailDelay = obj.config.sendmail.emaildelayseconds * 1000; } const nodemailer = require('nodemailer'); var options = { sendmail: true }; if (typeof obj.config.sendmail.newline == 'string') { options.newline = obj.config.sendmail.newline; } @@ -385,8 +376,8 @@ module.exports.CreateMeshMail = function (parent, domain) { } // Set all the template replacement options and generate the final email text (both in txt and html formats). - const optionsHtml = { username: EscapeHtml(username), email: EscapeHtml(email), servername: EscapeHtml(domain.title ? domain.title : 'MeshCentral'), header: true, footer: false }; - const optionsTxt = { username: username, email: email, servername: domain.title ? domain.title : 'MeshCentral', header: true, footer: false }; + var optionsHtml = { username: username, email: email, servername: domain.title ? domain.title : 'MeshCentral', header: true, footer: false }; + var optionsTxt = { username: username, email: email, servername: domain.title ? domain.title : 'MeshCentral', header: true, footer: false }; if ((connections == null) || (connections.length == 0)) { optionsHtml.connections = false; optionsTxt.connections = false; @@ -414,39 +405,6 @@ module.exports.CreateMeshMail = function (parent, domain) { }); }; - // Send device help request notification mail - obj.sendDeviceHelpMail = function (domain, username, email, devicename, nodeid, helpusername, helprequest, language) { - obj.checkEmail(email, function (checked) { - if (checked) { - parent.debug('email', "Sending device help notification to " + email); - - if ((parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName.indexOf('.') == -1)) { - parent.debug('email', "Error: Server name not set."); // If the server name is not set, email not possible. - return; - } - - var template = getTemplate('device-help', domain, language); - if ((template == null) || (template.htmlSubject == null) || (template.txtSubject == null)) { - parent.debug('email', "Error: Failed to get mail template."); // No email template found - return; - } - - // Set all the template replacement options and generate the final email text (both in txt and html formats). - const optionsHtml = { devicename: EscapeHtml(devicename), helpusername: EscapeHtml(helpusername), helprequest: EscapeHtml(helprequest), nodeid: nodeid.split('/')[2], servername: EscapeHtml(domain.title ? domain.title : 'MeshCentral') }; - const optionsTxt = { devicename: devicename, helpusername: helpusername, helprequest: helprequest, nodeid: nodeid.split('/')[2], servername: domain.title ? domain.title : 'MeshCentral' }; - - // Get from field - var from = null; - if (obj.config.sendgrid && (typeof obj.config.sendgrid.from == 'string')) { from = obj.config.sendgrid.from; } - else if (obj.config.smtp && (typeof obj.config.smtp.from == 'string')) { from = obj.config.smtp.from; } - - // Send the email - obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, optionsTxt), text: mailReplacements(template.txt, domain, optionsTxt), html: mailReplacements(template.html, domain, optionsHtml) }); - sendNextMail(); - } - }); - }; - // Send out the next mail in the pending list function sendNextMail() { if ((obj.sendingMail == true) || (obj.pendingMails.length == 0)) { return; } @@ -482,50 +440,39 @@ module.exports.CreateMeshMail = function (parent, domain) { } }); } else if (obj.smtpServer != null) { + // SMTP send parent.debug('email', 'SMTP sending mail to ' + mailToSend.to + '.'); - if (obj.smtpServer == 'console') { - // Display the email on the console, this is for easy debugging - if (mailToSend.from == null) { delete mailToSend.from; } - if (mailToSend.html == null) { delete mailToSend.html; } - console.log('Email', mailToSend); + obj.smtpServer.sendMail(mailToSend, function (err, info) { + parent.debug('email', 'SMTP response: ' + JSON.stringify(err) + ', ' + JSON.stringify(info)); obj.sendingMail = false; - obj.pendingMails.shift(); - obj.retry = 0; - sendNextMail(); - } else { - // SMTP send - obj.smtpServer.sendMail(mailToSend, function (err, info) { - parent.debug('email', 'SMTP response: ' + JSON.stringify(err) + ', ' + JSON.stringify(info)); - obj.sendingMail = false; - if (err == null) { - // Send the next mail + if (err == null) { + // Send the next mail + obj.pendingMails.shift(); + obj.retry = 0; + sendNextMail(); + } else { + obj.retry++; + parent.debug('email', 'SMTP server failed (Retry:' + obj.retry + '): ' + JSON.stringify(err)); + console.log('SMTP server failed (Retry:' + obj.retry + '/3): ' + JSON.stringify(err)); + // Wait and try again + if (obj.retry < 3) { + setTimeout(sendNextMail, 10000); + } else { + // Failed, send the next mail + parent.debug('email', 'SMTP server failed (Skipping): ' + JSON.stringify(err)); + console.log('SMTP server failed (Skipping): ' + JSON.stringify(err)); obj.pendingMails.shift(); obj.retry = 0; sendNextMail(); - } else { - obj.retry++; - parent.debug('email', 'SMTP server failed (Retry:' + obj.retry + '): ' + JSON.stringify(err)); - console.log('SMTP server failed (Retry:' + obj.retry + '/3): ' + JSON.stringify(err)); - // Wait and try again - if (obj.retry < 3) { - setTimeout(sendNextMail, 10000); - } else { - // Failed, send the next mail - parent.debug('email', 'SMTP server failed (Skipping): ' + JSON.stringify(err)); - console.log('SMTP server failed (Skipping): ' + JSON.stringify(err)); - obj.pendingMails.shift(); - obj.retry = 0; - sendNextMail(); - } } - }); - } + } + }); } } // Send out the next mail in the pending list obj.verify = function () { - if ((obj.smtpServer == null) || (obj.smtpServer == 'console')) return; + if (obj.smtpServer == null) return; obj.smtpServer.verify(function (err, info) { if (err == null) { if (obj.config.smtp.host == 'gmail') { @@ -575,7 +522,7 @@ module.exports.CreateMeshMail = function (parent, domain) { } // - // Device connection and disconnection notifications + // Device connetion and disconnection notifications // obj.deviceNotifications = {}; // UserId --> { timer, nodes: nodeid --> connectType } @@ -588,7 +535,7 @@ module.exports.CreateMeshMail = function (parent, domain) { // Add the user and start a timer if (obj.deviceNotifications[user._id] == null) { obj.deviceNotifications[user._id] = { nodes: {} }; - obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, obj.emailDelay); + obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 5 * 60 * 1000); // 5 minute before email is sent } // Add the device @@ -652,7 +599,7 @@ module.exports.CreateMeshMail = function (parent, domain) { // Add the user and start a timer if (obj.deviceNotifications[user._id] == null) { obj.deviceNotifications[user._id] = { nodes: {} }; - obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, obj.emailDelay); + obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 5 * 60 * 1000); // 5 minute before email is sent } // Add the device diff --git a/meshmessaging.js b/meshmessaging.js deleted file mode 100644 index 646ae4a2..00000000 --- a/meshmessaging.js +++ /dev/null @@ -1,757 +0,0 @@ -/** -* @description MeshCentral user messaging communication module -* @author Ylian Saint-Hilaire -* @copyright Intel Corporation 2022 -* @license Apache-2.0 -* @version v0.0.1 -*/ - -/*xjslint node: true */ -/*xjslint plusplus: true */ -/*xjslint maxlen: 256 */ -/*jshint node: true */ -/*jshint strict: false */ -/*jshint esversion: 6 */ -"use strict"; - -/* -// For Telegram user login, add this in config.json -"messaging": { - "telegram": { - "apiid": 00000000, - "apihash": "00000000000000000000000", - "session": "aaaaaaaaaaaaaaaaaaaaaaa" - } -} - -// For Telegram bot login, add this in config.json -"messaging": { - "telegram": { - "apiid": 00000000, - "apihash": "00000000000000000000000", - "bottoken": "00000000:aaaaaaaaaaaaaaaaaaaaaaaa" - } -} - -// For Telegram login with proxy settings, add this in config.json -{ - "messaging": { - "telegram": { - "apiid": 0, - "apihash": "00000000000000000000000", - "session": "aaaaaaaaaaaaaaaaaaaaaaa", - "useWSS": false, // Important. Most proxies cannot use SSL. - "proxy": { - "ip": "123.123.123.123", // Proxy host (IP or hostname) - "port": 123, // Proxy port - "MTProxy": false, // Whether it's an MTProxy or a normal Socks one - "secret": "00000000000000000000000000000000", // If used MTProxy then you need to provide a secret (or zeros). - "socksType": 5, // If used Socks you can choose 4 or 5. - "timeout": 2 // Timeout (in seconds) for connection, - } - } - } -} - -// For Discord login, add this in config.json -"messaging": { - "discord": { - "inviteurl": "https://discord.gg/xxxxxxxxx", - "token": "xxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxx" - } -} - -// For XMPP login, add this in config.json -{ - "messaging": { - "xmpp": { - "service": "xmppserver.com", - "credentials": { - "username": "username", - "password": "password" - } - } - } -} - -// For CallMeBot -// For Signal Messenger: https://www.callmebot.com/blog/free-api-signal-send-messages/ -{ - "messaging": { - "callmebot": true - } -} - -// For Pushover -{ - "messaging": { - "pushover": { - "token": "xxxxxxx" - } - } -} - -// For ntfy -{ - "messaging": { - "ntfy": true - } -} - -// For zulip -{ - "messaging": { - "site": "https://api.zulip.com", - "email": "your-bot@zulip.com", - "api_key": "your_32_character_api_key" - } -} - -// For Slack Webhook -{ - "messaging": { - "slack": true - } -} - -*/ - -// Construct a messaging server object -module.exports.CreateServer = function (parent) { - var obj = {}; - obj.parent = parent; - obj.providers = 0; // 1 = Telegram, 2 = Signal, 4 = Discord, 8 = XMPP, 16 = CallMeBot, 32 = Pushover, 64 = ntfy, 128 = Zulip, 256 = Slack - obj.telegramClient = null; - obj.discordClient = null; - obj.discordUrl = null; - obj.xmppClient = null; - var xmppXml = null; - obj.callMeBotClient = null; - obj.pushoverClient = null; - obj.zulipClient = null; - obj.slackClient = null; - const sortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }) - - // Telegram client setup - if (parent.config.messaging.telegram) { - // Validate Telegram configuration values - var telegramOK = true; - if (typeof parent.config.messaging.telegram.apiid != 'number') { console.log('Invalid or missing Telegram apiid.'); telegramOK = false; } - if (typeof parent.config.messaging.telegram.apihash != 'string') { console.log('Invalid or missing Telegram apihash.'); telegramOK = false; } - if ((typeof parent.config.messaging.telegram.session != 'string') && (typeof parent.config.messaging.telegram.bottoken != 'string')) { console.log('Invalid or missing Telegram session or bottoken.'); telegramOK = false; } - - if (telegramOK) { - // Setup Telegram - async function setupTelegram() { - const { TelegramClient } = require('telegram'); - const { StringSession } = require('telegram/sessions'); - const { Logger } = require('telegram/extensions/Logger'); - const logger = new Logger({ LogLevel : 'none' }); - const input = require('input'); - var client; - var options = { connectionRetries: 5, baseLogger: logger }; - if (parent.config.messaging.telegram.usewss == false) { options.useWSS = false; } - if (typeof parent.config.messaging.telegram.connectionretries == 'number') { options.connectionRetries = parent.config.messaging.telegram.connectionretries; } - if (typeof parent.config.messaging.telegram.proxy == 'object') { options.proxy = parent.config.messaging.telegram.proxy; } - if (parent.config.messaging.telegram.bottoken == null) { - // User login - var stringSession = new StringSession(parent.config.messaging.telegram.session); - const client = new TelegramClient(stringSession, parent.config.messaging.telegram.apiid, parent.config.messaging.telegram.apihash, options); - await client.start({ onError: function (err) { console.log('Telegram error', err); } }); - obj.telegramClient = client; - obj.providers += 1; // Enable Telegram messaging - console.log("MeshCentral Telegram client is user connected."); - } else { - // Bot login - var stringSession = new StringSession(''); - const client = new TelegramClient(stringSession, parent.config.messaging.telegram.apiid, parent.config.messaging.telegram.apihash, options); - await client.start({ botAuthToken: parent.config.messaging.telegram.bottoken, onError: function (err) { console.log('Telegram error', err); } }); - obj.telegramClient = client; - obj.providers += 1; // Enable Telegram messaging - console.log("MeshCentral Telegram client is bot connected."); - } - } - setupTelegram(); - } - } - - // Discord client setup - if (parent.config.messaging.discord) { - // Validate Discord configuration values - var discordOK = true; - if (typeof parent.config.messaging.discord.token != 'string') { console.log('Invalid or missing Discord token.'); discordOK = false; } - - if (discordOK) { - // Setup Discord - const { Client, GatewayIntentBits } = require('discord.js'); - var discordClient = new Client({ - intents: [ - GatewayIntentBits.Guilds, - GatewayIntentBits.GuildMessages, - GatewayIntentBits.MessageContent, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.DirectMessages - ] - }); - - // Called when Discord client is connected - discordClient.on('ready', function() { - console.log(`MeshCentral Discord client is connected as ${discordClient.user.tag}!`); - obj.discordClient = discordClient; - obj.discordUrl = parent.config.messaging.discord.serverurl; - obj.providers += 4; // Enable Discord messaging - }); - - // Receives incoming messages, ignore for now - discordClient.on('messageCreate', function(message) { - if (message.author.bot) return false; - console.log(`Discord message from ${message.author.username}: ${message.content}`, message.channel.type); - //message.channel.send("Channel Hello"); - //message.author.send('Private Hello'); - }); - - // Called when Discord client received an interaction - discordClient.on('interactionCreate', async function(interaction) { - console.log('Discord interaction', interaction); - if (!interaction.isChatInputCommand()) return; - if (interaction.commandName === 'ping') { await interaction.reply('Pong!'); } - }); - - // Connect Discord client - discordClient.login(parent.config.messaging.discord.token); - } - } - - // XMPP client setup - if (parent.config.messaging.xmpp) { - // Validate XMPP configuration values - var xmppOK = true; - if (typeof parent.config.messaging.xmpp.service != 'string') { console.log('Invalid or missing XMPP service.'); xmppOK = false; } - - if (xmppOK) { - // Setup XMPP - const { client, xml } = require('@xmpp/client'); - const xmpp = client(parent.config.messaging.xmpp); - xmpp.on('error', function (err) { parent.debug('email', 'XMPP error: ' + err); console.error('XMPP error', err); }); - xmpp.on('offline', function () { parent.debug('email', 'XMPP client is offline.'); console.log('XMPP offline'); }); - //xmpp.on('stanza', async function (stanza) { if (stanza.is("message")) { await xmpp.send(xml('presence', { type: 'unavailable' })); await xmpp.stop(); } }); - xmpp.on('online', async function (address) { - // await xmpp.send(xml("presence")); const message = xml("message", { type: "chat", to: "username@server.com" }, xml("body", {}, "hello world")); await xmpp.send(message); - xmppXml = xml; - obj.xmppClient = xmpp; - obj.providers += 8; // Enable XMPP messaging - console.log("MeshCentral XMPP client is connected."); - }); - xmpp.start().catch(console.error); - } - } - - // CallMeBot client setup (https://www.callmebot.com/) - if (parent.config.messaging.callmebot) { - obj.callMeBotClient = true; - obj.providers += 16; // Enable CallMeBot messaging - } - - // Pushover client setup (https://pushover.net) - if (typeof parent.config.messaging.pushover == 'object') { - // Validate Pushover configuration values - var pushoverOK = true; - if (typeof parent.config.messaging.pushover.token != 'string') { console.log('Invalid or missing Pushover token.'); pushoverOK = false; } - - if (pushoverOK) { - // Setup PushOver - obj.pushoverClient = true; - obj.providers += 32; // Enable Pushover messaging - } - } - - // ntfy client setup (https://ntfy.sh/) - if (parent.config.messaging.ntfy) { - obj.ntfyClient = true; - obj.providers += 64; // Enable ntfy messaging - } - - // Zulip client setup (https://zulip.com/) - if (typeof parent.config.messaging.zulip == 'object') { - var zulip = require('zulip'); - obj.zulipClient = new zulip.Client(parent.config.messaging.zulip); - obj.providers += 128; // Enable zulip messaging - } - - // Slack Webhook setup (https://slack.com) - if (parent.config.messaging.slack) { - obj.slackClient = true; - obj.providers += 256; // Enable slack messaging - } - - // Send a direct message to a specific userid - async function discordSendMsg(userId, message) { - const user = await obj.discordClient.users.fetch(userId).catch(function () { return null; }); - if (!user) return; - await user.send(message).catch(function (ex) { console.log('Discord Error', ex); }); - } - - // Convert a userTag to a userId. We need to query the Discord server to find this information. - // Example: findUserByTab('aaaa#0000', function (userid) { sendMsg(userid, 'message'); }); - async function discordFindUserByTag(userTag, func) { - var username = userTag.split('#')[0]; - const guilds = await obj.discordClient.guilds.fetch(); - guilds.forEach(async function (value, key) { - var guild = await value.fetch(); - const guildMembers = await guild.members.search({ query: username }); - guildMembers.forEach(async function (value, key) { - if ((value.user.username + (value.user.discriminator != '0' ? '#' + value.user.discriminator : ''))== userTag) { func(key); return; } - }); - }); - } - - // Send an XMPP message - async function sendXmppMessage(to, msg, func) { - const message = xmppXml('message', { type: 'chat', to: to.substring(5) }, xmppXml('body', {}, msg)); - await obj.xmppClient.send(message); - if (func != null) { func(true); } - } - - // Send an user message - obj.sendMessage = function(to, msg, domain, func) { - if ((to.startsWith('telegram:')) && (obj.telegramClient != null)) { // Telegram - async function sendTelegramMessage(to, msg, func) { - if (obj.telegramClient == null) return; - parent.debug('email', 'Sending Telegram message to: ' + to.substring(9) + ': ' + msg); - try { await obj.telegramClient.sendMessage(to.substring(9), { message: msg }); if (func != null) { func(true); } } catch (ex) { if (func != null) { func(false, ex); } } - } - sendTelegramMessage(to, msg, func); - } else if ((to.startsWith('discord:')) && (obj.discordClient != null)) { // Discord - discordFindUserByTag(to.substring(8), function (userid) { - parent.debug('email', 'Sending Discord message to: ' + to.substring(9) + ', ' + userid + ': ' + msg); - discordSendMsg(userid, msg); if (func != null) { func(true); } - }); - } else if ((to.startsWith('xmpp:')) && (obj.xmppClient != null)) { // XMPP - parent.debug('email', 'Sending XMPP message to: ' + to.substring(5) + ': ' + msg); - sendXmppMessage(to, msg, func); - } else if ((to.startsWith('callmebot:')) && (obj.callMeBotClient != null)) { // CallMeBot - parent.debug('email', 'Sending CallMeBot message to: ' + to.substring(10) + ': ' + msg); - console.log('Sending CallMeBot message to: ' + to.substring(10) + ': ' + msg); - var toData = to.substring(10).split('|'); - if ((toData[0] == 'signal') && (toData.length == 3)) { - var url = 'https://api.callmebot.com/signal/send.php?phone=' + encodeURIComponent(toData[1]) + '&apikey=' + encodeURIComponent(toData[2]) + '&text=' + encodeURIComponent(msg); - require('https').get(url, function (r) { if (func != null) { func(r.statusCode == 200); } }); - } else if ((toData[0] == 'whatsapp') && (toData.length == 3)) { - var url = 'https://api.callmebot.com/whatsapp.php?phone=' + encodeURIComponent(toData[1]) + '&apikey=' + encodeURIComponent(toData[2]) + '&text=' + encodeURIComponent(msg); - require('https').get(url, function (r) { if (func != null) { func(r.statusCode == 200); } }); - } else if ((toData[0] == 'facebook') && (toData.length == 2)) { - var url = 'https://api.callmebot.com/facebook/send.php?apikey=' + encodeURIComponent(toData[1]) + '&text=' + encodeURIComponent(msg); - require('https').get(url, function (r) { if (func != null) { func(r.statusCode == 200); } }); - } else if ((toData[0] == 'telegram') && (toData.length == 2)) { - var url = 'https://api.callmebot.com/text.php?user=' + encodeURIComponent(toData[1]) + '&text=' + encodeURIComponent(msg); - require('https').get(url, function (r) { if (func != null) { func(r.statusCode == 200); } }); - } - } else if ((to.startsWith('pushover:')) && (obj.pushoverClient != null)) { // Pushover - const Pushover = require('node-pushover'); - const push = new Pushover({ token: parent.config.messaging.pushover.token, user: to.substring(9) }); - push.send(domain.title ? domain.title : 'MeshCentral', msg, function (err, res) { if (func != null) { func(err == null); } }); - } else if ((to.startsWith('ntfy:')) && (obj.ntfyClient != null)) { // ntfy - const url = 'https://' + (((typeof parent.config.messaging.ntfy == 'object') && (typeof parent.config.messaging.ntfy.host == 'string')) ? parent.config.messaging.ntfy.host : 'ntfy.sh') + '/' + encodeURIComponent(to.substring(5)); - const headers = { 'User-Agent': 'MeshCentral v' + parent.currentVer }; - if (typeof parent.config.messaging.ntfy.authorization == 'string') { headers['Authorization'] = parent.config.messaging.ntfy.authorization; } - const req = require('https').request(new URL(url), { method: 'POST', headers: headers }, function (res) { if (func != null) { func(res.statusCode == 200); } }); - req.end(msg); - } else if ((to.startsWith('zulip:')) && (obj.zulipClient != null)) { // zulip - obj.zulipClient.sendMessage({ - type: 'private', - content: msg, - to: [ to.substring(6) ], - subject: domain.title ? domain.title : 'MeshCentral' - }); - if (func != null) { func(true); } - }else if ((to.startsWith('slack:')) && (obj.slackClient != null)) { //slack - const req = require('https').request(new URL(to.substring(6)), { method: 'POST' }, function (res) { if (func != null) { func(true); } }); - req.on('error', function (err) { if (func != null) { func(false); } }); - req.write(JSON.stringify({"text": msg })); - req.end(); - } else { - // No providers found - if (func != null) { func(false, "No messaging providers found for this message."); } - } - } - - // Convert a CallMeBot URL into a handle - obj.callmebotUrlToHandle = function (xurl) { - var url = null; - try { url = require('url').parse(xurl); } catch (ex) { return; } - if ((url == null) || (url.host != 'api.callmebot.com') || (url.query == null)) return; - var urlArgs = {}, urlArgs2 = url.query.split('&'); - for (var i in urlArgs2) { var j = urlArgs2[i].indexOf('='); if (j > 0) { urlArgs[urlArgs2[i].substring(0, j)] = urlArgs2[i].substring(j + 1); } } - if ((urlArgs['phone'] != null) && (urlArgs['phone'].indexOf('|') >= 0)) return; - if ((urlArgs['apikey'] != null) && (urlArgs['apikey'].indexOf('|') >= 0)) return; - if ((urlArgs['user'] != null) && (urlArgs['user'].indexOf('|') >= 0)) return; - // Signal Messenger, Whatapp, Facebook and Telegram - if (url.path.startsWith('/signal') && (urlArgs['phone'] != null) && (urlArgs['apikey'] != null)) { return 'callmebot:signal|' + urlArgs['phone'] + '|' + urlArgs['apikey']; } - if (url.path.startsWith('/whatsapp') && (urlArgs['phone'] != null) && (urlArgs['apikey'] != null)) { return 'callmebot:whatsapp|' + urlArgs['phone'] + '|' + urlArgs['apikey']; } - if (url.path.startsWith('/facebook') && (urlArgs['apikey'] != null)) { return 'callmebot:facebook|' + urlArgs['apikey']; } - if (url.path.startsWith('/text') && (urlArgs['user'] != null)) { return 'callmebot:telegram|' + urlArgs['user']; } - return null; - } - - // Get the correct SMS template - function getTemplate(templateNumber, domain, lang) { - parent.debug('email', 'Getting SMS template #' + templateNumber + ', lang: ' + lang); - if (Array.isArray(lang)) { lang = lang[0]; } // TODO: For now, we only use the first language given. - - var r = {}, emailsPath = null; - if ((domain != null) && (domain.webemailspath != null)) { emailsPath = domain.webemailspath; } - else if (obj.parent.webEmailsOverridePath != null) { emailsPath = obj.parent.webEmailsOverridePath; } - else if (obj.parent.webEmailsPath != null) { emailsPath = obj.parent.webEmailsPath; } - if ((emailsPath == null) || (obj.parent.fs.existsSync(emailsPath) == false)) { return null } - - // Get the non-english email if needed - var txtfile = null; - if ((lang != null) && (lang != 'en')) { - var translationsPath = obj.parent.path.join(emailsPath, 'translations'); - var translationsPathTxt = obj.parent.path.join(emailsPath, 'translations', 'sms-messages_' + lang + '.txt'); - if (obj.parent.fs.existsSync(translationsPath) && obj.parent.fs.existsSync(translationsPathTxt)) { - txtfile = obj.parent.fs.readFileSync(translationsPathTxt).toString(); - } - } - - // Get the english email - if (txtfile == null) { - var pathTxt = obj.parent.path.join(emailsPath, 'sms-messages.txt'); - if (obj.parent.fs.existsSync(pathTxt)) { - txtfile = obj.parent.fs.readFileSync(pathTxt).toString(); - } - } - - // No email templates - if (txtfile == null) { return null; } - - // Decode the TXT file - var lines = txtfile.split('\r\n').join('\n').split('\n') - if (lines.length <= templateNumber) return null; - - return lines[templateNumber]; - } - - // Send messaging account verification - obj.sendMessagingCheck = function (domain, to, verificationCode, language, func) { - parent.debug('email', "Sending verification message to " + to); - - var sms = getTemplate(0, domain, language); - if (sms == null) { parent.debug('email', "Error: Failed to get SMS template"); return; } // No SMS template found - - // Setup the template - sms = sms.split('[[0]]').join(domain.title ? domain.title : 'MeshCentral'); - sms = sms.split('[[1]]').join(verificationCode); - - // Send the message - obj.sendMessage(to, sms, domain, func); - }; - - // Send 2FA verification - obj.sendToken = function (domain, to, verificationCode, language, func) { - parent.debug('email', "Sending login token message to " + to); - - var sms = getTemplate(1, domain, language); - if (sms == null) { parent.debug('email', "Error: Failed to get SMS template"); return; } // No SMS template found - - // Setup the template - sms = sms.split('[[0]]').join(domain.title ? domain.title : 'MeshCentral'); - sms = sms.split('[[1]]').join(verificationCode); - - // Send the message - obj.sendMessage(to, sms, domain, func); - }; - - // Send device state change notification - obj.sendDeviceNotify = function (domain, username, to, connections, disconnections, lang) { - if (to == null) return; - parent.debug('email', "Sending device state change message to " + to); - - // Format the message - var sms = []; - if (connections.length > 0) { sms.push('Connections: ' + connections.join(', ')); } // TODO: Translate 'Connections: ' - if (disconnections.length > 0) { sms.push('Disconnections: ' + disconnections.join(', ')); } // TODO: Translate 'Disconnections: ' - if (sms.length == 0) return; - sms = sms.join(' - '); - if (sms.length > 1000) { sms = sms.substring(0, 997) + '...'; } // Limit messages to 1000 characters - - // Send the message - obj.sendMessage(to, sms, domain, null); - }; - - // Send help request notification - obj.sendDeviceHelpRequest = function (domain, username, to, devicename, nodeid, helpusername, helprequest, lang) { - if (to == null) return; - parent.debug('email', "Sending device help request message to " + to); - - // Format the message - var sms = "Help Request from " + devicename + ': ' + helprequest; // TODO: Translate 'Help Request from {0}:' - if (sms.length > 1000) { sms = sms.substring(0, 997) + '...'; } // Limit messages to 1000 characters - - // Send the message - obj.sendMessage(to, sms, domain, null); - } - - - // - // Device connection and disconnection notifications - // - - obj.deviceNotifications = {}; // UserId --> { timer, nodes: nodeid --> connectType } - - // A device connected and a user needs to be notified about it. - obj.notifyDeviceConnect = function (user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo) { - const mesh = parent.webserver.meshes[meshid]; - if (mesh == null) return; - - // Add the user and start a timer - if (obj.deviceNotifications[user._id] == null) { - obj.deviceNotifications[user._id] = { nodes: {} }; - obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 1 * 60 * 1000); // 1 minute before message is sent - } - - // Add the device - if (obj.deviceNotifications[user._id].nodes[nodeid] == null) { - obj.deviceNotifications[user._id].nodes[nodeid] = { c: connectType }; // This device connection need to be added - } else { - const info = obj.deviceNotifications[user._id].nodes[nodeid]; - if ((info.d != null) && ((info.d & connectType) != 0)) { - info.d -= connectType; // This device disconnect cancels out a device connection - if (((info.c == null) || (info.c == 0)) && ((info.d == null) || (info.d == 0))) { - // This device no longer needs a notification - delete obj.deviceNotifications[user._id].nodes[nodeid]; - if (Object.keys(obj.deviceNotifications[user._id].nodes).length == 0) { - // This user no longer needs a notification - clearTimeout(obj.deviceNotifications[user._id].timer); - delete obj.deviceNotifications[user._id]; - } - return; - } - } else { - if (info.c != null) { - info.c |= connectType; // This device disconnect needs to be added - } else { - info.c = connectType; // This device disconnect needs to be added - } - } - } - - // Set the device group name - if ((extraInfo != null) && (extraInfo.name != null)) { obj.deviceNotifications[user._id].nodes[nodeid].nn = extraInfo.name; } - obj.deviceNotifications[user._id].nodes[nodeid].mn = mesh.name; - } - - // Cancel a device disconnect notification - obj.cancelNotifyDeviceDisconnect = function (user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo) { - const mesh = parent.webserver.meshes[meshid]; - if (mesh == null) return; - - if ((obj.deviceNotifications[user._id] != null) && (obj.deviceNotifications[user._id].nodes[nodeid] != null)) { - const info = obj.deviceNotifications[user._id].nodes[nodeid]; - if ((info.d != null) && ((info.d & connectType) != 0)) { - info.d -= connectType; // This device disconnect cancels out a device connection - if (((info.c == null) || (info.c == 0)) && ((info.d == null) || (info.d == 0))) { - // This device no longer needs a notification - delete obj.deviceNotifications[user._id].nodes[nodeid]; - if (Object.keys(obj.deviceNotifications[user._id].nodes).length == 0) { - // This user no longer needs a notification - clearTimeout(obj.deviceNotifications[user._id].timer); - delete obj.deviceNotifications[user._id]; - } - } - } - } - } - - // A device disconnected and a user needs to be notified about it. - obj.notifyDeviceDisconnect = function (user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo) { - const mesh = parent.webserver.meshes[meshid]; - if (mesh == null) return; - - // Add the user and start a timer - if (obj.deviceNotifications[user._id] == null) { - obj.deviceNotifications[user._id] = { nodes: {} }; - obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 1 * 60 * 1000); // 1 minute before message is sent - } - - // Add the device - if (obj.deviceNotifications[user._id].nodes[nodeid] == null) { - obj.deviceNotifications[user._id].nodes[nodeid] = { d: connectType }; // This device disconnect need to be added - } else { - const info = obj.deviceNotifications[user._id].nodes[nodeid]; - if ((info.c != null) && ((info.c & connectType) != 0)) { - info.c -= connectType; // This device disconnect cancels out a device connection - if (((info.d == null) || (info.d == 0)) && ((info.c == null) || (info.c == 0))) { - // This device no longer needs a notification - delete obj.deviceNotifications[user._id].nodes[nodeid]; - if (Object.keys(obj.deviceNotifications[user._id].nodes).length == 0) { - // This user no longer needs a notification - clearTimeout(obj.deviceNotifications[user._id].timer); - delete obj.deviceNotifications[user._id]; - } - return; - } - } else { - if (info.d != null) { - info.d |= connectType; // This device disconnect needs to be added - } else { - info.d = connectType; // This device disconnect needs to be added - } - } - } - - // Set the device group name - if ((extraInfo != null) && (extraInfo.name != null)) { obj.deviceNotifications[user._id].nodes[nodeid].nn = extraInfo.name; } - obj.deviceNotifications[user._id].nodes[nodeid].mn = mesh.name; - } - - // Cancel a device connect notification - obj.cancelNotifyDeviceConnect = function (user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo) { - const mesh = parent.webserver.meshes[meshid]; - if (mesh == null) return; - - if ((obj.deviceNotifications[user._id] != null) && (obj.deviceNotifications[user._id].nodes[nodeid] != null)) { - const info = obj.deviceNotifications[user._id].nodes[nodeid]; - if ((info.c != null) && ((info.c & connectType) != 0)) { - info.c -= connectType; // This device disconnect cancels out a device connection - if (((info.d == null) || (info.d == 0)) && ((info.c == null) || (info.c == 0))) { - // This device no longer needs a notification - delete obj.deviceNotifications[user._id].nodes[nodeid]; - if (Object.keys(obj.deviceNotifications[user._id].nodes).length == 0) { - // This user no longer needs a notification - clearTimeout(obj.deviceNotifications[user._id].timer); - delete obj.deviceNotifications[user._id]; - } - } - } - } - } - - // Send a notification about device connections and disconnections to a user - function sendDeviceNotifications(userid) { - if (obj.deviceNotifications[userid] == null) return; - clearTimeout(obj.deviceNotifications[userid].timer); - - var connections = []; - var disconnections = []; - - for (var nodeid in obj.deviceNotifications[userid].nodes) { - var info = obj.deviceNotifications[userid].nodes[nodeid]; - if ((info.c != null) && (info.c > 0) && (info.nn != null) && (info.mn != null)) { - /* - var c = []; - if (info.c & 1) { c.push("Agent"); } - if (info.c & 2) { c.push("CIRA"); } - if (info.c & 4) { c.push("AMT"); } - if (info.c & 8) { c.push("AMT-Relay"); } - if (info.c & 16) { c.push("MQTT"); } - connections.push(info.mn + ', ' + info.nn + ': ' + c.join(', ')); - */ - if (info.c & 1) { connections.push(info.nn); } - } - if ((info.d != null) && (info.d > 0) && (info.nn != null) && (info.mn != null)) { - /* - var d = []; - if (info.d & 1) { d.push("Agent"); } - if (info.d & 2) { d.push("CIRA"); } - if (info.d & 4) { d.push("AMT"); } - if (info.d & 8) { d.push("AMT-Relay"); } - if (info.d & 16) { d.push("MQTT"); } - disconnections.push(info.mn + ', ' + info.nn + ': ' + d.join(', ')); - */ - if (info.d & 1) { disconnections.push(info.nn); } - } - } - - // Sort the notifications - connections.sort(sortCollator.compare); - disconnections.sort(sortCollator.compare); - - // Get the user and domain - const user = parent.webserver.users[userid]; - if ((user == null) || (user.msghandle == null)) return; - const domain = obj.parent.config.domains[user.domain]; - if (domain == null) return; - - // Send the message - obj.sendDeviceNotify(domain, user.name, user.msghandle, connections, disconnections, user.llang); - - // Clean up - delete obj.deviceNotifications[userid]; - } - - return obj; -}; - -// Called to setup the Telegram session key -module.exports.SetupTelegram = async function (parent) { - // If basic telegram values are not setup, instruct the user on how to get them. - if ((typeof parent.config.messaging != 'object') || (typeof parent.config.messaging.telegram != 'object') || (typeof parent.config.messaging.telegram.apiid != 'number') || (typeof parent.config.messaging.telegram.apihash != 'string')) { - console.log('Login to your Telegram account at this URL: https://my.telegram.org/.'); - console.log('Click "API development tools" and fill your application details (only app title and short name required).'); - console.log('Click "Create application"'); - console.log('Set this apiid and apihash values in the messaging section of the config.json like this:'); - console.log('{'); - console.log(' "messaging": {'); - console.log(' "telegram": {'); - console.log(' "apiid": 123456,'); - console.log(' "apihash": "123456abcdfg"'); - console.log(' }'); - console.log(' }'); - console.log('}'); - console.log('Then, run --setuptelegram again to continue.'); - process.exit(); - return; - } - - // If the session value is missing, perform the process to get it - if (((parent.config.messaging.telegram.session == null) || (parent.config.messaging.telegram.session == '') || (typeof parent.config.messaging.telegram.session != 'string')) && ((parent.config.messaging.telegram.bottoken == null) || (parent.config.messaging.telegram.bottoken == '') || (typeof parent.config.messaging.telegram.bottoken != 'string'))) { - if (parent.args.setuptelegram == 'user') { - const { TelegramClient } = require('telegram'); - const { StringSession } = require('telegram/sessions'); - const { Logger } = require('telegram/extensions/Logger'); - const logger = new Logger({ LogLevel: 'none' }); - const input = require('input'); - const stringSession = new StringSession(''); - const client = new TelegramClient(stringSession, parent.config.messaging.telegram.apiid, parent.config.messaging.telegram.apihash, { connectionRetries: 5, baseLogger: logger }); - await client.start({ - phoneNumber: async function () { return await input.text("Please enter your number (+1-111-222-3333): "); }, - password: async function () { return await input.text("Please enter your password: "); }, - phoneCode: async function () { return await input.text("Please enter the code you received: "); }, - onError: function (err) { console.log('Telegram error', err); } - }); - console.log('Set this session value in the messaging section of the config.json like this:'); - console.log('{'); - console.log(' "messaging": {'); - console.log(' "telegram": {'); - console.log(' "apiid": ' + parent.config.messaging.telegram.apiid + ','); - console.log(' "apihash": "' + parent.config.messaging.telegram.apihash + '",'); - console.log(' "session": "' + client.session.save() + '"'); - console.log(' }'); - console.log(' }'); - console.log('}'); - process.exit(); - } else if (parent.args.setuptelegram == 'bot') { - console.log('Login to your Telegram account, search for "BotFather", message him and create a bot.'); - console.log('Once you get the HTTP API token, add it in the config.json as "bottoken" like so:'); - console.log('{'); - console.log(' "messaging": {'); - console.log(' "telegram": {'); - console.log(' "apiid": ' + parent.config.messaging.telegram.apiid + ','); - console.log(' "apihash": "' + parent.config.messaging.telegram.apihash + '",'); - console.log(' "bottoken": "00000000:aaaaaaaaaaaaaaaaaaaaaaaa"'); - console.log(' }'); - console.log(' }'); - console.log('}'); - process.exit(); - } else { - console.log('run "--setuptelegram bot" to setup Telegram login as a bot (typical).'); - console.log('run "--setuptelegram user" to setup Telegram login as a user.'); - process.exit(); - } - } - - // All Telegram values seem ok - console.log('Telegram seems to be configured correctly in the config.json, no need to run --setuptelegram.'); - process.exit(); -}; diff --git a/meshrelay.js b/meshrelay.js index 7f91904d..aab96b60 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -14,29 +14,27 @@ "use strict"; // Mesh Rights -const MESHRIGHT_EDITMESH = 0x00000001; // 1 -const MESHRIGHT_MANAGEUSERS = 0x00000002; // 2 -const MESHRIGHT_MANAGECOMPUTERS = 0x00000004; // 4 -const MESHRIGHT_REMOTECONTROL = 0x00000008; // 8 -const MESHRIGHT_AGENTCONSOLE = 0x00000010; // 16 -const MESHRIGHT_SERVERFILES = 0x00000020; // 32 -const MESHRIGHT_WAKEDEVICE = 0x00000040; // 64 -const MESHRIGHT_SETNOTES = 0x00000080; // 128 -const MESHRIGHT_REMOTEVIEWONLY = 0x00000100; // 256 -const MESHRIGHT_NOTERMINAL = 0x00000200; // 512 -const MESHRIGHT_NOFILES = 0x00000400; // 1024 -const MESHRIGHT_NOAMT = 0x00000800; // 2048 -const MESHRIGHT_DESKLIMITEDINPUT = 0x00001000; // 4096 -const MESHRIGHT_LIMITEVENTS = 0x00002000; // 8192 -const MESHRIGHT_CHATNOTIFY = 0x00004000; // 16384 -const MESHRIGHT_UNINSTALL = 0x00008000; // 32768 -const MESHRIGHT_NODESKTOP = 0x00010000; // 65536 -const MESHRIGHT_REMOTECOMMAND = 0x00020000; // 131072 -const MESHRIGHT_RESETOFF = 0x00040000; // 262144 -const MESHRIGHT_GUESTSHARING = 0x00080000; // 524288 -const MESHRIGHT_DEVICEDETAILS = 0x00100000; // 1048576 -const MESHRIGHT_RELAY = 0x00200000; // 2097152 -const MESHRIGHT_ADMIN = 0xFFFFFFFF; +const MESHRIGHT_EDITMESH = 0x00000001; +const MESHRIGHT_MANAGEUSERS = 0x00000002; +const MESHRIGHT_MANAGECOMPUTERS = 0x00000004; +const MESHRIGHT_REMOTECONTROL = 0x00000008; +const MESHRIGHT_AGENTCONSOLE = 0x00000010; +const MESHRIGHT_SERVERFILES = 0x00000020; +const MESHRIGHT_WAKEDEVICE = 0x00000040; +const MESHRIGHT_SETNOTES = 0x00000080; +const MESHRIGHT_REMOTEVIEWONLY = 0x00000100; +const MESHRIGHT_NOTERMINAL = 0x00000200; +const MESHRIGHT_NOFILES = 0x00000400; +const MESHRIGHT_NOAMT = 0x00000800; +const MESHRIGHT_DESKLIMITEDINPUT = 0x00001000; +const MESHRIGHT_LIMITEVENTS = 0x00002000; +const MESHRIGHT_CHATNOTIFY = 0x00004000; +const MESHRIGHT_UNINSTALL = 0x00008000; +const MESHRIGHT_NODESKTOP = 0x00010000; +const MESHRIGHT_REMOTECOMMAND = 0x00020000; +const MESHRIGHT_RESETOFF = 0x00040000; +const MESHRIGHT_GUESTSHARING = 0x00080000; +const MESHRIGHT_ADMIN = 0xFFFFFFFF; // Protocol: // 1 = Terminal @@ -119,9 +117,6 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { try { sr = parseInt(req.query.slowrelay); } catch (ex) { } if ((typeof sr == 'number') && (sr > 0) && (sr < 1000)) { obj.ws.slowRelay = sr; } } - - // Check if protocol is set in the cookie and if so replace req.query.p but only if its not already set or blank - if ((cookie != null) && (typeof cookie.p == 'number') && (obj.req.query.p === undefined || obj.req.query.p === "")) { obj.req.query.p = cookie.p; } // Mesh Rights const MESHRIGHT_EDITMESH = 1; @@ -445,15 +440,15 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { relayinfo.peer1.sendPeerImage(); } else { // Write the recording file header - parent.parent.debug('relay', 'Relay: Started recording to file: ' + recFullFilename); + parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename); var metadata = { magic: 'MeshCentralRelaySession', ver: 1, userid: sessionUser._id, username: sessionUser.name, sessionid: obj.id, - ipaddr1: ((obj.peer == null) || (obj.peer.req == null)) ? null : obj.peer.req.clientIp, - ipaddr2: (obj.req == null) ? null : obj.req.clientIp, + ipaddr1: (obj.req == null) ? null : obj.req.clientIp, + ipaddr2: ((obj.peer == null) || (obj.peer.req == null)) ? null : obj.peer.req.clientIp, time: new Date().toLocaleString(), protocol: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p), nodeid: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.nodeid) @@ -567,7 +562,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { } else { ws._socket.pause(); // Hold traffic until the other connection parent.parent.debug('relay', 'Relay holding: ' + obj.id + ' (' + obj.req.clientIp + ') ' + (obj.authenticated ? 'Authenticated' : '')); - parent.wsrelays[obj.id] = { peer1: obj, state: 1, timeout: setTimeout(closeBothSides, 15000) }; + parent.wsrelays[obj.id] = { peer1: obj, state: 1, timeout: setTimeout(closeBothSides, 60000) }; } // Check if a peer server has this connection @@ -744,34 +739,32 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { var logfile = ws.logfile; delete ws.logfile; if (peer.ws) { delete peer.ws.logfile; } - setTimeout(function(){ // wait 5 seconds before finishing file for some reason? - recordingEntry(logfile, 3, 0, 'MeshCentralMCREC', function (logfile, tag) { - parent.parent.fs.closeSync(logfile.fd); + recordingEntry(logfile, 3, 0, 'MeshCentralMCREC', function (logfile, tag) { + parent.parent.fs.close(logfile.fd); - // Now that the recording file is closed, check if we need to index this file. - if (domain.sessionrecording.index && domain.sessionrecording.index !== false) { parent.parent.certificateOperations.acceleratorPerformOperation('indexMcRec', tag.logfile.filename); } + // Now that the recording file is closed, check if we need to index this file. + if (domain.sessionrecording.index !== false) { parent.parent.certificateOperations.acceleratorPerformOperation('indexMcRec', tag.logfile.filename); } - // Compute session length - var sessionLength = null; - if (tag.logfile.startTime != null) { sessionLength = Math.round((Date.now() - tag.logfile.startTime) / 1000); } + // Compute session length + var sessionLength = null; + if (tag.logfile.startTime != null) { sessionLength = Math.round((Date.now() - tag.logfile.startTime) / 1000); } - // Add a event entry about this recording - var basefile = parent.parent.path.basename(tag.logfile.filename); - var event = { etype: 'relay', action: 'recording', domain: domain.id, nodeid: tag.logfile.nodeid, msg: "Finished recording session" + (sessionLength ? (', ' + sessionLength + ' second(s)') : ''), filename: basefile, size: tag.logfile.size }; - if (user) { event.userids = [user._id]; } else if (peer.user) { event.userids = [peer.user._id]; } - var xprotocol = (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p); - if ((xprotocol == null) && (logfile.text == 2)) { xprotocol = 200; } - if (xprotocol != null) { event.protocol = parseInt(xprotocol); } - var mesh = parent.meshes[tag.logfile.meshid]; - if (mesh != null) { event.meshname = mesh.name; event.meshid = mesh._id; } - if (tag.logfile.startTime) { event.startTime = tag.logfile.startTime; event.lengthTime = sessionLength; } - if (tag.logfile.name) { event.name = tag.logfile.name; } - if (tag.logfile.icon) { event.icon = tag.logfile.icon; } - parent.parent.DispatchEvent(['*', 'recording', tag.logfile.nodeid, tag.logfile.meshid], obj, event); + // Add a event entry about this recording + var basefile = parent.parent.path.basename(tag.logfile.filename); + var event = { etype: 'relay', action: 'recording', domain: domain.id, nodeid: tag.logfile.nodeid, msg: "Finished recording session" + (sessionLength ? (', ' + sessionLength + ' second(s)') : ''), filename: basefile, size: tag.logfile.size }; + if (user) { event.userids = [user._id]; } else if (peer.user) { event.userids = [peer.user._id]; } + var xprotocol = (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p); + if ((xprotocol == null) && (logfile.text == 2)) { xprotocol = 200; } + if (xprotocol != null) { event.protocol = parseInt(xprotocol); } + var mesh = parent.meshes[tag.logfile.meshid]; + if (mesh != null) { event.meshname = mesh.name; event.meshid = mesh._id; } + if (tag.logfile.startTime) { event.startTime = tag.logfile.startTime; event.lengthTime = sessionLength; } + if (tag.logfile.name) { event.name = tag.logfile.name; } + if (tag.logfile.icon) { event.icon = tag.logfile.icon; } + parent.parent.DispatchEvent(['*', 'recording', tag.logfile.nodeid, tag.logfile.meshid], obj, event); - cleanUpRecordings(); - }, { ws: ws, pws: peer.ws, logfile: logfile }); - },5000); + cleanUpRecordings(); + }, { ws: ws, pws: peer.ws, logfile: logfile }); } try { ws.close(); } catch (ex) { } @@ -875,8 +868,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (docs.length == 0) { console.log('ERR: Node not found'); try { obj.close(); } catch (e) { } return; } // Disconnect websocket const node = docs[0]; - // Check if this user has permission to relay thru this computer (MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY rights) - if ((obj.nouser !== true) && ((parent.GetNodeRights(obj.user, node.meshid, node._id) & 0x00200008) == 0)) { console.log('ERR: Access denied (1)'); try { obj.close(); } catch (ex) { } return; } + // Check if this user has permission to manage this computer + if ((obj.nouser !== true) && ((parent.GetNodeRights(user, node.meshid, node._id) & MESHRIGHT_REMOTECONTROL) == 0)) { console.log('ERR: Access denied (1)'); try { obj.close(); } catch (e) { } return; } // Set nodeid and meshid obj.nodeid = node._id; @@ -886,8 +879,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { const rcookieData = {}; if (user != null) { rcookieData.ruserid = user._id; } else if (obj.nouser === true) { rcookieData.nouser = 1; } const rcookie = parent.parent.encodeCookie(rcookieData, parent.parent.loginCookieEncryptionKey); - if (obj.id == null) { obj.id = parent.crypto.randomBytes(9).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); } // If there is no connection id, generate one. - const command = { nodeid: cookie.nodeid, action: 'msg', type: 'tunnel', value: '*/' + xdomain + 'meshrelay.ashx?' + (obj.req.query.p != null ? ('p=' + obj.req.query.p + '&') : '') + 'id=' + obj.id + '&rauth=' + rcookie, tcpport: cookie.tcpport, tcpaddr: cookie.tcpaddr, soptions: {} }; + if (obj.id == null) { obj.id = ('' + Math.random()).substring(2); } // If there is no connection id, generate one. + const command = { nodeid: cookie.nodeid, action: 'msg', type: 'tunnel', value: '*/' + xdomain + 'meshrelay.ashx?id=' + obj.id + '&rauth=' + rcookie, tcpport: cookie.tcpport, tcpaddr: cookie.tcpaddr, soptions: {} }; if (user) { command.userid = user._id; } if (typeof domain.consentmessages == 'object') { if (typeof domain.consentmessages.title == 'string') { command.soptions.consentTitle = domain.consentmessages.title; } @@ -896,8 +889,6 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; } if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; } if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; } - if (domain.consentmessages.autoacceptifnouser === true) { command.soptions.consentAutoAcceptIfNoUser = true; } - if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; } } if (typeof domain.notificationmessages == 'object') { if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; } @@ -916,18 +907,19 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (docs.length == 0) { console.log('ERR: Node not found'); try { obj.close(); } catch (e) { } return; } // Disconnect websocket const node = docs[0]; - // Check if this user has permission to relay thru this computer (MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY rights) - if ((parent.GetNodeRights(obj.user, node.meshid, node._id) & 0x00200008) == 0) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (ex) { } return; } + // Check if this user has permission to manage this computer + if ((parent.GetNodeRights(user, node.meshid, node._id) & MESHRIGHT_REMOTECONTROL) == 0) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (e) { } return; } // Set nodeid and meshid obj.nodeid = node._id; obj.meshid = node.meshid; // Send connection request to agent - if (obj.id == null) { obj.id = parent.crypto.randomBytes(9).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); } // If there is no connection id, generate one. + if (obj.id == null) { obj.id = ('' + Math.random()).substring(2); } // If there is no connection id, generate one. const rcookie = parent.parent.encodeCookie({ ruserid: user._id }, parent.parent.loginCookieEncryptionKey); + if (obj.req.query.tcpport != null) { - const command = { nodeid: obj.req.query.nodeid, action: 'msg', type: 'tunnel', userid: user._id, value: '*/' + xdomain + 'meshrelay.ashx?' + (obj.req.query.p != null ? ('p=' + obj.req.query.p + '&') : '') + 'id=' + obj.id + '&rauth=' + rcookie, tcpport: obj.req.query.tcpport, tcpaddr: ((obj.req.query.tcpaddr == null) ? '127.0.0.1' : obj.req.query.tcpaddr), soptions: {} }; + const command = { nodeid: obj.req.query.nodeid, action: 'msg', type: 'tunnel', userid: user._id, value: '*/' + xdomain + 'meshrelay.ashx?id=' + obj.id + '&rauth=' + rcookie, tcpport: obj.req.query.tcpport, tcpaddr: ((obj.req.query.tcpaddr == null) ? '127.0.0.1' : obj.req.query.tcpaddr), soptions: {} }; if (typeof domain.consentmessages == 'object') { if (typeof domain.consentmessages.title == 'string') { command.soptions.consentTitle = domain.consentmessages.title; } if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; } @@ -935,8 +927,6 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; } if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; } if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; } - if (domain.consentmessages.autoacceptifnouser === true) { command.soptions.consentAutoAcceptIfNoUser = true; } - if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; } } if (typeof domain.notificationmessages == 'object') { if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; } @@ -947,15 +937,14 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { parent.parent.debug('relay', 'Relay: Sending agent TCP tunnel command: ' + JSON.stringify(command)); if (obj.sendAgentMessage(command, user._id, domain.id) == false) { delete obj.id; parent.parent.debug('relay', 'Relay: Unable to contact this agent (' + obj.req.clientIp + ')'); } } else if (obj.req.query.udpport != null) { - const command = { nodeid: obj.req.query.nodeid, action: 'msg', type: 'tunnel', userid: user._id, value: '*/' + xdomain + 'meshrelay.ashx?' + (obj.req.query.p != null ? ('p=' + obj.req.query.p + '&') : '') + 'id=' + obj.id + '&rauth=' + rcookie, udpport: obj.req.query.udpport, udpaddr: ((obj.req.query.udpaddr == null) ? '127.0.0.1' : obj.req.query.udpaddr), soptions: {} }; if (typeof domain.consentmessages == 'object') { + const command = { nodeid: obj.req.query.nodeid, action: 'msg', type: 'tunnel', userid: user._id, value: '*/' + xdomain + 'meshrelay.ashx?id=' + obj.id + '&rauth=' + rcookie, udpport: obj.req.query.udpport, udpaddr: ((obj.req.query.udpaddr == null) ? '127.0.0.1' : obj.req.query.udpaddr), soptions: {} }; + if (typeof domain.consentmessages == 'object') { if (typeof domain.consentmessages.title == 'string') { command.soptions.consentTitle = domain.consentmessages.title; } if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; } if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; } if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; } if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; } if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; } - if (domain.consentmessages.autoacceptifnouser === true) { command.soptions.consentAutoAcceptIfNoUser = true; } - if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; } } if (typeof domain.notificationmessages == 'object') { if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; } @@ -975,15 +964,15 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (docs.length == 0) { console.log('ERR: Node not found'); try { obj.close(); } catch (e) { } return; } // Disconnect websocket const node = docs[0]; - // Check if this user has permission to relay thru this computer (MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY rights) - if ((obj.nouser !== true) && ((parent.GetNodeRights(obj.user, node.meshid, node._id) & 0x00200008) == 0)) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (ex) { } return; } + // Check if this user has permission to manage this computer + if ((obj.nouser !== true) && ((parent.GetNodeRights(user, node.meshid, node._id) & MESHRIGHT_REMOTECONTROL) == 0)) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (e) { } return; } // Set nodeid and meshid obj.nodeid = node._id; obj.meshid = node.meshid; // Send connection request to agent - if (obj.id == null) { obj.id = parent.crypto.randomBytes(9).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); } // If there is no connection id, generate one. + if (obj.id == null) { obj.id = ('' + Math.random()).substring(2); } const rcookieData = { nodeid: node._id }; if (user != null) { rcookieData.ruserid = user._id; } else if (obj.nouser === true) { rcookieData.nouser = 1; } const rcookie = parent.parent.encodeCookie(rcookieData, parent.parent.loginCookieEncryptionKey); @@ -1007,8 +996,6 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; } if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; } if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; } - if (domain.consentmessages.autoacceptifnouser === true) { command.soptions.consentAutoAcceptIfNoUser = true; } - if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; } } if (typeof domain.notificationmessages == 'object') { if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; } @@ -1031,8 +1018,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { if (docs.length == 0) { console.log('ERR: Node not found'); try { obj.close(); } catch (e) { } return; } // Disconnect websocket const node = docs[0]; - // Check if this user has permission to relay thru this computer (MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY rights) - if ((parent.GetNodeRights(obj.user, node.meshid, node._id) & 0x00200008) == 0) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (ex) { } return; } + // Check if this user has permission to manage this computer + if ((parent.GetNodeRights(user, node.meshid, node._id) & MESHRIGHT_REMOTECONTROL) == 0) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (e) { } return; } // Set nodeid and meshid obj.nodeid = node._id; @@ -1131,7 +1118,7 @@ module.exports.CreateLocalRelay = function (parent, ws, req, domain, user, cooki function CreateLocalRelayEx(parent, ws, req, domain, user, cookie) { const net = require('net'); var obj = {}; - obj.id = parent.crypto.randomBytes(9).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + obj.id = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64'); obj.req = req; obj.ws = ws; obj.user = user; @@ -1237,7 +1224,6 @@ function CreateLocalRelayEx(parent, ws, req, domain, user, cookie) { else if (req.query.p == 11) { protocolStr = 'SSH-TERM'; } else if (req.query.p == 12) { protocolStr = 'VNC'; } else if (req.query.p == 13) { protocolStr = 'SSH-FILES'; } - else if (req.query.p == 14) { protocolStr = 'Web-TCP'; } var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: obj.user._id, username: obj.user.name, msgid: 121, msgArgs: [obj.id, protocolStr, obj.host, Math.floor((Date.now() - obj.time) / 1000)], msg: 'Ended local relay session \"' + obj.id + '\", protocol ' + protocolStr + ' to ' + obj.host + ', ' + Math.floor((Date.now() - obj.time) / 1000) + ' second(s)', nodeid: obj.req.query.nodeid, protocol: req.query.p, in: inTraffc, out: outTraffc }; if (obj.guestname) { event.guestname = obj.guestname; } // If this is a sharing session, set the guest name here. parent.parent.DispatchEvent(['*', user._id], obj, event); @@ -1278,8 +1264,8 @@ function CreateLocalRelayEx(parent, ws, req, domain, user, cookie) { obj.host = node.host; obj.meshid = node.meshid; - // Check if this user has permission to relay thru this computer (MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY rights) - if ((parent.GetNodeRights(obj.user, node.meshid, node._id) & 0x00200008) == 0) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (ex) { } return; } + // Check if this user has permission to manage this computer + if ((parent.GetNodeRights(obj.user, node.meshid, node._id) & MESHRIGHT_REMOTECONTROL) == 0) { console.log('ERR: Access denied (2)'); try { obj.close(); } catch (e) { } return; } // Setup TCP client obj.client = new net.Socket(); @@ -1292,7 +1278,6 @@ function CreateLocalRelayEx(parent, ws, req, domain, user, cookie) { else if (req.query.p == 11) { protocolStr = 'SSH-TERM'; } else if (req.query.p == 12) { protocolStr = 'VNC'; } else if (req.query.p == 13) { protocolStr = 'SSH-FILES'; } - else if (req.query.p == 14) { protocolStr = 'Web-TCP'; } obj.time = Date.now(); var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: obj.user._id, username: obj.user.name, msgid: 120, msgArgs: [obj.id, protocolStr, obj.host], msg: 'Started local relay session \"' + obj.id + '\", protocol ' + protocolStr + ' to ' + obj.host, nodeid: req.query.nodeid, protocol: req.query.p }; if (obj.guestname) { event.guestname = obj.guestname; } // If this is a sharing session, set the guest name here. @@ -1331,4 +1316,4 @@ function CreateLocalRelayEx(parent, ws, req, domain, user, cookie) { // If this is not an authenticated session, or the session does not have routing instructions, just go ahead an connect to existing session. performRelay(); return obj; -}; +}; \ No newline at end of file diff --git a/meshsms.js b/meshsms.js index 1746c23e..e2b2b7ce 100644 --- a/meshsms.js +++ b/meshsms.js @@ -37,15 +37,9 @@ "apikey": "xxxxxxx", "from": "15555555555" } - -// For URL, add this in config.json -"sms": { - "provider": "url", - "url": "https://sample.com/?phone={{phone}}&msg={{message}}" -} */ -// Construct a SMS server object +// Construct a MeshAgent object, called upon connection module.exports.CreateMeshSMS = function (parent) { var obj = {}; obj.parent = parent; @@ -84,16 +78,6 @@ module.exports.CreateMeshSMS = function (parent) { obj.provider = require('telnyx')(parent.config.sms.apikey); break; } - case 'url': { - // Validate URL configuration values - if (parent.config.sms.url != 'console') { - if (typeof parent.config.sms.url != 'string') { console.log('Invalid or missing SMS gateway URL value.'); return null; } - if (!parent.config.sms.url.toLowerCase().startsWith('http://') && !parent.config.sms.url.toLowerCase().startsWith('https://')) { console.log('Invalid or missing SMS gateway, URL must start with http:// or https://.'); return null; } - if (parent.config.sms.url.indexOf('{{message}}') == -1) { console.log('Invalid or missing SMS gateway, URL must include {{message}}.'); return null; } - if (parent.config.sms.url.indexOf('{{phone}}') == -1) { console.log('Invalid or missing SMS gateway, URL must include {{phone}}.'); return null; } - } - break; - } default: { // Unknown SMS gateway provider console.log('Unknown SMS gateway provider: ' + parent.config.sms.provider); @@ -139,29 +123,6 @@ module.exports.CreateMeshSMS = function (parent) { if (err != null) { parent.debug('email', 'SMS error: ' + err.type); } else { parent.debug('email', 'SMS result: ' + JSON.stringify(result)); } if (func != null) { func((err == null), err ? err.type : null, result); } }); - } else if (parent.config.sms.provider == 'url') { // URL - if (parent.config.sms.url == 'console') { - // This is for debugging, just display the SMS to the console - console.log('SMS (' + to + '): ' + msg); - if (func != null) { func(true, null, null); } - } else { - var sms = parent.config.sms.url.split('{{phone}}').join(encodeURIComponent(to)).split('{{message}}').join(encodeURIComponent(msg)); - parent.debug('email', 'SMS URL: ' + sms); - sms = require('url').parse(sms); - if (sms.protocol == 'https:') { - // HTTPS GET request - const options = { hostname: sms.hostname, port: sms.port ? sms.port : 443, path: sms.path, method: 'GET', rejectUnauthorized: false }; - const request = require('https').request(options, function (res) { parent.debug('email', 'SMS result: ' + res.statusCode); if (func != null) { func(res.statusCode == 200, (res.statusCode == 200) ? null : res.statusCode, null); } res.on('data', function (d) { }); }); - request.on('error', function (err) { parent.debug('email', 'SMS error: ' + err); if (func != null) { func(false, err, null); } }); - request.end(); - } else { - // HTTP GET request - const options = { hostname: sms.hostname, port: sms.port ? sms.port : 80, path: sms.path, method: 'GET' }; - const request = require('http').request(options, function (res) { parent.debug('email', 'SMS result: ' + res.statusCode); if (func != null) { func(res.statusCode == 200, (res.statusCode == 200) ? null : res.statusCode, null); } res.on('data', function (d) { }); }); - request.on('error', function (err) { parent.debug('email', 'SMS error: ' + err); if (func != null) { func(false, err, null); } }); - request.end(); - } - } } } diff --git a/meshuser.js b/meshuser.js index ac237dfd..aa2fe965 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1,4 +1,4 @@ -/** +/** * @description MeshCentral MeshAgent * @author Ylian Saint-Hilaire & Bryan Roe * @copyright Intel Corporation 2018-2022 @@ -52,7 +52,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use const MESHRIGHT_RESETOFF = 0x00040000; // 262144 const MESHRIGHT_GUESTSHARING = 0x00080000; // 524288 const MESHRIGHT_DEVICEDETAILS = 0x00100000; // 1048576 - const MESHRIGHT_RELAY = 0x00200000; // 2097152 const MESHRIGHT_ADMIN = 0xFFFFFFFF; // Site rights @@ -84,7 +83,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use const PROTOCOL_WEBVNC = 204; // MeshCentral Satellite - const SATELLITE_PRESENT = 1; // This session is a MeshCentral Satellite session + const SATELLITE_PRESENT = 1; // This session is a MeshCentral Salellite session const SATELLITE_802_1x = 2; // This session supports 802.1x profile checking and creation // Events @@ -106,12 +105,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use obj.domain = domain; obj.ws = ws; - // Information related to the current page the user is looking at - obj.deviceSkip = 0; // How many devices to skip - obj.deviceLimit = 0; // How many devices to view - obj.visibleDevices = null; // An object of visible nodeid's if the user is in paging mode - if (domain.maxdeviceview != null) { obj.deviceLimit = domain.maxdeviceview; } - // Check if we are a cross-domain administrator if (parent.parent.config.settings.managecrossdomain && (parent.parent.config.settings.managecrossdomain.indexOf(user._id) >= 0)) { obj.crossDomain = true; } @@ -421,9 +414,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // If this session is logged in using a loginToken and the token is removed, disconnect. if ((req.session.loginToken != null) && (typeof event == 'object') && (event.action == 'loginTokenChanged') && (event.removed != null) && (event.removed.indexOf(req.session.loginToken) >= 0)) { delete req.session; obj.close(); return; } - // If this user is not viewing all devices and paging, check if this event is in the current page - if (isEventWithinPage(ids) == false) return; - // Normally, only allow this user to receive messages from it's own domain. // If the user is a cross domain administrator, allow some select messages from different domains. if ((event.domain == null) || (event.domain == domain.id) || ((obj.crossDomain === true) && (allowedCrossDomainMessages.indexOf(event.action) >= 0))) { @@ -564,9 +554,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } if (matchingDomains.length > 0) { serverinfo.amtAcmFqdn = matchingDomains; } } + if ((typeof domain.altmessenging == 'object') && (typeof domain.altmessenging.name == 'string') && (typeof domain.altmessenging.url == 'string')) { serverinfo.altmessenging = [{ name: domain.altmessenging.name, url: domain.altmessenging.url, localurl: domain.altmessenging.localurl }]; } if (typeof domain.devicemeshrouterlinks == 'object') { serverinfo.devicemeshrouterlinks = domain.devicemeshrouterlinks; } - if ((typeof domain.altmessenging == 'object') && (typeof domain.altmessenging.name == 'string') && (typeof domain.altmessenging.url == 'string')) { serverinfo.altmessenging = [{ name: domain.altmessenging.name, url: domain.altmessenging.url, localurl: domain.altmessenging.localurl, type: domain.altmessenging.type }]; } - if (Array.isArray(domain.altmessenging)) { serverinfo.altmessenging = []; for (var i in domain.altmessenging) { if ((typeof domain.altmessenging[i] == 'object') && (typeof domain.altmessenging[i].name == 'string') && (typeof domain.altmessenging[i].url == 'string')) { serverinfo.altmessenging.push({ name: domain.altmessenging[i].name, url: domain.altmessenging[i].url, type: domain.altmessenging[i].type }); } } } + if (Array.isArray(domain.altmessenging)) { serverinfo.altmessenging = []; for (var i in domain.altmessenging) { if ((typeof domain.altmessenging[i] == 'object') && (typeof domain.altmessenging[i].name == 'string') && (typeof domain.altmessenging[i].url == 'string')) { serverinfo.altmessenging.push({ name: domain.altmessenging[i].name, url: domain.altmessenging[i].url }); } } } serverinfo.https = true; serverinfo.redirport = args.redirport; if (parent.parent.webpush != null) { serverinfo.vapidpublickey = parent.parent.webpush.vapidPublicKey; } // Web push public key @@ -576,16 +566,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (domain.passwordrequirements.lock2factor == true) { serverinfo.lock2factor = true; } // Indicate 2FA change are not allowed if (typeof domain.passwordrequirements.maxfidokeys == 'number') { serverinfo.maxfidokeys = domain.passwordrequirements.maxfidokeys; } } - if (parent.parent.msgserver != null) { // Setup messaging providers information - serverinfo.userMsgProviders = parent.parent.msgserver.providers; - if (parent.parent.msgserver.discordUrl != null) { serverinfo.discordUrl = parent.parent.msgserver.discordUrl; } - } - if ((typeof parent.parent.config.messaging == 'object') && (typeof parent.parent.config.messaging.ntfy == 'object') && (typeof parent.parent.config.messaging.ntfy.userurl == 'string')) { // nfty user url - serverinfo.userMsgNftyUrl = parent.parent.config.messaging.ntfy.userurl; - } // Build the mobile agent URL, this is used to connect mobile devices - var agentServerName = parent.getWebServerName(domain, req); + var agentServerName = parent.getWebServerName(domain); if (typeof parent.args.agentaliasdns == 'string') { agentServerName = parent.args.agentaliasdns; } var xdomain = (domain.dns == null) ? domain.id : ''; var agentHttpsPort = ((parent.args.aliasport == null) ? parent.args.port : parent.args.aliasport); // Use HTTPS alias port is specified @@ -600,13 +583,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } } if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; } - if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) {serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); } - if (typeof domain.logoutonidlesessiontimeout == 'boolean') { - serverinfo.logoutonidlesessiontimeout = domain.logoutonidlesessiontimeout; - } else { - // Default - serverinfo.logoutonidlesessiontimeout = true; - } + if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) { serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); } if (user.siteadmin === SITERIGHT_ADMIN) { if (parent.parent.config.settings.managealldevicegroups.indexOf(user._id) >= 0) { serverinfo.manageAllDeviceGroups = true; } if (obj.crossDomain === true) { serverinfo.crossDomain = []; for (var i in parent.parent.config.domains) { serverinfo.crossDomain.push(i); } } @@ -616,19 +593,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if ((typeof domain.terminal.linuxshell == 'string') && (domain.terminal.linuxshell != 'any')) { serverinfo.linuxshell = domain.terminal.linuxshell; } } if (Array.isArray(domain.preconfiguredremoteinput)) { serverinfo.preConfiguredRemoteInput = domain.preconfiguredremoteinput; } - if (Array.isArray(domain.preconfiguredscripts)) { - const r = []; - for (var i in domain.preconfiguredscripts) { - const types = ['', 'bat', 'ps1', 'sh', 'agent']; // 1 = Windows Command, 2 = Windows PowerShell, 3 = Linux, 4 = Agent - const script = domain.preconfiguredscripts[i]; - if ((typeof script.name == 'string') && (script.name.length <= 32) && (typeof script.type == 'string') && ((typeof script.file == 'string') || (typeof script.cmd == 'string'))) { - const s = { name: script.name, type: types.indexOf(script.type.toLowerCase()) }; - if (s.type > 0) { r.push(s); } - } - } - serverinfo.preConfiguredScripts = r; - } - if (domain.maxdeviceview != null) { serverinfo.maxdeviceview = domain.maxdeviceview; } // Maximum number of devices a user can view at any given time // Send server information try { ws.send(JSON.stringify({ action: 'serverinfo', serverinfo: serverinfo })); } catch (ex) { } @@ -691,13 +655,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use switch (command.action) { case 'nodes': { - // If in paging mode, look to set the skip and limit values - if (domain.maxdeviceview != null) { - if ((typeof command.skip == 'number') && (command.skip >= 0)) { obj.deviceSkip = command.skip; } - if ((typeof command.limit == 'number') && (command.limit > 0)) { obj.deviceLimit = command.limit; } - if (obj.deviceLimit > domain.maxdeviceview) { obj.deviceLimit = domain.maxdeviceview; } - } - var links = [], extraids = null, err = null; // Resolve the device group name if needed @@ -737,21 +694,17 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } // Request a list of all nodes - db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', command.id, obj.deviceSkip, obj.deviceLimit, function (err, docs) { + db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', command.id, function (err, docs) { - //console.log(err, docs, links, extraids, domain.id, 'node', command.id); + //console.log(err, docs); if (docs == null) { docs = []; } parent.common.unEscapeAllLinksFieldName(docs); - var r = {}, nodeCount = docs.length; - if (domain.maxdeviceview != null) { obj.visibleDevices = {}; } + var r = {}; for (i in docs) { // Check device links, if a link points to an unknown user, remove it. - parent.cleanDevice(docs[i]); // TODO: This will make the total device count incorrect and will affect device paging. - - // If we are paging, add the device to the page here - if (domain.maxdeviceview != null) { obj.visibleDevices[docs[i]._id] = 1; } + parent.cleanDevice(docs[i]); // Remove any connectivity and power state information, that should not be in the database anyway. // TODO: Find why these are sometimes saved in the db. @@ -784,10 +737,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Remove SSH credentials if present if (docs[i].ssh != null) { - if ((docs[i].ssh[user._id] != null) && (docs[i].ssh[user._id].u)) { - if (docs[i].ssh.k && docs[i].ssh[user._id].kp) { docs[i].ssh = 2; } // Username, key and password - else if (docs[i].ssh[user._id].k) { docs[i].ssh = 3; } // Username and key. No password. - else if (docs[i].ssh[user._id].p) { docs[i].ssh = 1; } // Username and password + if ((docs[i].ssh[obj.user._id] != null) && (docs[i].ssh[obj.user._id].u)) { + if (docs[i].ssh.k && docs[i].ssh[obj.user._id].kp) { docs[i].ssh = 2; } // Username, key and password + else if (docs[i].ssh[obj.user._id].k) { docs[i].ssh = 3; } // Username and key. No password. + else if (docs[i].ssh[obj.user._id].p) { docs[i].ssh = 1; } // Username and password else { delete docs[i].ssh; } } else { delete docs[i].ssh; @@ -795,7 +748,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } // Remove RDP credentials if present, only set to 1 if our userid has RDP credentials - if ((docs[i].rdp != null) && (docs[i].rdp[user._id] != null)) { docs[i].rdp = 1; } else { delete docs[i].rdp; } + if ((docs[i].rdp != null) && (docs[i].rdp[obj.user._id] != null)) { docs[i].rdp = 1; } else { delete docs[i].rdp; } // Remove Intel AMT credential if present if (docs[i].intelamt != null) { @@ -821,48 +774,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if ((xipkvmport != null) && (xipkvmport.sessions != null)) { docs[i].sessions = xipkvmport.sessions; } } - // Patch node links with names, like meshes links with names - for (var a in docs[i].links) { - if (!docs[i].links[a].name) { - if (parent.users[a] && parent.users[a].realname) { docs[i].links[a].name = parent.users[a].realname; } - else if (parent.users[a] && parent.users[a].name) { docs[i].links[a].name = parent.users[a].name; } - } - } - r[meshid].push(docs[i]); } - const response = { action: 'nodes', responseid: command.responseid, nodes: r, tag: command.tag }; - if (domain.maxdeviceview != null) { - // If in paging mode, report back the skip and limit values - response.skip = obj.deviceSkip; - response.limit = obj.deviceLimit; - - // Add total device count - // Only set response.totalcount if we need to be in paging mode - if (nodeCount < response.limit) { - if (obj.deviceSkip > 0) { response.totalcount = obj.deviceSkip + nodeCount; } else { obj.visibleDevices = null; } - try { ws.send(JSON.stringify(response)); } catch (ex) { } - } else { - // Ask the database for the total device count - if (db.CountAllTypeNoTypeFieldMeshFiltered) { - db.CountAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', command.id, function (err, count) { - if ((err != null) || (typeof count != 'number') || ((obj.deviceSkip == 0) && (count < obj.deviceLimit))) { - obj.visibleDevices = null; - } else { - response.totalcount = count; - } - try { ws.send(JSON.stringify(response)); } catch (ex) { } - }); - } else { - // The database does not support device counting - obj.visibleDevices = null; // We are not in paging mode - try { ws.send(JSON.stringify(response)); } catch (ex) { } - } - } - } else { - obj.visibleDevices = null; // We are not in paging mode - try { ws.send(JSON.stringify(response)); } catch (ex) { } - } + try { ws.send(JSON.stringify({ action: 'nodes', responseid: command.responseid, nodes: r, tag: command.tag })); } catch (ex) { } }); break; } @@ -871,15 +785,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Check permissions if ((user.siteadmin & 8) != 0) { // Perform a file operation (Create Folder, Delete Folder, Delete File...) - if (common.validateString(command.fileop, 3, 16) == false) return; + if (common.validateString(command.fileop, 4, 16) == false) return; var sendUpdate = true, path = meshPathToRealPath(command.path, user); // This will also check access rights if (path == null) break; if ((command.fileop == 'createfolder') && (common.IsFilenameValid(command.newfolder) == true)) { // Create a new folder - try { fs.mkdirSync(parent.path.join(path, command.newfolder)); } catch (ex) { + try { fs.mkdirSync(path + '/' + command.newfolder); } catch (ex) { try { fs.mkdirSync(path); } catch (ex) { } - try { fs.mkdirSync(parent.path.join(path, command.newfolder)); } catch (ex) { } + try { fs.mkdirSync(path + '/' + command.newfolder); } catch (ex) { } } } else if (command.fileop == 'delete') { @@ -908,47 +822,23 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } else if ((command.fileop == 'rename') && (common.IsFilenameValid(command.oldname) === true) && (common.IsFilenameValid(command.newname) === true)) { // Rename - try { fs.renameSync(parent.path.join(path, command.oldname), parent.path.join(path, command.newname)); } catch (e) { } + try { fs.renameSync(path + '/' + command.oldname, path + '/' + command.newname); } catch (e) { } } else if ((command.fileop == 'copy') || (command.fileop == 'move')) { // Copy or move of one or many files if (common.validateArray(command.names, 1) == false) return; var scpath = meshPathToRealPath(command.scpath, user); // This will also check access rights if (scpath == null) break; - // TODO: Check quota if this is a copy + // TODO: Check quota if this is a copy!!!!!!!!!!!!!!!! for (i in command.names) { if (common.IsFilenameValid(command.names[i]) === true) { var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]); sendUpdate = false; - try { fs.mkdirSync(path); } catch (ex) { } // try to create folder first incase folder is missing copyFile(s, d, function (op) { if (op != null) { fs.unlink(op, function (err) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null)); } } - } else if (command.fileop == 'get') { - // Get a short file and send it back on the web socket - if (common.validateString(command.file, 1, 4096) == false) return; - const scpath = meshPathToRealPath(command.path, user); // This will also check access rights - if ((scpath == null) || (command.file !== parent.path.basename(command.file))) break; - const filePath = parent.path.join(scpath, command.file); - fs.stat(filePath, function (err, stat) { - if ((err != null) || (stat == null) || (stat.size >= 204800)) return; - fs.readFile(filePath, function (err, data) { - if ((err != null) || (data == null)) return; - command.data = data.toString('base64'); - ws.send(JSON.stringify(command)); // Send the file data back, base64 encoded. - }); - }); - } else if (command.fileop == 'set') { - // Set a short file transfered on the web socket - if (common.validateString(command.file, 1, 4096) == false) return; - if (typeof command.data != 'string') return; - const scpath = meshPathToRealPath(command.path, user); // This will also check access rights - if ((scpath == null) || (command.file !== parent.path.basename(command.file))) break; - const filePath = parent.path.join(scpath, command.file); - var data = null; - try { data = Buffer.from(command.data, 'base64'); } catch (ex) { return; } - fs.writeFile(filePath, data, function (err) { if (err == null) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }); } + if (sendUpdate == true) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } // Fire an event causing this user to update this files } break; @@ -1003,8 +893,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; } if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; } if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; } - if (domain.consentmessages.autoacceptifnouser === true) { command.soptions.consentAutoAcceptIfNoUser = true; } - if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; } } if (typeof domain.notificationmessages == 'object') { if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; } @@ -1038,20 +926,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // TODO: Add the meshes command.userid has access to (???) var filter = [command.userid]; - var actionfilter = null; - if (command.filter != null) { - if (['agentlog','batchupload','changenode','manual','relaylog','removenode','runcommands'].includes(command.filter)) actionfilter = command.filter; - } - if ((command.limit == null) || (typeof command.limit != 'number')) { // Send the list of all events for this session - db.GetUserEvents(filter, domain.id, command.userid, actionfilter, function (err, docs) { + db.GetUserEvents(filter, domain.id, command.userid, function (err, docs) { if (err != null) return; try { ws.send(JSON.stringify({ action: 'events', events: docs, userid: command.userid, tag: command.tag })); } catch (ex) { } }); } else { // Send the list of most recent events for this session, up to 'limit' count - db.GetUserEventsWithLimit(filter, domain.id, command.userid, command.limit, actionfilter, function (err, docs) { + db.GetUserEventsWithLimit(filter, domain.id, command.userid, command.limit, function (err, docs) { if (err != null) return; try { ws.send(JSON.stringify({ action: 'events', events: docs, userid: command.userid, tag: command.tag })); } catch (ex) { } }); @@ -1069,20 +952,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var limit = 10000; if (common.validateInt(command.limit, 1, 1000000) == true) { limit = command.limit; } - var filter = null; - if (command.filter != null) { - if (['agentlog','batchupload','changenode','manual','relaylog','removenode','runcommands'].includes(command.filter)) filter = command.filter; - } - if (((rights & MESHRIGHT_LIMITEVENTS) != 0) && (rights != MESHRIGHT_ADMIN)) { // Send the list of most recent events for this nodeid that only apply to us, up to 'limit' count - db.GetNodeEventsSelfWithLimit(node._id, domain.id, user._id, limit, filter, function (err, docs) { + db.GetNodeEventsSelfWithLimit(node._id, domain.id, user._id, limit, function (err, docs) { if (err != null) return; try { ws.send(JSON.stringify({ action: 'events', events: docs, nodeid: node._id, tag: command.tag })); } catch (ex) { } }); } else { // Send the list of most recent events for this nodeid, up to 'limit' count - db.GetNodeEventsWithLimit(node._id, domain.id, limit, filter, function (err, docs) { + db.GetNodeEventsWithLimit(node._id, domain.id, limit, function (err, docs) { if (err != null) return; try { ws.send(JSON.stringify({ action: 'events', events: docs, nodeid: node._id, tag: command.tag })); } catch (ex) { } }); @@ -1102,20 +980,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use for (var link in obj.user.links) { if (((obj.user.links[link].rights & MESHRIGHT_LIMITEVENTS) != 0) && ((obj.user.links[link].rights != MESHRIGHT_ADMIN))) { exGroupFilter2.push(link); } } for (var i in filter2) { if (exGroupFilter2.indexOf(filter2[i]) == -1) { filter.push(filter2[i]); } } - var actionfilter = null; - if (command.filter != null) { - if (['agentlog','batchupload','changenode','manual','relaylog','removenode','runcommands'].includes(command.filter)) actionfilter = command.filter; - } - if ((command.limit == null) || (typeof command.limit != 'number')) { // Send the list of all events for this session - db.GetEvents(filter, domain.id, actionfilter, function (err, docs) { + db.GetEvents(filter, domain.id, function (err, docs) { if (err != null) return; try { ws.send(JSON.stringify({ action: 'events', events: docs, user: command.user, tag: command.tag })); } catch (ex) { } }); } else { // Send the list of most recent events for this session, up to 'limit' count - db.GetEventsWithLimit(filter, domain.id, command.limit, actionfilter, function (err, docs) { + db.GetEventsWithLimit(filter, domain.id, command.limit, function (err, docs) { if (err != null) return; try { ws.send(JSON.stringify({ action: 'events', events: docs, user: command.user, tag: command.tag })); } catch (ex) { } }); @@ -1129,11 +1002,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (domain.sessionrecording.filepath) { recordingsPath = domain.sessionrecording.filepath; } else { recordingsPath = parent.parent.recordpath; } if (recordingsPath == null) return; fs.readdir(recordingsPath, function (err, files) { - if (err != null) { try { ws.send(JSON.stringify({ action: 'recordings', error: 1, tag: command.tag })); } catch (ex) { } return; } + if (err != null) return; if ((command.limit == null) || (typeof command.limit != 'number')) { // Send the list of all recordings - db.GetEvents(['recording'], domain.id, null, function (err, docs) { - if (err != null) { try { ws.send(JSON.stringify({ action: 'recordings', error: 2, tag: command.tag })); } catch (ex) { } return; } + db.GetEvents(['recording'], domain.id, function (err, docs) { + if (err != null) return; for (var i in docs) { delete docs[i].action; delete docs[i].etype; delete docs[i].msg; // TODO: We could make a more specific query in the DB and never have these. if (files.indexOf(docs[i].filename) >= 0) { docs[i].present = 1; } @@ -1142,8 +1015,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use }); } else { // Send the list of most recent recordings, up to 'limit' count - db.GetEventsWithLimit(['recording'], domain.id, command.limit, null, function (err, docs) { - if (err != null) { try { ws.send(JSON.stringify({ action: 'recordings', error: 2, tag: command.tag })); } catch (ex) { } return; } + db.GetEventsWithLimit(['recording'], domain.id, command.limit, function (err, docs) { + if (err != null) return; for (var i in docs) { delete docs[i].action; delete docs[i].etype; delete docs[i].msg; // TODO: We could make a more specific query in the DB and never have these. if (files.indexOf(docs[i].filename) >= 0) { docs[i].present = 1; } @@ -1426,11 +1299,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (command.resetNextLogin === true) { chguser.passchange = -1; } if ((command.consent != null) && (typeof command.consent == 'number')) { if (command.consent == 0) { delete chguser.consent; } else { chguser.consent = command.consent; } change = 1; } if ((command.phone != null) && (typeof command.phone == 'string') && ((command.phone == '') || isPhoneNumber(command.phone))) { if (command.phone == '') { delete chguser.phone; } else { chguser.phone = command.phone; } change = 1; } - if ((command.msghandle != null) && (typeof command.msghandle == 'string')) { - if (command.msghandle.startsWith('callmebot:http')) { const h = parent.parent.msgserver.callmebotUrlToHandle(command.msghandle.substring(10)); if (h) { command.msghandle = h; } else { command.msghandle = ''; } } - if (command.msghandle == '') { delete chguser.msghandle; } else { chguser.msghandle = command.msghandle; } - change = 1; - } if ((command.flags != null) && (typeof command.flags == 'number')) { // Flags: 1 = Account Image, 2 = Session Recording if ((command.flags == 0) && (chguser.flags != null)) { delete chguser.flags; change = 1; } else { if (command.flags !== chguser.flags) { chguser.flags = command.flags; change = 1; } } @@ -1522,16 +1390,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { var ugrpdomain, err = null; try { - // Check if we are in a mode that does not allow manual user group creation - if ( - (typeof domain.authstrategies == 'object') && - (typeof domain.authstrategies['oidc'] == 'object') && - (typeof domain.authstrategies['oidc'].groups == 'object') && - ((domain.authstrategies['oidc'].groups.sync == true) || ((typeof domain.authstrategies['oidc'].groups.sync == 'object') && (domain.authstrategies['oidc'].groups.sync.enabled == true))) - ) { - err = "Not allowed in OIDC mode with user group sync."; - } - // Check if we have new group restriction if ((user.siteadmin & SITERIGHT_USERGROUPS) == 0) { err = "Permission denied"; } @@ -1621,11 +1479,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use db.Set(ugrp); if (db.changeStream == false) { parent.userGroups[ugrpid] = ugrp; } - // Event the user group creation + // Event the device group creation var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: ugrpid, name: ugrp.name, desc: ugrp.desc, action: 'createusergroup', links: ugrp.links, msgid: 69, msgArgv: [ugrp.name], msg: 'User group created: ' + ugrp.name, ugrpdomain: domain.id }; parent.parent.DispatchEvent(['*', ugrpid, user._id], obj, event); // Even if DB change stream is active, this event must be acted upon. - // Event any pending events, these must be sent out after the group creation event is dispatched. + // Event any pending events, these must be sent out after the group creation event is displatched. for (var i in pendingDispatchEvents) { var ev = pendingDispatchEvents[i]; parent.parent.DispatchEvent(ev[0], ev[1], ev[2]); } // Log in the auth log @@ -1668,13 +1526,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } var group = groups[0]; - // If this user group is an externally managed user group, it can't be deleted unless there are no users in it. - if (group.membershipType != null) { - var userCount = 0; - if (group.links != null) { for (var i in group.links) { if (i.startsWith('user/')) { userCount++; } } } - if (userCount > 0) return; - } - // Unlink any user and meshes that have a link to this group if (group.links) { for (var i in group.links) { @@ -1735,8 +1586,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use change = ''; var group = parent.userGroups[command.ugrpid]; if (group != null) { - // If this user group is an externally managed user group, the name of the user group can't be edited - if ((group.membershipType == null) && (common.validateString(command.name, 1, 64) == true) && (command.name != group.name)) { change = 'User group name changed from "' + group.name + '" to "' + command.name + '"'; group.name = command.name; } + if ((common.validateString(command.name, 1, 64) == true) && (command.name != group.name)) { change = 'User group name changed from "' + group.name + '" to "' + command.name + '"'; group.name = command.name; } if ((common.validateString(command.desc, 0, 1024) == true) && (command.desc != group.desc)) { if (change != '') change += ' and description changed'; else change += 'User group "' + group.name + '" description changed'; group.desc = command.desc; } if ((typeof command.consent == 'number') && (command.consent != group.consent)) { if (change != '') change += ' and consent changed'; else change += 'User group "' + group.name + '" consent changed'; group.consent = command.consent; } @@ -1759,15 +1609,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; // If this account is settings locked, return here. - // 2 = WebPage device connections - // 4 = WebPage device disconnections - // 8 = WebPage device desktop and serial events - // 16 = Email device connections - // 32 = Email device disconnections - // 64 = Email device help request - // 128 = Messaging device connections - // 256 = Messaging device disconnections - // 512 = Messaging device help request + // 2 = WebPage device connections + // 4 = WebPage device disconnections + // 8 = WebPage device desktop and serial events + // 16 = Email device connections + // 32 = Email device disconnections var err = null; try { @@ -1812,15 +1658,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; // If this account is settings locked, return here. - // 2 = WebPage device connections - // 4 = WebPage device disconnections - // 8 = WebPage device desktop and serial events - // 16 = Email device connections - // 32 = Email device disconnections - // 64 = Email device help request - // 128 = Messaging device connections - // 256 = Messaging device disconnections - // 512 = Messaging device help request + // 2 = WebPage device connections + // 4 = WebPage device disconnections + // 8 = WebPage device desktop and serial events + // 16 = Email device connections + // 32 = Email device disconnections var err = null; try { @@ -1862,10 +1704,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // If this account is settings locked, return here. if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; - - // Do not allow change password if sspi or ldap - if ((domain.auth == 'sspi') || (domain.auth == 'ldap')) return; - + // Change our own password if (common.validateString(command.oldpass, 1, 256) == false) break; if (common.validateString(command.newpass, 1, 256) == false) break; @@ -2056,7 +1895,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified var xdomain = (domain.dns == null) ? domain.id : ''; if (xdomain != '') xdomain += "/"; - var url = "https://" + parent.getWebServerName(domain, req) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.userid) + "/" + encodeURIComponent(user._id); + var url = "https://" + parent.getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.userid) + "/" + encodeURIComponent(user._id); // Perform web push notification var payload = { body: "Chat Request, Click here to accept.", icon: 8, url: url }; // Icon 8 is the user icon. @@ -2079,7 +1918,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified var xdomain = (domain.dns == null) ? domain.id : ''; if (xdomain != '') xdomain += "/"; - var url = "https://" + parent.getWebServerName(domain, req) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.nodeid) + "/" + encodeURIComponent(user._id); + var url = "https://" + parent.getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.nodeid) + "/" + encodeURIComponent(user._id); // Open a web page on the remote device routeCommandToNode({ 'action': 'openUrl', 'nodeid': command.nodeid, 'userid': user._id, 'username': user.name, 'url': url }); @@ -2425,7 +2264,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } try { - if (common.validateString(command.userid, 1, 1024) == false) { err = "Invalid userid"; } // Check userid + if (common.validateString(command.userid, 8, 1024) == false) { err = "Invalid userid"; } // Check userid if (common.validateString(command.meshid, 8, 134) == false) { err = "Invalid groupid"; } // Check meshid if (command.userid.indexOf('/') == -1) { command.userid = 'user/' + domain.id + '/' + command.userid; } if (command.userid == obj.user._id) { err = "Can't remove self"; } // Can't add of modify self @@ -2562,98 +2401,77 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } case 'addlocaldevice': { - var err = null; - // Perform input validation - try { - if (common.validateString(command.meshid, 8, 134) == false) { err = "Invalid device group id"; } // Check meshid - if (common.validateString(command.devicename, 1, 256) == false) { err = "Invalid devicename"; } // Check device name - if (common.validateString(command.hostname, 1, 256) == false) { err = "Invalid hostname"; } // Check hostname - if (typeof command.type != 'number') { err = "Invalid type"; } // Type must be a number - if ((command.type != 4) && (command.type != 6) && (command.type != 29)) { err = "Invalid type"; } // Check device type - else { - if (command.meshid.indexOf('/') == -1) { command.meshid = 'mesh/' + domain.id + '/' + command.meshid; } - mesh = parent.meshes[command.meshid]; - if (mesh == null) { err = "Unknown device group"; } - if (mesh.mtype != 3) { err = "Local device agentless mesh only allowed" } // This operation is only allowed for mesh type 3, local device agentless mesh. - else if ((parent.GetMeshRights(user, mesh) & MESHRIGHT_MANAGECOMPUTERS) == 0) { err = "Permission denied"; } - else if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) { err = "Invalid domain"; } // Invalid domain, operation only valid for current domain - } - } catch (ex) { console.log(ex); err = "Validation exception: " + ex; } - // Handle any errors - if (err != null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'changeDeviceMesh', responseid: command.responseid, result: err })); } catch (ex) { } } - break; + if (common.validateString(command.meshid, 8, 134) == false) break; // Check meshid + if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) return; // Invalid domain, operation only valid for current domain + if (common.validateString(command.devicename, 1, 256) == false) break; // Check device name + if (common.validateString(command.hostname, 1, 256) == false) break; // Check hostname + if (typeof command.type != 'number') break; // Type must be a number + if ((command.type != 4) && (command.type != 6) && (command.type != 29)) break; // Check device type + + // Get the mesh + mesh = parent.meshes[command.meshid]; + if (mesh) { + if (mesh.mtype != 3) return; // This operation is only allowed for mesh type 3, local device agentless mesh. + + // Check if this user has rights to do this + if ((parent.GetMeshRights(user, mesh) & MESHRIGHT_MANAGECOMPUTERS) == 0) return; + + // Create a new nodeid + parent.crypto.randomBytes(48, function (err, buf) { + // Create the new node + nodeid = 'node/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + var device = { type: 'node', _id: nodeid, meshid: command.meshid, mtype: 3, icon: 1, name: command.devicename, host: command.hostname, domain: domain.id, agent: { id: command.type, caps: 0 } }; + db.Set(device); + + // Event the new node + parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(command.meshid, [nodeid]), obj, { etype: 'node', userid: user._id, username: user.name, action: 'addnode', node: parent.CloneSafeNode(device), msgid: 84, msgArgs: [command.devicename, mesh.name], msg: 'Added device ' + command.devicename + ' to device group ' + mesh.name, domain: domain.id }); + }); } - // Create a new nodeid - parent.crypto.randomBytes(48, function (err, buf) { - // Create the new node - nodeid = 'node/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); - var device = { type: 'node', _id: nodeid, meshid: command.meshid, mtype: 3, icon: 1, name: command.devicename, host: command.hostname, domain: domain.id, agent: { id: command.type, caps: 0 } }; - db.Set(device); - - // Event the new node - parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(command.meshid, [nodeid]), obj, { etype: 'node', userid: user._id, username: user.name, action: 'addnode', node: parent.CloneSafeNode(device), msgid: 84, msgArgs: [command.devicename, mesh.name], msg: 'Added device ' + command.devicename + ' to device group ' + mesh.name, domain: domain.id }); - // Send response if required - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'addlocaldevice', responseid: command.responseid, result: 'ok' })); } catch (ex) { } } - }); break; } case 'addamtdevice': { if (args.wanonly == true) return; // This is a WAN-only server, local Intel AMT computers can't be added - var err = null; - // Perform input validation - try { - if (common.validateString(command.meshid, 8, 134) == false) { err = "Invalid device group id"; } // Check meshid - if (common.validateString(command.devicename, 1, 256) == false) { err = "Invalid devicename"; } // Check device name - if (common.validateString(command.hostname, 1, 256) == false) { err = "Invalid hostname"; } // Check hostname - if (common.validateString(command.amtusername, 0, 16) == false) { err = "Invalid amtusername"; } // Check username - if (common.validateString(command.amtpassword, 0, 16) == false) { err = "Invalid amtpassword"; } // Check password - if (command.amttls == '0') { command.amttls = 0; } else if (command.amttls == '1') { command.amttls = 1; } // Check TLS flag - if ((command.amttls != 1) && (command.amttls != 0)) { err = "Invalid amttls"; } - else { - if (command.meshid.indexOf('/') == -1) { command.meshid = 'mesh/' + domain.id + '/' + command.meshid; } - // Get the mesh - mesh = parent.meshes[command.meshid]; - if (mesh == null) { err = "Unknown device group"; } - if (mesh.mtype != 1) { err = "Intel AMT agentless mesh only allowed"; } // This operation is only allowed for mesh type 1, Intel AMT agentless mesh. - // Check if this user has rights to do this - else if ((parent.GetMeshRights(user, mesh) & MESHRIGHT_MANAGECOMPUTERS) == 0) { err = "Permission denied"; } - else if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) { err = "Invalid domain"; } // Invalid domain, operation only valid for current domain - } - } catch (ex) { console.log(ex); err = "Validation exception: " + ex; } - - // Handle any errors - if (err != null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'changeDeviceMesh', responseid: command.responseid, result: err })); } catch (ex) { } } - break; - } + if (common.validateString(command.meshid, 8, 134) == false) break; // Check meshid + if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) return; // Invalid domain, operation only valid for current domain + if (common.validateString(command.devicename, 1, 256) == false) break; // Check device name + if (common.validateString(command.hostname, 1, 256) == false) break; // Check hostname + if (common.validateString(command.amtusername, 0, 16) == false) break; // Check username + if (common.validateString(command.amtpassword, 0, 16) == false) break; // Check password + if (command.amttls == '0') { command.amttls = 0; } else if (command.amttls == '1') { command.amttls = 1; } // Check TLS flag + if ((command.amttls != 1) && (command.amttls != 0)) break; // If we are in WAN-only mode, hostname is not used if ((args.wanonly == true) && (command.hostname)) { delete command.hostname; } - // Create a new nodeid - parent.crypto.randomBytes(48, function (err, buf) { - // Create the new node - nodeid = 'node/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); - var device = { type: 'node', _id: nodeid, meshid: command.meshid, mtype: 1, icon: 1, name: command.devicename, host: command.hostname, domain: domain.id, intelamt: { user: command.amtusername, pass: command.amtpassword, tls: command.amttls } }; + // Get the mesh + mesh = parent.meshes[command.meshid]; + if (mesh) { + if (mesh.mtype != 1) return; // This operation is only allowed for mesh type 1, Intel AMT agentless mesh. - // Add optional feilds - if (common.validateInt(command.state, 0, 3)) { device.intelamt.state = command.state; } - if (common.validateString(command.ver, 1, 16)) { device.intelamt.ver = command.ver; } - if (common.validateString(command.hash, 1, 256)) { device.intelamt.hash = command.hash; } - if (common.validateString(command.realm, 1, 256)) { device.intelamt.realm = command.realm; } + // Check if this user has rights to do this + if ((parent.GetMeshRights(user, mesh) & MESHRIGHT_MANAGECOMPUTERS) == 0) return; - // Save the device to the database - db.Set(device); + // Create a new nodeid + parent.crypto.randomBytes(48, function (err, buf) { + // Create the new node + nodeid = 'node/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); + var device = { type: 'node', _id: nodeid, meshid: command.meshid, mtype: 1, icon: 1, name: command.devicename, host: command.hostname, domain: domain.id, intelamt: { user: command.amtusername, pass: command.amtpassword, tls: command.amttls } }; - // Event the new node - parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(command.meshid, [nodeid]), obj, { etype: 'node', userid: user._id, username: user.name, action: 'addnode', node: parent.CloneSafeNode(device), msgid: 84, msgArgs: [command.devicename, mesh.name], msg: 'Added device ' + command.devicename + ' to device group ' + mesh.name, domain: domain.id }); - // Send response if required - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'addamtdevice', responseid: command.responseid, result: 'ok' })); } catch (ex) { } } - }); + // Add optional feilds + if (common.validateInt(command.state, 0, 3)) { device.intelamt.state = command.state; } + if (common.validateString(command.ver, 1, 16)) { device.intelamt.ver = command.ver; } + if (common.validateString(command.hash, 1, 256)) { device.intelamt.hash = command.hash; } + if (common.validateString(command.realm, 1, 256)) { device.intelamt.realm = command.realm; } + // Save the device to the database + db.Set(device); + + // Event the new node + parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(command.meshid, [nodeid]), obj, { etype: 'node', userid: user._id, username: user.name, action: 'addnode', node: parent.CloneSafeNode(device), msgid: 84, msgArgs: [command.devicename, mesh.name], msg: 'Added device ' + command.devicename + ' to device group ' + mesh.name, domain: domain.id }); + }); + } break; } case 'scanamtdevice': @@ -2791,20 +2609,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { if (common.validateArray(command.nodeids, 1) == false) break; // Check nodeid's for (i in command.nodeids) { - var nodeid = command.nodeids[i], err = null; - - // Argument validation - if (common.validateString(nodeid, 1, 1024) == false) { err = 'Invalid nodeid'; } // Check nodeid - else { - if (nodeid.indexOf('/') == -1) { nodeid = 'node/' + domain.id + '/' + nodeid; } - if ((nodeid.split('/').length != 3) || (nodeid.split('/')[1] != domain.id)) { err = 'Invalid domain'; } // Invalid domain, operation only valid for current domain - } - if (err != null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: err })); } catch (ex) { } } - continue; - } // Get the node and the rights for this node - parent.GetNodeWithRights(domain, user, nodeid, function (node, rights, visible) { + parent.GetNodeWithRights(domain, user, command.nodeids[i], function (node, rights, visible) { // Check we have the rights to delete this device if ((rights & MESHRIGHT_UNINSTALL) == 0) return; @@ -2859,10 +2665,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } }); } - - // Send response if required, in this case we always send ok which is not ideal. - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'ok' })); } catch (ex) { } } - break; } case 'wakedevices': @@ -2955,206 +2757,75 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } break; } - case 'webrelay': - { - if (common.validateString(command.nodeid, 8, 128) == false) { err = 'Invalid node id'; } // Check the nodeid - else if (command.nodeid.indexOf('/') == -1) { command.nodeid = 'node/' + domain.id + '/' + command.nodeid; } - else if ((command.nodeid.split('/').length != 3) || (command.nodeid.split('/')[1] != domain.id)) { err = 'Invalid domain'; } // Invalid domain, operation only valid for current domain - else if ((command.port != null) && (common.validateInt(command.port, 1, 65535) == false)) { err = 'Invalid port value'; } // Check the port if present - else { - if (command.nodeid.split('/').length == 1) { command.nodeid = 'node/' + domain.id + '/' + command.nodeid; } - var snode = command.nodeid.split('/'); - if ((snode.length != 3) || (snode[0] != 'node') || (snode[1] != domain.id)) { err = 'Invalid node id'; } - } - // Handle any errors - if (err != null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'webrelay', responseid: command.responseid, result: err })); } catch (ex) { } } - break; - } - // Get the device rights - parent.GetNodeWithRights(domain, user, command.nodeid, function (node, rights, visible) { - // If node not found or we don't have remote control, reject. - if (node == null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'webrelay', responseid: command.responseid, result: 'Invalid node id' })); } catch (ex) { } } - return; - } - var relayid = null; - var addr = null; - if (node.mtype == 3) { // Setup device relay if needed - var mesh = parent.meshes[node.meshid]; - if (mesh && mesh.relayid) { relayid = mesh.relayid; addr = node.host; } - } - var webRelayDns = (args.relaydns != null) ? args.relaydns[0] : obj.getWebServerName(domain, req); - var webRelayPort = ((args.relaydns != null) ? ((typeof args.aliasport == 'number') ? args.aliasport : args.port) : ((parent.webrelayserver != null) ? ((typeof args.relayaliasport == 'number') ? args.relayaliasport : parent.webrelayserver.port) : 0)); - if (webRelayPort == 0) { try { ws.send(JSON.stringify({ action: 'webrelay', responseid: command.responseid, result: 'WebRelay Disabled' })); return; } catch (ex) { } } - const authRelayCookie = parent.parent.encodeCookie({ ruserid: user._id, x: req.session.x }, parent.parent.loginCookieEncryptionKey); - var url = 'https://' + webRelayDns + ':' + webRelayPort + '/control-redirect.ashx?n=' + command.nodeid + '&p=' + command.port + '&appid=' + command.appid + '&c=' + authRelayCookie; - if (addr != null) { url += '&addr=' + addr; } - if (relayid != null) { url += '&relayid=' + relayid } - command.url = url; - if (command.responseid != null) { command.result = 'OK'; } - try { ws.send(JSON.stringify(command)); } catch (ex) { } - }); - break; - } case 'runcommands': { if (common.validateArray(command.nodeids, 1) == false) break; // Check nodeid's - if (typeof command.presetcmd != 'number') { - if (typeof command.type != 'number') break; // Check command type - if (typeof command.runAsUser != 'number') { command.runAsUser = 0; } // Check runAsUser - } + if (typeof command.type != 'number') break; // Check command type + if (typeof command.cmds != 'string') break; // Check commands + if (typeof command.runAsUser != 'number') { command.runAsUser = 0; } // Check runAsUser - const processRunCommand = function (command) { - for (i in command.nodeids) { - var nodeid = command.nodeids[i], err = null; + for (i in command.nodeids) { + var nodeid = command.nodeids[i], err = null; - // Argument validation - if (common.validateString(nodeid, 1, 1024) == false) { err = 'Invalid nodeid'; } // Check nodeid - else { - if (nodeid.indexOf('/') == -1) { nodeid = 'node/' + domain.id + '/' + nodeid; } - if ((nodeid.split('/').length != 3) || (nodeid.split('/')[1] != domain.id)) { err = 'Invalid domain'; } // Invalid domain, operation only valid for current domain - } - if (err != null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: err })); } catch (ex) { } } - continue; + // Argument validation + if (common.validateString(nodeid, 1, 1024) == false) { err = 'Invalid nodeid'; } // Check nodeid + else { + if (nodeid.indexOf('/') == -1) { nodeid = 'node/' + domain.id + '/' + nodeid; } + if ((nodeid.split('/').length != 3) || (nodeid.split('/')[1] != domain.id)) { err = 'Invalid domain'; } // Invalid domain, operation only valid for current domain + } + if (err != null) { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: err })); } catch (ex) { } } + continue; + } + + // Get the node and the rights for this node + parent.GetNodeWithRights(domain, user, nodeid, function (node, rights, visible) { + // Check if this node was found + if (node == null) { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid nodeid' })); } catch (ex) { } } + return; } - // Get the node and the rights for this node - parent.GetNodeWithRights(domain, user, nodeid, function (node, rights, visible) { - // Check if this node was found - if (node == null) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid nodeid' })); } catch (ex) { } } - return; - } + // Check we have the rights to run commands on this device + if ((rights & MESHRIGHT_REMOTECOMMAND) == 0) { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Access denied' })); } catch (ex) { } } + return; + } - if (command.type == 4) { - // This is an agent console command - - // Check we have the rights to run commands on this device, MESHRIGHT_REMOTECONTROL & MESHRIGHT_AGENTCONSOLE are needed - if ((rights & 24) != 24) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Access denied' })); } catch (ex) { } } - return; - } - - var theCommand = { action: 'msg', type: 'console', value: command.cmds, rights: rights, sessionid: ws.sessionId }; - if (parent.parent.multiServer != null) { // peering setup - parent.parent.multiServer.DispatchMessage({ action: 'agentCommand', nodeid: node._id, command: theCommand}); - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } } - } else { - // Send the commands to the agent - var agent = parent.wsagents[node._id]; - if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) { - try { agent.send(JSON.stringify(theCommand)); } catch (ex) { } - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } } - } else { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } } - } - } + // Get the agent and run the commands + var agent = parent.wsagents[node._id]; + if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) { + // Check if this agent is correct for this command type + // command.type 1 = Windows Command, 2 = Windows PowerShell, 3 = Linux/BSD/macOS + var commandsOk = false; + if ((agent.agentInfo.agentId > 0) && (agent.agentInfo.agentId < 5)) { + // Windows Agent + if ((command.type == 1) || (command.type == 2)) { commandsOk = true; } + else if (command.type === 0) { command.type = 1; commandsOk = true; } // Set the default type of this agent } else { - // This is a standard (bash/shell/powershell) command. + // Non-Windows Agent + if (command.type == 3) { commandsOk = true; } + else if (command.type === 0) { command.type = 3; commandsOk = true; } // Set the default type of this agent + } + if (commandsOk == true) { + // Send the commands to the agent + try { agent.send(JSON.stringify({ action: 'runcommands', type: command.type, cmds: command.cmds, runAsUser: command.runAsUser })); } catch (ex) { } + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } } - // Check we have the rights to run commands on this device - if ((rights & MESHRIGHT_REMOTECOMMAND) == 0) { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Access denied' })); } catch (ex) { } } - return; - } - - if (typeof command.reply != 'boolean') command.reply = false; - if (typeof command.responseid != 'string') command.responseid = null; + // Send out an event that these commands where run on this device + var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]); var msgid = 24; // "Running commands" if (command.type == 1) { msgid = 99; } // "Running commands as user" if (command.type == 2) { msgid = 100; } // "Running commands as user if possible" - // Check if this agent is correct for this command type - // command.type 1 = Windows Command, 2 = Windows PowerShell, 3 = Linux/BSD/macOS - var commandsOk = false; - if ((node.agent.id > 0) && (node.agent.id < 5)) { - // Windows Agent - if ((command.type == 1) || (command.type == 2)) { commandsOk = true; } - else if (command.type === 0) { command.type = 1; commandsOk = true; } // Set the default type of this agent - } else { - // Non-Windows Agent - if (command.type == 3) { commandsOk = true; } - else if (command.type === 0) { command.type = 3; commandsOk = true; } // Set the default type of this agent - } - if (commandsOk == true) { - var theCommand = { action: 'runcommands', type: command.type, cmds: command.cmds, runAsUser: command.runAsUser, reply: command.reply, responseid: command.responseid }; - var agent = parent.wsagents[node._id]; - if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) { - // Send the commands to the agent - try { agent.send(JSON.stringify(theCommand)); } catch (ex) { } - if (command.responseid != null && command.reply == false) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } } - // Send out an event that these commands where run on this device - var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]); - var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id }; - parent.parent.DispatchEvent(targets, obj, event); - } else if (parent.parent.multiServer != null) { // peering setup - // Send the commands to the agent - parent.parent.multiServer.DispatchMessage({ action: 'agentCommand', nodeid: node._id, command: theCommand}); - if (command.responseid != null && command.reply == false) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } } - // Send out an event that these commands where run on this device - var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]); - var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id }; - parent.parent.multiServer.DispatchEvent(targets, obj, event); - } else { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } } - } - } else { - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid command type' })); } catch (ex) { } } - } + var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id }; + parent.parent.DispatchEvent(targets, obj, event); + } else { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid command type' })); } catch (ex) { } } } - }); - } - } - - if (typeof command.presetcmd == 'number') { - // If a pre-set command is used, load the command - if (Array.isArray(domain.preconfiguredscripts) == false) return; - const script = domain.preconfiguredscripts[command.presetcmd]; - if (script == null) return; - delete command.presetcmd; - - // Decode script type - const types = ['', 'bat', 'ps1', 'sh', 'agent']; // 1 = Windows Command, 2 = Windows PowerShell, 3 = Linux, 4 = Agent - if (typeof script.type == 'string') { const stype = types.indexOf(script.type.toLowerCase()); if (stype > 0) { command.type = stype; } } - if (command.type == null) return; - - // Decode script runas - if (command.type != 4) { - const runAsModes = ['agent', 'userfirst', 'user']; // 0 = AsAgent, 1 = UserFirst, 2 = UserOnly - if (typeof script.runas == 'string') { const srunas = runAsModes.indexOf(script.runas.toLowerCase()); if (srunas >= 0) { command.runAsUser = srunas; } } - } - - if (typeof script.file == 'string') { - // The pre-defined script commands are in a file, load it - const scriptPath = parent.common.joinPath(parent.parent.datapath, script.file); - fs.readFile(scriptPath, function (err, data) { - // If loaded correctly, run loaded commands - if ((err != null) || (data == null) || (data.length == 0) || (data.length > 65535)) return; - command.cmds = data.toString(); - processRunCommand(command); - }); - } else if (typeof script.cmd == 'string') { - // The pre-defined script commands are right in the config.json, use that - command.cmds = script.cmd; - processRunCommand(command); - } - } else if (typeof command.cmdpath == 'string') { - // If a server command path is used, load the script from the path - var file = parent.getServerFilePath(user, domain, command.cmdpath); - if (file != null) { - fs.readFile(file.fullpath, function (err, data) { - // If loaded correctly, run loaded commands - if ((err != null) || (data == null) || (data.length == 0) || (data.length > 65535)) return; - command.cmds = data.toString(); - delete command.cmdpath; - processRunCommand(command); - }); - } - } else if (typeof command.cmds == 'string') { - // Run provided commands - if (command.cmds.length > 65535) return; - processRunCommand(command); + } else { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } } + } + }); } break; } @@ -3213,8 +2884,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } if ((command.actiontype >= 300) && (command.actiontype < 400)) { - if ((command.actiontype != 302) && (command.actiontype != 308) && (command.actiontype < 310) && (command.actiontype > 316)) return; // Invalid action type. - // Intel AMT power command, actiontype: 2 = Power on, 8 = Power down, 10 = reset, 11 = Power on to BIOS, 12 = Reset to BIOS, 13 = Power on to BIOS with SOL, 14 = Reset to BIOS with SOL, 15 = Power on to PXE, 16 = Reset to PXE + if ((command.actiontype != 302) && (command.actiontype != 308) && (command.actiontype != 310)) return; // Invalid action type. + // Intel AMT power command, actiontype: 2 = Power on, 8 = Power down, 10 = reset parent.parent.DispatchEvent('*', obj, { action: 'amtpoweraction', userid: user._id, username: user.name, nodeids: [node._id], domain: domain.id, nolog: 1, actiontype: command.actiontype - 300 }); } else { if ((command.actiontype < 2) && (command.actiontype > 4)) return; // Invalid action type. @@ -3310,7 +2981,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'changedevice', responseid: command.responseid, result: 'Access Denied' })); } catch (ex) { } } return; } - node = common.unEscapeLinksFieldName(node); // unEscape node data for rdp/ssh credentials var mesh = parent.meshes[node.meshid], amtchange = 0; // Ready the node change event @@ -3632,46 +3302,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.parent.DispatchEvent(targets, obj, event); break; } - case 'otpduo': - { - // Do not allow this command if 2FA's are locked - if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) return; - - // Do not allow if Duo is not supported - if ((typeof domain.duo2factor != 'object') || (typeof domain.duo2factor.integrationkey != 'string') || (typeof domain.duo2factor.secretkey != 'string') || (typeof domain.duo2factor.apihostname != 'string')) return; - - // Do not allow if Duo is disabled - if ((typeof domain.passwordrequirements == 'object') && (domain.passwordrequirements.duo2factor == false)) return; - - // Do not allow this command when logged in using a login token - if (req.session.loginToken != null) break; - - if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; // If this account is settings locked, return here. - - // Check input - if ((typeof command.enabled != 'boolean') || (command.enabled != false)) return; - - // See if we really need to change the state - if ((command.enabled === false) && (user.otpduo == null)) return; - - // Change the duo 2FA of this user - delete user.otpduo; - parent.db.SetUser(user); - ws.send(JSON.stringify({ action: 'otpduo', success: true, enabled: command.enabled })); // Report success - - // Notify change - var targets = ['*', 'server-users', user._id]; - if (user.groups) { for (var i in user.groups) { targets.push('server-users:' + i); } } - var event = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', msgid: command.enabled ? 160 : 161, msg: command.enabled ? "Enabled duo two-factor authentication." : "Disabled duo two-factor authentication.", domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. - parent.parent.DispatchEvent(targets, obj, event); - break; - } case 'otpauth-request': { // Do not allow this command if 2FA's are locked if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 1 })); return; } + // Do not allow this command if backup codes are not allowed + if ((domain.passwordrequirements) && (domain.passwordrequirements.backupcode2factor == false)) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 2 })); return; } + // Do not allow this command when logged in using a login token if (req.session.loginToken != null) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 3 })); return; } @@ -3690,11 +3328,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use const secret = otplib.authenticator.generateSecret(); // TODO: Check the random source of this value. var domainName = parent.certificates.CommonName; - if (domain.dns != null) { - domainName = domain.dns; - } else if (domain.dns == null && domain.id != '') { - domainName += "/" + domain.id; - } + if (domain.dns != null) { domainName = domain.dns; } ws.send(JSON.stringify({ action: 'otpauth-request', secret: secret, url: otplib.authenticator.keyuri(encodeURIComponent(user.name), domainName, secret) })); } break; @@ -3704,6 +3338,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Do not allow this command if 2FA's are locked if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) return; + // Do not allow this command if backup codes are not allowed + if ((domain.passwordrequirements) && (domain.passwordrequirements.backupcode2factor == false)) return; + // Do not allow this command when logged in using a login token if (req.session.loginToken != null) break; @@ -3743,6 +3380,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Do not allow this command if 2FA's are locked if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) return; + // Do not allow this command if backup codes are not allowed + if ((domain.passwordrequirements) && (domain.passwordrequirements.backupcode2factor == false)) return; + // Do not allow this command when logged in using a login token if (req.session.loginToken != null) break; @@ -4155,7 +3795,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use mesh = parent.meshes[command.meshid]; if ((mesh == null) || (parent.IsMeshViewable(user, mesh) == false)) { err = 'Invalid group id'; } } - var serverName = parent.getWebServerName(domain, req); + var serverName = parent.getWebServerName(domain); // Handle any errors if (err != null) { @@ -4356,7 +3996,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Event device share removal if (removedExact != null) { // Send out an event that we removed a device share - var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', 'server-shareremove', user._id]); + var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]); var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'removedDeviceShare', msg: 'Removed Device Share', msgid: 102, msgArgs: [removedExact.guestName], domain: domain.id, publicid: command.publicid }; parent.parent.DispatchEvent(targets, obj, event); @@ -4389,9 +4029,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use else if ((command.start != null) && (typeof command.start != 'number')) { err = 'Invalid start time'; } // Check the start time in UTC seconds else if ((command.end != null) && (typeof command.end != 'number')) { err = 'Invalid end time'; } // Check the end time in UTC seconds else if (common.validateInt(command.consent, 0, 256) == false) { err = 'Invalid flags'; } // Check the flags - else if (common.validateInt(command.p, 1, 31) == false) { err = 'Invalid protocol'; } // Check the protocol, 1 = Terminal, 2 = Desktop, 4 = Files, 8 = HTTP, 16 = HTTPS + else if (common.validateInt(command.p, 1, 7) == false) { err = 'Invalid protocol'; } // Check the protocol, 1 = Terminal, 2 = Desktop, 4 = Files else if ((command.recurring != null) && (common.validateInt(command.recurring, 1, 2) == false)) { err = 'Invalid recurring value'; } // Check the recurring value, 1 = Daily, 2 = Weekly - else if ((command.port != null) && (common.validateInt(command.port, 1, 65535) == false)) { err = 'Invalid port value'; } // Check the port if present else if ((command.recurring != null) && ((command.end != null) || (command.start == null) || (command.expire == null))) { err = 'Invalid recurring command'; } else if ((command.expire == null) && ((command.start == null) || (command.end == null) || (command.start > command.end))) { err = 'No time specified'; } // Check that a time range is present else { @@ -4449,7 +4088,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } // If we have view only remote desktop rights, force view-only on the guest share. - if ((rights != MESHRIGHT_ADMIN) && ((rights & MESHRIGHT_REMOTEVIEWONLY) != 0)) { command.viewOnly = true; } + if ((rights != MESHRIGHT_ADMIN) && ((rights & MESHRIGHT_REMOTEVIEWONLY) != 0)) { command.viewOnly = true; command.p = (command.p & 1); } // Create cookie var publicid = getRandomPassword(), startTime = null, expireTime = null, duration = null; @@ -4479,7 +4118,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (inviteCookie == null) { if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'createDeviceShareLink', responseid: command.responseid, result: 'Unable to generate shareing cookie' })); } catch (ex) { } } return; } // Create the server url - var serverName = parent.getWebServerName(domain, req); + var serverName = parent.getWebServerName(domain); var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified var xdomain = (domain.dns == null) ? domain.id : ''; if (xdomain != '') xdomain += '/'; @@ -4491,7 +4130,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use try { ws.send(JSON.stringify(command)); } catch (ex) { } // Create a device sharing database entry - var shareEntry = { _id: 'deviceshare-' + publicid, type: 'deviceshare', xmeshid: node.meshid, nodeid: node._id, p: command.p, domain: node.domain, publicid: publicid, userid: user._id, guestName: command.guestname, consent: command.consent, port: command.port, url: url }; + var shareEntry = { _id: 'deviceshare-' + publicid, type: 'deviceshare', xmeshid: node.meshid, nodeid: node._id, p: command.p, domain: node.domain, publicid: publicid, userid: user._id, guestName: command.guestname, consent: command.consent, url: url }; if ((startTime != null) && (expireTime != null)) { shareEntry.startTime = startTime; shareEntry.expireTime = expireTime; } else if ((startTime != null) && (duration != null)) { shareEntry.startTime = startTime; shareEntry.duration = duration; } if (command.recurring) { shareEntry.recurring = command.recurring; } @@ -4582,7 +4221,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (rights == MESHRIGHT_ADMIN) { var token = parent.parent.mqttbroker.generateLogin(node.meshid, node._id); var r = { action: 'getmqttlogin', responseid: command.responseid, nodeid: node._id, user: token.user, pass: token.pass }; - const serverName = parent.getWebServerName(domain, req); + const serverName = parent.getWebServerName(domain); // Add MPS URL if (parent.parent.mpsserver != null) { @@ -4722,7 +4361,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } else { try { parent.parent.pluginHandler.plugins[command.plugin].serveraction(command, obj, parent); - } catch (ex) { console.log('Error loading plugin handler (' + ex + ')'); } + } catch (ex) { console.log('Error loading plugin handler (' + e + ')'); } } break; } @@ -4752,16 +4391,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (typeof command.logmsg == 'string') { message.msg = command.logmsg; } else { message.nolog = 1; } parent.parent.DispatchEvent(['*', user._id], obj, message); } - - if (parent.parent.pluginHandler != null) // If the plugin's are not supported, reject this command. - { - command.userid = user._id; - try { - for( var pluginName in parent.parent.pluginHandler.plugins) - if( typeof parent.parent.pluginHandler.plugins[pluginName].uiCustomEvent === 'function' ) - parent.parent.pluginHandler.plugins[pluginName].uiCustomEvent(command, obj); - } catch (ex) { console.log('Error loading plugin handler (' + ex + ')'); } - } break; } case 'serverBackup': { @@ -4932,7 +4561,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use }); } else { // Old way - db.GetUserEvents([user._id], domain.id, user._id, null, function (err, docs) { + db.GetUserEvents([user._id], domain.id, user._id, function (err, docs) { if (err != null) return; var e = []; for (var i in docs) { @@ -4958,7 +4587,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use }); } else { // Old way - db.GetUserEvents([command.userid], domain.id, user._id, null, function (err, docs) { + db.GetUserEvents([command.userid], domain.id, user._id, function (err, docs) { if (err != null) return; var e = []; for (var i in docs) { if ((docs[i].msgArgs) && (docs[i].userid == command.userid) && ((docs[i].action == 'authfail') || (docs[i].action == 'login'))) { e.push({ t: docs[i].time, m: docs[i].msgid, a: docs[i].msgArgs }); } } @@ -5076,295 +4705,195 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use case 'getDeviceDetails': { if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids if (common.validateString(command.type, 3, 4) == false) break; // Check type - - const links = parent.GetAllMeshIdWithRights(user); - const extraids = getUserExtraIds(); - db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, obj.deviceSkip, obj.deviceLimit, function (err, docs) { - if (docs == null) return; - const ids = []; - if (command.nodeids != null) { - // Create a list of node ids and query them for last device connection time - for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); } - } else { - // Create a list of node ids for this user and query them for last device connection time - for (var i in docs) { ids.push('lc' + docs[i]._id); } - } - db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) { - const lastConnects = {}; - if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } } - getDeviceDetailedInfo(command.nodeids, command.type, function (results, type) { - for (var i = 0; i < results.length; i++) { - // Remove any device system and network information is we do not have details rights to this device - if ((parent.GetNodeRights(user, results[i].node.meshid, results[i].node._id) & MESHRIGHT_DEVICEDETAILS) == 0) { - delete results[i].sys; delete results[i].net; - } + // Create a list of node ids and query them for last device connection time + const ids = [] + for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); } + db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) { + const lastConnects = {}; + if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } } - // Merge any last connection information - const lc = lastConnects['lc' + results[i].node._id]; - if (lc != null) { delete lc._id; delete lc.type; delete lc.meshid; delete lc.domain; results[i].lastConnect = lc; } - - // Remove any connectivity and power state information, that should not be in the database anyway. - // TODO: Find why these are sometimes saved in the db. - if (results[i].node.conn != null) { delete results[i].node.conn; } - if (results[i].node.pwr != null) { delete results[i].node.pwr; } - if (results[i].node.agct != null) { delete results[i].node.agct; } - if (results[i].node.cict != null) { delete results[i].node.cict; } - - // Add the connection state - var state = parent.parent.GetConnectivityState(results[i].node._id); - if (state) { - results[i].node.conn = state.connectivity; - results[i].node.pwr = state.powerState; - if ((state.connectivity & 1) != 0) { var agent = parent.wsagents[results[i].node._id]; if (agent != null) { results[i].node.agct = agent.connectTime; } } - - // Use the connection time of the CIRA/Relay connection - if ((state.connectivity & 2) != 0) { - var ciraConnection = parent.parent.mpsserver.GetConnectionToNode(results[i].node._id, null, true); - if ((ciraConnection != null) && (ciraConnection.tag != null)) { results[i].node.cict = ciraConnection.tag.connectTime; } - } - } - + getDeviceDetailedInfo(command.nodeids, command.type, function (results, type) { + for (var i = 0; i < results.length; i++) { + // Remove any device system and network information is we do not have details rights to this device + if ((parent.GetNodeRights(user, results[i].node.meshid, results[i].node._id) & MESHRIGHT_DEVICEDETAILS) == 0) { + delete results[i].sys; delete results[i].net; } - var output = null; - if (type == 'csv') { - try { - // Create the CSV file - output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,bitlocker,avdetails,tags,lastbootuptime,cpu,osbuild,biosDate,biosVendor,biosVersion,biosSerial,biosMode,boardName,boardVendor,boardVersion,productUuid,tpmversion,tpmmanufacturer,tpmmanufacturerversion,tpmisactivated,tpmisenabled,tpmisowned,totalMemory,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses,lastConnectTime,lastConnectAddr\r\n'; - for (var i = 0; i < results.length; i++) { - const nodeinfo = results[i]; + // Merge any last connection information + const lc = lastConnects['lc' + results[i].node._id]; + if (lc != null) { delete lc._id; delete lc.type;; delete lc.meshid; delete lc.domain; results[i].lastConnect = lc; } + } - // Node information - if (nodeinfo.node != null) { - const n = nodeinfo.node; - output += csvClean(n._id) + ',' + csvClean(n.name) + ',' + csvClean(n.rname ? n.rname : '') + ',' + csvClean(n.host ? n.host : '') + ',' + (n.icon ? n.icon : 1) + ',' + (n.ip ? n.ip : '') + ',' + (n.osdesc ? csvClean(n.osdesc) : '') + ',' + csvClean(parent.meshes[n.meshid].name); - if (typeof n.wsc == 'object') { - output += ',' + csvClean(n.wsc.antiVirus ? n.wsc.antiVirus : '') + ',' + csvClean(n.wsc.autoUpdate ? n.wsc.autoUpdate : '') + ',' + csvClean(n.wsc.firewall ? n.wsc.firewall : '') - } else { output += ',,,'; } - if (typeof n.volumes == 'object') { - var bitlockerdetails = '', firstbitlocker = true; - for (var a in n.volumes) { if (typeof n.volumes[a].protectionStatus !== 'undefined') { if (firstbitlocker) { firstbitlocker = false; } else { bitlockerdetails += '|'; } bitlockerdetails += a + '/' + n.volumes[a].volumeStatus; } } - output += ',' + csvClean(bitlockerdetails); - } else { - output += ','; - } - if (typeof n.av == 'object') { - var avdetails = '', firstav = true; - for (var a in n.av) { if (typeof n.av[a].product == 'string') { if (firstav) { firstav = false; } else { avdetails += '|'; } avdetails += (n.av[a].product + '/' + ((n.av[a].enabled) ? 'enabled' : 'disabled') + '/' + ((n.av[a].updated) ? 'updated' : 'notupdated')); } } - output += ',' + csvClean(avdetails); - } else { - output += ','; - } - if (typeof n.tags == 'object') { - var tagsdetails = '', firsttags = true; - for (var a in n.tags) { if (firsttags) { firsttags = false; } else { tagsdetails += '|'; } tagsdetails += n.tags[a]; } - output += ',' + csvClean(tagsdetails); - } else { - output += ','; - } - if (typeof n.lastbootuptime == 'number') { output += ',' + n.lastbootuptime; } else { output += ','; } - } else { - output += ',,,,,,,,,,,,,,,,,,,,'; - } - - // System infomation - if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.windows)) { - // Windows - output += ','; - if (nodeinfo.sys.hardware.windows.cpu && (nodeinfo.sys.hardware.windows.cpu.length > 0) && (typeof nodeinfo.sys.hardware.windows.cpu[0].Name == 'string')) { output += csvClean(nodeinfo.sys.hardware.windows.cpu[0].Name); } - output += ','; - if (nodeinfo.sys.hardware.windows.osinfo && (nodeinfo.sys.hardware.windows.osinfo.BuildNumber)) { output += csvClean(nodeinfo.sys.hardware.windows.osinfo.BuildNumber); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_date)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_date); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_vendor)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_vendor); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_version)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_version); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_serial)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_serial); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_mode)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_mode); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_name)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_name); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_vendor)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_vendor); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_version)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_version); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.product_uuid)) { output += csvClean(nodeinfo.sys.hardware.identifiers.product_uuid); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.SpecVersion) { output += csvClean(nodeinfo.sys.hardware.tpm.SpecVersion); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.ManufacturerId) { output += csvClean(nodeinfo.sys.hardware.tpm.ManufacturerId); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.ManufacturerVersion) { output += csvClean(nodeinfo.sys.hardware.tpm.ManufacturerVersion); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.IsActivated) { output += csvClean(nodeinfo.sys.hardware.tpm.IsActivated ? 'true' : 'false'); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.IsEnabled) { output += csvClean(nodeinfo.sys.hardware.tpm.IsEnabled ? 'true' : 'false'); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.IsOwned) { output += csvClean(nodeinfo.sys.hardware.tpm.IsOwned ? 'true' : 'false'); } - output += ','; - if (nodeinfo.sys.hardware.windows.memory) { - var totalMemory = 0; - for (var j in nodeinfo.sys.hardware.windows.memory) { - if (nodeinfo.sys.hardware.windows.memory[j].Capacity) { - if (typeof nodeinfo.sys.hardware.windows.memory[j].Capacity == 'number') { totalMemory += nodeinfo.sys.hardware.windows.memory[j].Capacity; } - if (typeof nodeinfo.sys.hardware.windows.memory[j].Capacity == 'string') { totalMemory += parseInt(nodeinfo.sys.hardware.windows.memory[j].Capacity); } - } - } - output += csvClean('' + totalMemory); - } - } else if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.mobile)) { - // Mobile - output += ','; - output += ','; - output += ','; - output += ','; - output += ','; - if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.bootloader)) { output += csvClean(nodeinfo.sys.hardware.mobile.bootloader); } - output += ','; - output += ','; - output += ','; - if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.model)) { output += csvClean(nodeinfo.sys.hardware.mobile.model); } - output += ','; - if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.brand)) { output += csvClean(nodeinfo.sys.hardware.mobile.brand); } - output += ','; - output += ','; - if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.id)) { output += csvClean(nodeinfo.sys.hardware.mobile.id); } - output += ','; - output += ','; - output += ','; - output += ','; - output += ','; - output += ','; - output += ','; - } else if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.linux)) { - // Linux - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.cpu_name)) { output += csvClean(nodeinfo.sys.hardware.identifiers.cpu_name); } - output += ',,'; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.bios_date)) { output += csvClean(nodeinfo.sys.hardware.linux.bios_date); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.bios_vendor)) { output += csvClean(nodeinfo.sys.hardware.linux.bios_vendor); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.bios_version)) { output += csvClean(nodeinfo.sys.hardware.linux.bios_version); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.product_serial)) { output += csvClean(nodeinfo.sys.hardware.linux.product_serial); } - else if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_serial)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_serial); } - output += ','; - if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_mode)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_mode); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_name)) { output += csvClean(nodeinfo.sys.hardware.linux.board_name); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_vendor)) { output += csvClean(nodeinfo.sys.hardware.linux.board_vendor); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_version)) { output += csvClean(nodeinfo.sys.hardware.linux.board_version); } - output += ','; - if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.product_uuid)) { output += csvClean(nodeinfo.sys.hardware.linux.product_uuid); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.SpecVersion) { output += csvClean(nodeinfo.sys.hardware.tpm.SpecVersion); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.ManufacturerId) { output += csvClean(nodeinfo.sys.hardware.tpm.ManufacturerId); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.ManufacturerVersion) { output += csvClean(nodeinfo.sys.hardware.tpm.ManufacturerVersion); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.IsActivated) { output += csvClean(nodeinfo.sys.hardware.tpm.IsActivated ? 'true' : 'false'); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.IsEnabled) { output += csvClean(nodeinfo.sys.hardware.tpm.IsEnabled ? 'true' : 'false'); } - output += ','; - if (nodeinfo.sys.hardware.tpm && nodeinfo.sys.hardware.tpm.IsOwned) { output += csvClean(nodeinfo.sys.hardware.tpm.IsOwned ? 'true' : 'false'); } - output += ','; - if (nodeinfo.sys.hardware.linux.memory) { - if (nodeinfo.sys.hardware.linux.memory.Memory_Device) { - var totalMemory = 0; - for (var j in nodeinfo.sys.hardware.linux.memory.Memory_Device) { - if (nodeinfo.sys.hardware.linux.memory.Memory_Device[j].Size) { - if (typeof nodeinfo.sys.hardware.linux.memory.Memory_Device[j].Size == 'number') { totalMemory += nodeinfo.sys.hardware.linux.memory.Memory_Device[j].Size; } - if (typeof nodeinfo.sys.hardware.linux.memory.Memory_Device[j].Size == 'string') { totalMemory += parseInt(nodeinfo.sys.hardware.linux.memory.Memory_Device[j].Size); } - } - } - output += csvClean('' + (totalMemory * Math.pow(1024, 3))); - } - } - } else { - output += ',,,,,,,,,,,,,,,,,,'; - } - - // Agent information - if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.agentvers)) { - output += ','; - if (nodeinfo.sys.hardware.agentvers.openssl) { output += csvClean(nodeinfo.sys.hardware.agentvers.openssl); } - output += ','; - if (nodeinfo.sys.hardware.agentvers.commitDate) { output += csvClean(nodeinfo.sys.hardware.agentvers.commitDate); } - output += ','; - if (nodeinfo.sys.hardware.agentvers.commitHash) { output += csvClean(nodeinfo.sys.hardware.agentvers.commitHash); } - output += ','; - if (nodeinfo.sys.hardware.agentvers.compileTime) { output += csvClean(nodeinfo.sys.hardware.agentvers.compileTime); } - } else { - output += ',,,,'; - } - - // Network interfaces - if ((nodeinfo.net) && (nodeinfo.net.netif2)) { - output += ','; - output += Object.keys(nodeinfo.net.netif2).length; // Interface count - var macs = [], addresses = []; - for (var j in nodeinfo.net.netif2) { - if (Array.isArray(nodeinfo.net.netif2[j])) { - for (var k = 0; k < nodeinfo.net.netif2[j].length; k++) { - if (typeof nodeinfo.net.netif2[j][k].mac == 'string') { macs.push(nodeinfo.net.netif2[j][k].mac); } - if (typeof nodeinfo.net.netif2[j][k].address == 'string') { addresses.push(nodeinfo.net.netif2[j][k].address); } - } - } - } - output += ','; - output += csvClean(macs.join(' ')); // MACS - output += ','; - output += csvClean(addresses.join(' ')); // Addresses - } else { - output += ',,,'; - } - - // Last connection information - if (nodeinfo.lastConnect) { - output += ','; - if (nodeinfo.lastConnect.time) { - // Last connection time - if ((typeof command.l == 'string') && (typeof command.tz == 'string')) { - output += csvClean(new Date(nodeinfo.lastConnect.time).toLocaleString(command.l, { timeZone: command.tz })) - } else { - output += nodeinfo.lastConnect.time; - } - } - output += ','; - if (typeof nodeinfo.lastConnect.addr == 'string') { output += csvClean(nodeinfo.lastConnect.addr); } // Last connection address and port - } else { - output += ',,'; - } - - output += '\r\n'; - } - } catch (ex) { console.log(ex); } - } else { - // Create the JSON file - - // Add the device group name to each device + var output = null; + if (type == 'csv') { + try { + // Create the CSV file + output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,avdetails,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,totalMemory,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses,lastConnectTime,lastConnectAddr\r\n'; for (var i = 0; i < results.length; i++) { const nodeinfo = results[i]; - if (nodeinfo.node) { - const mesh = parent.meshes[nodeinfo.node.meshid]; - if (mesh) { results[i].node.groupname = mesh.name; } - } - } - output = JSON.stringify(results, null, 2); + // Node information + if (nodeinfo.node != null) { + const n = nodeinfo.node; + output += csvClean(n._id) + ',' + csvClean(n.name) + ',' + csvClean(n.rname ? n.rname : '') + ',' + csvClean(n.host ? n.host : '') + ',' + (n.icon ? n.icon : 1) + ',' + (n.ip ? n.ip : '') + ',' + (n.osdesc ? csvClean(n.osdesc) : '') + ',' + csvClean(parent.meshes[n.meshid].name); + if (typeof n.wsc == 'object') { + output += ',' + csvClean(n.wsc.antiVirus ? n.wsc.antiVirus : '') + ',' + csvClean(n.wsc.autoUpdate ? n.wsc.autoUpdate : '') + ',' + csvClean(n.wsc.firewall ? n.wsc.firewall : '') + } else { output += ',,,'; } + if (typeof n.av == 'object') { + var avdetails = '', firstav = true; + for (var a in n.av) { if (typeof n.av[a].product == 'string') { if (firstav) { firstav = false; } else { avdetails += '|'; } avdetails += (n.av[a].product + '/' + ((n.av[a].enabled) ? 'enabled' : 'disabled') + '/' + ((n.av[a].updated) ? 'updated' : 'notupdated')); } } + output += ',' + csvClean(avdetails); + } + else { output += ','; } + } else { + output += ',,,,,,,,,,,'; + } + + // System infomation + if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.windows) && (nodeinfo.sys.hardware.windows)) { + // Windows + output += ','; + if (nodeinfo.sys.hardware.windows.cpu && (nodeinfo.sys.hardware.windows.cpu.length > 0) && (typeof nodeinfo.sys.hardware.windows.cpu[0].Name == 'string')) { output += csvClean(nodeinfo.sys.hardware.windows.cpu[0].Name); } + output += ','; + if (nodeinfo.sys.hardware.windows.osinfo && (nodeinfo.sys.hardware.windows.osinfo.BuildNumber)) { output += csvClean(nodeinfo.sys.hardware.windows.osinfo.BuildNumber); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_date)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_date); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_vendor)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_vendor); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.bios_version)) { output += csvClean(nodeinfo.sys.hardware.identifiers.bios_version); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_name)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_name); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_vendor)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_vendor); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_version)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_version); } + output += ','; + if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.product_uuid)) { output += csvClean(nodeinfo.sys.hardware.identifiers.product_uuid); } + output += ','; + if (nodeinfo.sys.hardware.windows.memory) { + var totalMemory = 0; + for (var j in nodeinfo.sys.hardware.windows.memory) { + if (nodeinfo.sys.hardware.windows.memory[j].Capacity) { + if (typeof nodeinfo.sys.hardware.windows.memory[j].Capacity == 'number') { totalMemory += nodeinfo.sys.hardware.windows.memory[j].Capacity; } + if (typeof nodeinfo.sys.hardware.windows.memory[j].Capacity == 'string') { totalMemory += parseInt(nodeinfo.sys.hardware.windows.memory[j].Capacity); } + } + } + output += csvClean('' + totalMemory); + } + } else if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.mobile)) { + // Mobile + output += ','; + output += ','; + output += ','; + output += ','; + output += ','; + if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.bootloader)) { output += csvClean(nodeinfo.sys.hardware.mobile.bootloader); } + output += ','; + if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.model)) { output += csvClean(nodeinfo.sys.hardware.mobile.model); } + output += ','; + if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.brand)) { output += csvClean(nodeinfo.sys.hardware.mobile.brand); } + output += ','; + output += ','; + if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.id)) { output += csvClean(nodeinfo.sys.hardware.mobile.id); } + output += ','; + } else if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.windows) && (nodeinfo.sys.hardware.linux)) { + // Linux + output += ','; + output += ','; + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.bios_date)) { output += csvClean(nodeinfo.sys.hardware.linux.bios_date); } + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.bios_vendor)) { output += csvClean(nodeinfo.sys.hardware.linux.bios_vendor); } + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.bios_version)) { output += csvClean(nodeinfo.sys.hardware.linux.bios_version); } + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_name)) { output += csvClean(nodeinfo.sys.hardware.linux.board_name); } + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_vendor)) { output += csvClean(nodeinfo.sys.hardware.linux.board_vendor); } + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_version)) { output += csvClean(nodeinfo.sys.hardware.linux.board_version); } + output += ','; + if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.product_uuid)) { output += csvClean(nodeinfo.sys.hardware.linux.product_uuid); } + output += ','; + } else { + output += ',,,,,,,,,,'; + } + + // Agent information + if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.agentvers)) { + output += ','; + if (nodeinfo.sys.hardware.agentvers.openssl) { output += csvClean(nodeinfo.sys.hardware.agentvers.openssl); } + output += ','; + if (nodeinfo.sys.hardware.agentvers.commitDate) { output += csvClean(nodeinfo.sys.hardware.agentvers.commitDate); } + output += ','; + if (nodeinfo.sys.hardware.agentvers.commitHash) { output += csvClean(nodeinfo.sys.hardware.agentvers.commitHash); } + output += ','; + if (nodeinfo.sys.hardware.agentvers.compileTime) { output += csvClean(nodeinfo.sys.hardware.agentvers.compileTime); } + } else { + output += ',,,,'; + } + + // Network interfaces + if ((nodeinfo.net) && (nodeinfo.net.netif2)) { + output += ','; + output += Object.keys(nodeinfo.net.netif2).length; // Interface count + var macs = [], addresses = []; + for (var j in nodeinfo.net.netif2) { + if (Array.isArray(nodeinfo.net.netif2[j])) { + for (var k = 0; k < nodeinfo.net.netif2[j].length; k++) { + if (typeof nodeinfo.net.netif2[j][k].mac == 'string') { macs.push(nodeinfo.net.netif2[j][k].mac); } + if (typeof nodeinfo.net.netif2[j][k].address == 'string') { addresses.push(nodeinfo.net.netif2[j][k].address); } + } + } + } + output += ','; + output += csvClean(macs.join(' ')); // MACS + output += ','; + output += csvClean(addresses.join(' ')); // Addresses + } else { + output += ',,,'; + } + + // Last connection information + if (nodeinfo.lastConnect) { + output += ','; + if (nodeinfo.lastConnect.time) { + // Last connection time + if ((typeof command.l == 'string') && (typeof command.tz == 'string')) { + output += csvClean(new Date(nodeinfo.lastConnect.time).toLocaleString(command.l, { timeZone: command.tz })) + } else { + output += nodeinfo.lastConnect.time; + } + } + output += ','; + if (typeof nodeinfo.lastConnect.addr == 'string') { output += csvClean(nodeinfo.lastConnect.addr); } // Last connection address and port + } else { + output += ',,'; + } + + output += '\r\n'; + } + } catch (ex) { console.log(ex); } + } else { + // Create the JSON file + + // Add the device group name to each device + for (var i = 0; i < results.length; i++) { + const nodeinfo = results[i]; + if (nodeinfo.node) { + const mesh = parent.meshes[nodeinfo.node.meshid]; + if (mesh) { results[i].node.groupname = mesh.name; } + } } - try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { } - }); + + output = JSON.stringify(results, null, 2); + } + try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { } }); }); + break; } case 'endDesktopMultiplex': { @@ -5417,109 +4946,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } break; } - case 'importamtdevices': { - if ((command.amtdevices == null) || (command.meshid == null) || (typeof command.meshid != 'string') || (command.meshid.startsWith('mesh/' + domain.id + '/') == false)) return; - const mesh = parent.meshes[command.meshid]; - if ((mesh == null) || (mesh.mtype != 1) || (parent.GetMeshRights(user, command.meshid) & MESHRIGHT_EDITMESH) == 0) return null; // This user must have mesh rights to edit the device group - var amtDevices = []; - - // Decode a JSON file from the Intel SCS migration tool - if ((typeof command.amtdevices == 'object') && (typeof command.amtdevices.ApplicationData == 'object') && (command.amtdevices.ApplicationData.Application == 'Intel vPro(R) Manageability Migration Tool') && (typeof command.amtdevices['ManagedSystems'] == 'object') && (Array.isArray(command.amtdevices['ManagedSystems']['ManagedSystemsList']))) { - for (var i in command.amtdevices['ManagedSystems']['ManagedSystemsList']) { - const importDev = command.amtdevices['ManagedSystems']['ManagedSystemsList'][i]; - var host = null; - if ((typeof importDev.Fqdn == 'string') && (importDev.Fqdn != '')) { host = importDev.Fqdn; } - if ((host == null) && (typeof importDev.IPv4 == 'string') && (importDev.IPv4 != '')) { host = importDev.IPv4; } - if (host != null) { - // Create a new Intel AMT device - const nodeid = 'node/' + domain.id + '/' + parent.crypto.randomBytes(48).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); - const device = { type: 'node', _id: nodeid, meshid: mesh._id, mtype: 1, icon: 1, name: host, host: host, domain: domain.id, intelamt: { user: 'admin', state: 2 } }; - - // Add optional fields - if (typeof importDev.AmtVersion == 'string') { device.intelamt.ver = importDev.AmtVersion; } - if (typeof importDev.ConfiguredPassword == 'string') { device.intelamt.pass = importDev.ConfiguredPassword; } - if (typeof importDev.Uuid == 'string') { device.intelamt.uuid = importDev.Uuid; } - if (importDev.ConnectionType == 'TLS') { device.intelamt.tls = 1; } - - // Check if we are already adding a device with the same hostname, if so, skip it. - var skip = false; - for (var i in amtDevices) { if (amtDevices[i].host.toLowerCase() == device.host.toLowerCase()) { skip = true; } } - if (skip == false) { amtDevices.push(device); } - } - } - } - - // Decode a JSON file from MeshCommander - if ((typeof command.amtdevices == 'object') && (typeof command.amtdevices.webappversion == 'string') && (Array.isArray(command.amtdevices.computers))) { - for (var i in command.amtdevices.computers) { - const importDev = command.amtdevices.computers[i]; - if ((typeof importDev.host == 'string') && (importDev.host != '') && (importDev.host != '127.0.0.1') && (importDev.host.toLowerCase() != 'localhost')) { - // Create a new Intel AMT device - const nodeid = 'node/' + domain.id + '/' + parent.crypto.randomBytes(48).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); - const device = { type: 'node', _id: nodeid, meshid: mesh._id, mtype: 1, icon: 1, host: importDev.host, domain: domain.id, intelamt: { user: 'admin', state: 2 } }; - if (typeof importDev.name == 'string') { device.name = importDev.name; } else { device.name = importDev.host; } - - // Add optional fields - if (typeof importDev.user == 'string') { device.intelamt.user = importDev.user; } - if (typeof importDev.pass == 'string') { device.intelamt.pass = importDev.pass; } - if ((importDev.tls === true) || (importDev.tls === 1)) { device.intelamt.tls = 1; } - if (typeof importDev.digestrealm == 'string') { device.intelamt.realm = importDev.digestrealm; } - if (typeof importDev.ver == 'string') { device.intelamt.ver = importDev.ver; } - if (typeof importDev.uuid == 'string') { device.intelamt.uuid = importDev.uuid; } - if (typeof importDev.pstate == 'number') { device.intelamt.state = importDev.pstate; } - if (typeof importDev.tlscerthash == 'string') { device.intelamt.hash = importDev.tlscerthash; } - if (typeof importDev.icon == 'number') { device.icon = importDev.icon; } - if (typeof importDev.desc == 'string') { device.desc = importDev.desc; } - - // Check if we are already adding a device with the same hostname, if so, skip it. - var skip = false; - for (var i in amtDevices) { if (amtDevices[i].host.toLowerCase() == device.host.toLowerCase()) { skip = true; } } - if (skip == false) { amtDevices.push(device); } - } - } - } - - // Decode a JSON file in simple format - if (Array.isArray(command.amtdevices)) { - for (var i in command.amtdevices) { - const importDev = command.amtdevices[i]; - if ((typeof importDev.fqdn == 'string') && (importDev.fqdn != '') && (importDev.fqdn != '127.0.0.1') && (importDev.fqdn.toLowerCase() != 'localhost')) { - // Create a new Intel AMT device - const nodeid = 'node/' + domain.id + '/' + parent.crypto.randomBytes(48).toString('base64').replace(/\+/g, '@').replace(/\//g, '$'); - const device = { type: 'node', _id: nodeid, meshid: mesh._id, mtype: 1, icon: 1, host: importDev.fqdn, domain: domain.id, intelamt: { user: 'admin', state: 2 } }; - if (typeof importDev.name == 'string') { device.name = importDev.name; } else { device.name = importDev.host; } - - // Add optional fields - if (typeof importDev.username == 'string') { device.intelamt.user = importDev.username; } - if (typeof importDev.password == 'string') { device.intelamt.pass = importDev.password; } - if ((importDev.tls === true) || (importDev.tls === 1)) { device.intelamt.tls = 1; } - if (typeof importDev.version == 'string') { device.intelamt.ver = importDev.version; } - if (typeof importDev.digestrealm == 'string') { device.intelamt.realm = importDev.digestrealm; } - if (typeof importDev.uuid == 'string') { device.intelamt.uuid = importDev.uuid; } - if (typeof importDev.pstate == 'number') { device.intelamt.state = importDev.pstate; } - if (typeof importDev.tlscerthash == 'string') { device.intelamt.hash = importDev.tlscerthash; } - if (typeof importDev.icon == 'number') { device.icon = importDev.icon; } - if (typeof importDev.desc == 'string') { device.desc = importDev.desc; } - - // Check if we are already adding a device with the same hostname, if so, skip it. - var skip = false; - for (var i in amtDevices) { if (amtDevices[i].host.toLowerCase() == device.host.toLowerCase()) { skip = true; } } - if (skip == false) { amtDevices.push(device); } - } - } - } - - // Add all the correctly parsed devices to the database and event them - // TODO: We may want to remove any devices with duplicate hostnames - if (amtDevices.length == 0) return; - for (var i in amtDevices) { - // Save the device to the database - db.Set(amtDevices[i]); - // Event the new node - parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(command.meshid, [nodeid]), obj, { etype: 'node', userid: user._id, username: user.name, action: 'addnode', node: parent.CloneSafeNode(amtDevices[i]), msgid: 84, msgArgs: [amtDevices[i].name, mesh.name], msg: 'Added device ' + amtDevices[i].name + ' to device group ' + mesh.name, domain: domain.id }); - } - break; - } default: { // Unknown user action console.log('Unknown action from user ' + user.name + ': ' + command.action + '.'); @@ -5540,7 +4966,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use 'changelang': serverCommandChangeLang, 'close': serverCommandClose, 'confirmPhone': serverCommandConfirmPhone, - 'confirmMessaging': serverCommandConfirmMessaging, 'emailuser': serverCommandEmailUser, 'files': serverCommandFiles, 'getClip': serverCommandGetClip, @@ -5557,21 +4982,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use 'pong': serverCommandPong, 'powertimeline': serverCommandPowerTimeline, 'print': serverCommandPrint, - 'removePhone': serverCommandRemovePhone, - 'removeMessaging': serverCommandRemoveMessaging, + 'removePhone': serverCommandremovePhone, 'removeuserfromusergroup': serverCommandRemoveUserFromUserGroup, 'report': serverCommandReport, 'serverclearerrorlog': serverCommandServerClearErrorLog, 'serverconsole': serverCommandServerConsole, 'servererrors': serverCommandServerErrors, - 'serverconfig': serverCommandServerConfig, 'serverstats': serverCommandServerStats, 'servertimelinestats': serverCommandServerTimelineStats, 'serverupdate': serverCommandServerUpdate, 'serverversion': serverCommandServerVersion, 'setClip': serverCommandSetClip, 'smsuser': serverCommandSmsUser, - 'msguser': serverCommandMsgUser, 'trafficdelta': serverCommandTrafficDelta, 'trafficstats': serverCommandTrafficStats, 'updateAgents': serverCommandUpdateAgents, @@ -5579,8 +5001,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use 'urlargs': serverCommandUrlArgs, 'users': serverCommandUsers, 'verifyemail': serverCommandVerifyEmail, - 'verifyPhone': serverCommandVerifyPhone, - 'verifyMessaging': serverCommandVerifyMessaging + 'verifyPhone': serverCommandVerifyPhone }; const serverUserCommands = { @@ -5608,12 +5029,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use 'dupagents': [serverUserCommandDupAgents, ""], 'email': [serverUserCommandEmail, ""], 'emailnotifications': [serverUserCommandEmailNotifications, ""], - 'msgnotifications': [serverUserCommandMessageNotifications, ""], 'firebase': [serverUserCommandFirebase, ""], 'heapdump': [serverUserCommandHeapDump, ""], 'heapdump2': [serverUserCommandHeapDump2, ""], 'help': [serverUserCommandHelp, ""], - 'info': [serverUserCommandInfo, "Returns the most immidiatly useful information about this server, including MeshCentral and NodeJS versions. This is often information required to file a bug. Optionally use info h for human readable form."], + 'info': [serverUserCommandInfo, "Returns the most immidiatly useful information about this server, including MeshCentral and NodeJS versions. This is often information required to file a bug."], 'le': [serverUserCommandLe, ""], 'lecheck': [serverUserCommandLeCheck, ""], 'leevents': [serverUserCommandLeEvents, ""], @@ -5629,8 +5049,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use 'serverupdate': [serverUserCommandServerUpdate, "Updates server to latest version. Optional version argument to install specific version. Example: serverupdate 0.8.49"], 'setmaxtasks': [serverUserCommandSetMaxTasks, ""], 'showpaths': [serverUserCommandShowPaths, ""], - 'sms': [serverUserCommandSMS, "Send a SMS message to a specified phone number"], - 'msg': [serverUserCommandMsg, "Send a user message to a user handle"], + 'sms': [serverUserCommandSMS, ""], 'swarmstats': [serverUserCommandSwarmStats, ""], 'tasklimiter': [serverUserCommandTaskLimiter, "Returns the internal status of the tasklimiter. This is a system used to smooth out work done by the server. It's used by, for example, agent updates so that not all agents are updated at the same time."], 'trafficdelta': [serverUserCommandTrafficDelta, ""], @@ -5650,7 +5069,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (common.validateString(command.nodeid, 1, 1024) == false) { err = 'Invalid nodeid'; } // Check the nodeid else if (common.validateInt(command.rights) == false) { err = 'Invalid rights'; } // Device rights must be an integer else if ((command.rights & 7) != 0) { err = 'Invalid rights'; } // EDITMESH, MANAGEUSERS or MANAGECOMPUTERS rights can't be assigned to a user to device link - else if ((common.validateStrArray(command.usernames, 1, 128) == false) && (common.validateStrArray(command.userids, 1, 128) == false)) { err = 'Invalid usernames'; } // Username is between 1 and 128 characters + else if ((common.validateStrArray(command.usernames, 1, 64) == false) && (common.validateStrArray(command.userids, 1, 128) == false)) { err = 'Invalid usernames'; } // Username is between 1 and 64 characters else { if (command.nodeid.indexOf('/') == -1) { command.nodeid = 'node/' + domain.id + '/' + command.nodeid; } else if ((command.nodeid.split('/').length != 3) || (command.nodeid.split('/')[1] != domain.id)) { err = 'Invalid domain'; } // Invalid domain, operation only valid for current domain @@ -5797,7 +5216,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use try { if (common.validateString(command.meshid, 8, 134) == false) { err = 'Invalid groupid'; } // Check the meshid else if (common.validateInt(command.meshadmin) == false) { err = 'Invalid group rights'; } // Mesh rights must be an integer - else if ((common.validateStrArray(command.usernames, 1, 128) == false) && (common.validateStrArray(command.userids, 1, 128) == false)) { err = 'Invalid usernames'; } // Username is between 1 and 128 characters + else if ((common.validateStrArray(command.usernames, 1, 64) == false) && (common.validateStrArray(command.userids, 1, 128) == false)) { err = 'Invalid usernames'; } // Username is between 1 and 64 characters else { if (command.meshid.indexOf('/') == -1) { command.meshid = 'mesh/' + domain.id + '/' + command.meshid; } mesh = parent.meshes[command.meshid]; @@ -6128,7 +5547,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use try { if ((user.siteadmin & SITERIGHT_USERGROUPS) == 0) { err = 'Permission denied'; } else if (common.validateString(command.ugrpid, 1, 1024) == false) { err = 'Invalid groupid'; } // Check the meshid - else if (common.validateStrArray(command.usernames, 1, 128) == false) { err = 'Invalid usernames'; } // Username is between 1 and 128 characters + else if (common.validateStrArray(command.usernames, 1, 64) == false) { err = 'Invalid usernames'; } // Username is between 1 and 64 characters else { var ugroupidsplit = command.ugrpid.split('/'); if ((ugroupidsplit.length != 3) || (ugroupidsplit[0] != 'ugrp') || ((obj.crossDomain !== true) && (ugroupidsplit[1] != domain.id))) { err = 'Invalid groupid'; } @@ -6149,9 +5568,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Get the user group var group = parent.userGroups[command.ugrpid]; if (group != null) { - // If this user group is an externally managed user group, we can't add users to it. - if ((group != null) && (group.membershipType != null)) return; - if (group.links == null) { group.links = {}; } var unknownUsers = [], addedCount = 0, failCount = 0, knownUsers = []; @@ -6161,7 +5577,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var chguser = parent.users[chguserid]; if (chguser == null) { chguserid = 'user/' + addUserDomain.id + '/' + command.usernames[i]; chguser = parent.users[chguserid]; } if (chguser != null) { - // Add usr group to user + // Add mesh to user if (chguser.links == null) { chguser.links = {}; } chguser.links[group._id] = { rights: 1 }; db.SetUser(chguser); @@ -6219,7 +5635,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use ws.send(JSON.stringify({ action: 'authcookie', cookie: parent.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: req.clientIp }, parent.parent.loginCookieEncryptionKey), - rcookie: parent.parent.encodeCookie({ ruserid: user._id, x: req.session.x }, parent.parent.loginCookieEncryptionKey) + rcookie: parent.parent.encodeCookie({ ruserid: user._id }, parent.parent.loginCookieEncryptionKey) })); } catch (ex) { } } @@ -6295,7 +5711,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.db.SetUser(user); // Event the change - var message = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', domain: domain.id, msgid: 3, msgArgs: ['', (oldlang ? oldlang : 'default'), (user.lang ? user.lang : 'default')] }; + var message = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', domain: domain.id, msgid: 2, msgArgs: [(oldlang ? oldlang : 'default'), (user.lang ? user.lang : 'default')] }; if (db.changeStream) { message.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. message.msg = 'Changed language from ' + (oldlang ? oldlang : 'default') + ' to ' + (user.lang ? user.lang : 'default'); @@ -6339,35 +5755,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.parent.DispatchEvent(['*', 'server-users', user._id], obj, event); } - function serverCommandConfirmMessaging(command) { - // Do not allow this command when logged in using a login token - if (req.session.loginToken != null) return; - - if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; // If this account is settings locked, return here. - if ((parent.parent.msgserver == null) || (typeof command.cookie != 'string') || (typeof command.code != 'string') || (obj.failedMsgCookieCheck == 1)) return; // Input checks - var cookie = parent.parent.decodeCookie(command.cookie); - if (cookie == null) return; // Invalid cookie - if (cookie.s != ws.sessionId) return; // Invalid session - if (cookie.c != command.code) { - obj.failedMsgCookieCheck = 1; - // Code does not match, delay the response to limit how many guesses we can make and don't allow more than 1 guess at any given time. - setTimeout(function () { - ws.send(JSON.stringify({ action: 'verifyMessaging', cookie: command.cookie, success: true })); - delete obj.failedMsgCookieCheck; - }, 2000 + (parent.crypto.randomBytes(2).readUInt16BE(0) % 4095)); - return; - } - - // Set the user's messaging handle - user.msghandle = cookie.p; - db.SetUser(user); - - // Event the change - var event = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', msgid: 156, msgArgs: [user.name], msg: 'Verified messaging account of user ' + EscapeHtml(user.name), domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. - parent.parent.DispatchEvent(['*', 'server-users', user._id], obj, event); - } - function serverCommandEmailUser(command) { var errMsg = null, emailuser = null; if (domain.mailserver == null) { errMsg = 'Email server not enabled'; } @@ -6416,7 +5803,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (command.nodeid) { cookieContent.nodeid = command.nodeid; } if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want the agent to TCP connect to a remote address if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want the agent to TCP connect to a remote port - if (command.tag == 'novnc') { cookieContent.p = 12; } // If tag is novnc we must encode a protocol for meshrelay logging if (node.mtype == 3) { cookieContent.lc = 1; command.localRelay = true; } // Indicate this is for a local connection command.cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey); command.trustedCert = parent.isTrustedCert(domain); @@ -6465,12 +5851,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use delete doc.type; delete doc.domain; delete doc._id; - - // If this is not a device group admin users, don't send any BitLocker recovery passwords - if ((rights != MESHRIGHT_ADMIN) && (doc.hardware) && (doc.hardware.windows) && (doc.hardware.windows.volumes)) { - for (var i in doc.hardware.windows.volumes) { delete doc.hardware.windows.volumes[i].recoveryPassword; } - } - if (command.nodeinfo === true) { doc.node = node; doc.rights = rights; } obj.send(doc); } else { @@ -6534,30 +5914,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } function serverCommandLastConnects(command) { - if (obj.visibleDevices == null) { - // If we are not paging, get all devices visible to this user - const links = parent.GetAllMeshIdWithRights(user); - const extraids = getUserExtraIds(); - db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, obj.deviceSkip, obj.deviceLimit, function (err, docs) { - if (docs == null) return; + const links = parent.GetAllMeshIdWithRights(user); + const extraids = getUserExtraIds(); + db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, function (err, docs) { + if (docs == null) return; - // Create a list of node ids for this user and query them for last device connection time - const ids = [] - for (var i in docs) { ids.push('lc' + docs[i]._id); } - - // Pull list of last connections only for device owned by this user - db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) { - if (docs == null) return; - const response = {}; - for (var j in docs) { response[docs[j]._id.substring(2)] = docs[j].time; } - obj.send({ action: 'lastconnects', lastconnects: response, tag: command.tag }); - }); - }); - } else { - // If we are paging, we know what devices the user is look at // Create a list of node ids for this user and query them for last device connection time const ids = [] - for (var i in obj.visibleDevices) { ids.push('lc' + i); } + for (var i in docs) { ids.push('lc' + docs[i]._id); } // Pull list of last connections only for device owned by this user db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) { @@ -6566,7 +5930,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use for (var j in docs) { response[docs[j]._id.substring(2)] = docs[j].time; } obj.send({ action: 'lastconnects', lastconnects: response, tag: command.tag }); }); - } + }); } function serverCommandLoginCookie(command) { @@ -6621,7 +5985,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use function serverCommandPrint(command) { console.log(command.value); } - function serverCommandRemovePhone(command) { + function serverCommandremovePhone(command) { // Do not allow this command when logged in using a login token if (req.session.loginToken != null) return; @@ -6638,23 +6002,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.parent.DispatchEvent(['*', 'server-users', user._id], obj, event); } - function serverCommandRemoveMessaging(command) { - // Do not allow this command when logged in using a login token - if (req.session.loginToken != null) return; - - if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; // If this account is settings locked, return here. - if (user.msghandle == null) return; - - // Clear the user's phone - delete user.msghandle; - db.SetUser(user); - - // Event the change - var event = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', msgid: 157, msgArgs: [user.name], msg: 'Removed messaging account of user ' + EscapeHtml(user.name), domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. - parent.parent.DispatchEvent(['*', 'server-users', user._id], obj, event); - } - function serverCommandRemoveUserFromUserGroup(command) { var err = null; try { @@ -6686,12 +6033,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var chguser = parent.users[command.userid]; if (chguser != null) { - // Get the user group - var group = parent.userGroups[command.ugrpid]; - - // If this user group is an externally managed user group, we can't remove a user from it. - if ((group != null) && (group.membershipType != null)) return; - if ((chguser.links != null) && (chguser.links[command.ugrpid] != null)) { delete chguser.links[command.ugrpid]; @@ -6705,6 +6046,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.parent.DispatchEvent([chguser._id], obj, 'resubscribe'); } + // Get the user group + var group = parent.userGroups[command.ugrpid]; if (group != null) { // Remove the user from the group if ((group.links != null) && (group.links[command.userid] != null)) { @@ -6723,13 +6066,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } function serverCommandReport(command) { - if (common.validateInt(command.type, 1, 4) == false) return; // Validate type + if (common.validateInt(command.type, 1, 3) == false) return; // Validate type if (common.validateInt(command.groupBy, 1, 3) == false) return; // Validate groupBy: 1 = User, 2 = Device, 3 = Day if ((typeof command.start != 'number') || (typeof command.end != 'number') || (command.start >= command.end)) return; // Validate start and end time const manageAllDeviceGroups = ((user.siteadmin == 0xFFFFFFFF) && (parent.parent.config.settings.managealldevicegroups.indexOf(user._id) >= 0)); if ((command.devGroup != null) && (manageAllDeviceGroups == false) && ((user.links == null) || (user.links[command.devGroup] == null))) return; // Asking for a device group that is not allowed - const msgIdFilter = [5, 10, 11, 12, 122, 123, 124, 125, 126, 144]; + const msgIdFilter = [5, 10, 11, 12, 122, 123, 124, 125, 126]; switch (command.type) { case 1: { remoteSessionReport(command, manageAllDeviceGroups, msgIdFilter); @@ -6743,10 +6086,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use userLoginReport(command); break; } - case 4: { - databaseRecordsReport(command); - break; - } } } @@ -6784,14 +6123,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use fs.readFile(parent.parent.getConfigFilePath('mesherrors.txt'), 'utf8', function (err, data) { obj.send({ action: 'servererrors', data: data }); }); } - function serverCommandServerConfig(command) { - // Load the server config.json. This is a sensitive file so care must be taken to only send to trusted administrators. - if (userHasSiteUpdate() && (domain.myserver !== false) && ((domain.myserver == null) || (domain.myserver.config === true))) { - const configFilePath = common.joinPath(parent.parent.datapath, (parent.parent.args.configfile ? parent.parent.args.configfile : 'config.json')); - fs.readFile(configFilePath, 'utf8', function (err, data) { obj.send({ action: 'serverconfig', data: data }); }); - } - } - function serverCommandServerStats(command) { // Only accept if the "My Server" tab is allowed for this domain if (domain.myserver === false) return; @@ -6872,29 +6203,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use }); } - function serverCommandMsgUser(command) { - var errMsg = null, msguser = null; - if ((parent.parent.msgserver == null) || (parent.parent.msgserver.providers == 0)) { errMsg = "Messaging server not enabled"; } - else if ((user.siteadmin & 2) == 0) { errMsg = "No user management rights"; } - else if (common.validateString(command.userid, 1, 2048) == false) { errMsg = "Invalid username"; } - else if (common.validateString(command.msg, 1, 160) == false) { errMsg = "Invalid message"; } - else { - msguser = parent.users[command.userid]; - if (msguser == null) { errMsg = "Invalid username"; } - else if (msguser.msghandle == null) { errMsg = "No messaging service configured for this user"; } - } - - if (errMsg != null) { displayNotificationMessage(errMsg); return; } - - parent.parent.msgserver.sendMessage(msguser.msghandle, command.msg, domain, function (success, msg) { - if (success) { - displayNotificationMessage("Message succesfuly sent.", null, null, null, 32); - } else { - if (typeof msg == 'string') { displayNotificationMessage("Messaging error: " + msg, null, null, null, 34, [msg]); } else { displayNotificationMessage("Messaging error", null, null, null, 33); } - } - }); - } - function serverCommandTrafficDelta(command) { const stats = parent.getTrafficDelta(obj.trafficStats); obj.trafficStats = stats.current; @@ -7003,34 +6311,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use }); } - function serverCommandVerifyMessaging(command) { - // Do not allow this command when logged in using a login token - if (req.session.loginToken != null) return; - - if ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1024) != 0)) return; // If this account is settings locked, return here. - if (parent.parent.msgserver == null) return; - if (common.validateString(command.handle, 1, 1024) == false) return; // Check handle length - - // Setup the handle for the right messaging service - var handle = null; - if ((command.service == 1) && ((parent.parent.msgserver.providers & 1) != 0)) { handle = 'telegram:@' + command.handle; } - if ((command.service == 4) && ((parent.parent.msgserver.providers & 4) != 0)) { handle = 'discord:' + command.handle; } - if ((command.service == 8) && ((parent.parent.msgserver.providers & 8) != 0)) { handle = 'xmpp:' + command.handle; } - if ((command.service == 16) && ((parent.parent.msgserver.providers & 16) != 0)) { handle = parent.parent.msgserver.callmebotUrlToHandle(command.handle); } - if ((command.service == 32) && ((parent.parent.msgserver.providers & 32) != 0)) { handle = 'pushover:' + command.handle; } - if ((command.service == 64) && ((parent.parent.msgserver.providers & 64) != 0)) { handle = 'ntfy:' + command.handle; } - if ((command.service == 128) && ((parent.parent.msgserver.providers & 128) != 0)) { handle = 'zulip:' + command.handle; } - if ((command.service == 256) && ((parent.parent.msgserver.providers & 256) != 0)) { handle = 'slack:' + command.handle; } - if (handle == null) return; - - // Send a verification message - const code = common.zeroPad(getRandomSixDigitInteger(), 6); - const messagingCookie = parent.parent.encodeCookie({ a: 'verifyMessaging', c: code, p: handle, s: ws.sessionId }); - parent.parent.msgserver.sendMessagingCheck(domain, handle, code, parent.getLanguageCodes(req), function (success) { - ws.send(JSON.stringify({ action: 'verifyMessaging', cookie: messagingCookie, success: success })); - }); - } - function serverUserCommandHelp(cmdData) { var fin = '', f = '', availcommands = []; for (var i in serverUserCommands) { availcommands.push(i); } @@ -7154,33 +6434,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } } - function serverUserCommandMsg(cmdData) { - if ((parent.parent.msgserver == null) || (parent.parent.msgserver.providers == 0)) { - cmdData.result = "No messaging providers configured."; - } else { - if (cmdData.cmdargs['_'].length != 2) { - var r = []; - if ((parent.parent.msgserver.providers & 1) != 0) { r.push("Usage: MSG \"telegram:[@UserHandle]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 2) != 0) { r.push("Usage: MSG \"signal:[UserHandle]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 4) != 0) { r.push("Usage: MSG \"discord:[Username#0000]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 8) != 0) { r.push("Usage: MSG \"xmpp:[username@server.com]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 32) != 0) { r.push("Usage: MSG \"pushover:[userkey]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 64) != 0) { r.push("Usage: MSG \"ntfy:[topic]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 128) != 0) { r.push("Usage: MSG \"zulip:[topic]\" \"Message\"."); } - if ((parent.parent.msgserver.providers & 256) != 0) { r.push("Usage: MSG \"slack:[webhook]\" \"Message\"."); } - cmdData.result = r.join('\r\n'); - } else { - parent.parent.msgserver.sendMessage(cmdData.cmdargs['_'][0], cmdData.cmdargs['_'][1], domain, function (status, msg) { - if (typeof msg == 'string') { - try { ws.send(JSON.stringify({ action: 'serverconsole', value: status ? ('Success: ' + msg) : ('Failed: ' + msg), tag: cmdData.command.tag })); } catch (ex) { } - } else { - try { ws.send(JSON.stringify({ action: 'serverconsole', value: status ? 'Success' : 'Failed', tag: cmdData.command.tag })); } catch (ex) { } - } - }); - } - } - } - function serverUserCommandEmail(cmdData) { if (domain.mailserver == null) { cmdData.result = "No email service enabled."; @@ -7206,23 +6459,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use x += ' ' + info.mn + ', ' + info.nn + ', c:' + (info.c ? info.c : 0) + ', d:' + (info.d ? info.d : 0) + '\r\n'; } } - cmdData.result = ((x == '') ? 'None' : x); - } - } - - function serverUserCommandMessageNotifications(cmdData) { - if (parent.parent.msgserver == null) { - cmdData.result = "No messaging service enabled."; - } else { - var x = ''; - for (var userid in parent.parent.msgserver.deviceNotifications) { - x += userid + '\r\n'; - for (var nodeid in parent.parent.msgserver.deviceNotifications[userid].nodes) { - const info = parent.parent.msgserver.deviceNotifications[userid].nodes[nodeid]; - x += ' ' + info.mn + ', ' + info.nn + ', c:' + (info.c ? info.c : 0) + ', d:' + (info.d ? info.d : 0) + '\r\n'; - } - } - cmdData.result = ((x == '') ? 'None' : x); + cmdData.result = ((x == '')?'None':x); } } @@ -7271,9 +6508,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use for (var i in parent.badLoginTable) { badLoginCount++; if (typeof parent.badLoginTable[i] == 'number') { - cmdData.result += (i + " - Cooloff for " + Math.floor((parent.badLoginTable[i] - Date.now()) / 60000) + " minute(s)\r\n"); + cmdData.result += "Cooloff for " + Math.floor((parent.badLoginTable[i] - Date.now()) / 60000) + " minute(s)\r\n"; } else { - cmdData.result += (i + ' - ' + parent.badLoginTable[i].length + " attempt(s) until Cooloff ban\r\n"); + if (parent.badLoginTable[i].length > 1) { + cmdData.result += (i + ' - ' + parent.badLoginTable[i].length + " records\r\n"); + } else { + cmdData.result += (i + ' - ' + parent.badLoginTable[i].length + " record\r\n"); + } } } if (badLoginCount == 0) { cmdData.result += 'No bad logins.'; } @@ -7559,55 +6800,21 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } function serverUserCommandInfo(cmdData) { - function convertSeconds (s, form) { - if (!['long', 'shortprecise'].includes(form)) { - form = 'shortprecise'; - } - let t = {}, r = ''; - t.d = Math.floor(s / (24 * 3600)); - s %= 24 * 3600; - t.h= Math.floor(s / 3600); - s %= 3600; - t.m = Math.floor(s / 60); - t.s =(s%60).toFixed(0); - if ( form == 'long') { - r = t.d + ((t.d == 1) ? ' day, ' : ' days, ') + t.h + ((t.h == 1) ? ' hour, ' : ' hours, ') + t.m + ((t.m == 1) ? ' minute, ' : ' minutes, ') + t.s+ ((t.s == 1) ? ' second' : ' seconds'); - } else if (form == 'shortprecise') { - r = String(t.d).padStart(2, '0') + ':' + String(t.h).padStart(2, '0') + ':' + String(t.m).padStart(2, '0') + ':' + String((s%60).toFixed(2)).padStart(5, '0') + 's'; - } - return r; - } - var info = {}, arg = null, t = {}, r = ''; - if ((cmdData.cmdargs['_'] != null) && (cmdData.cmdargs['_'][0] != null)) { arg = cmdData.cmdargs['_'][0].toLowerCase(); } + var info = {}; try { info.meshVersion = 'v' + parent.parent.currentVer; } catch (ex) { } try { info.nodeVersion = process.version; } catch (ex) { } try { info.runMode = (["Hybrid (LAN + WAN) mode", "WAN mode", "LAN mode"][(args.lanonly ? 2 : (args.wanonly ? 1 : 0))]); } catch (ex) { } try { info.productionMode = ((process.env.NODE_ENV != null) && (process.env.NODE_ENV == 'production')); } catch (ex) { } - try { info.database = ["Unknown", "NeDB", "MongoJS", "MongoDB", "MariaDB", "MySQL", "PostgreSQL", "AceBase", "SQLite"][parent.parent.db.databaseType]; } catch (ex) { } + try { info.database = ["Unknown", "NeDB", "MongoJS", "MongoDB", "MariaDB", "MySQL", "PostgreSQL"][parent.parent.db.databaseType]; } catch (ex) { } try { if (parent.db.databaseType == 3) { info.dbChangeStream = parent.db.changeStream; info.dbBulkOperations = (parent.parent.config.settings.mongodbbulkoperations === true); } } catch (ex) { } try { if (parent.parent.multiServer != null) { info.serverId = parent.parent.multiServer.serverid; } } catch (ex) { } try { if (parent.parent.pluginHandler != null) { info.plugins = []; for (var i in parent.parent.pluginHandler.plugins) { info.plugins.push(i); } } } catch (ex) { } try { info.platform = process.platform; } catch (ex) { } try { info.arch = process.arch; } catch (ex) { } try { info.pid = process.pid; } catch (ex) { } - if (arg == 'h') { - try { - info.uptime = convertSeconds(process.uptime(), 'long'); - info.cpuUsage = { - system: (convertSeconds(process.cpuUsage().system /1000000)), - user: (convertSeconds(process.cpuUsage().user /1000000)) - } - info.memoryUsage = {}; - for (const [key,value] of Object.entries(process.memoryUsage())){ - info.memoryUsage[key] = ([value]/1048576).toFixed(2) + 'Mb'; - } - } catch (ex) { } - } - else { - try { info.uptime = process.uptime(); } catch (ex) { } - try { info.cpuUsage = process.cpuUsage(); } catch (ex) { } - try { info.memoryUsage = process.memoryUsage(); } catch (ex) { } - } + try { info.uptime = process.uptime(); } catch (ex) { } + try { info.cpuUsage = process.cpuUsage(); } catch (ex) { } + try { info.memoryUsage = process.memoryUsage(); } catch (ex) { } try { info.warnings = parent.parent.getServerWarnings(); } catch (ex) { console.log(ex); } try { info.allDevGroupManagers = parent.parent.config.settings.managealldevicegroups; } catch (ex) { } try { if (process.traceDeprecation == true) { info.traceDeprecation = true; } } catch (ex) { } @@ -7710,13 +6917,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use cmdData.result += 'Record: ' + parent.parent.recordpath + '\r\n'; cmdData.result += 'WebPublic: ' + parent.parent.webPublicPath + '\r\n'; cmdData.result += 'WebViews: ' + parent.parent.webViewsPath + '\r\n'; - cmdData.result += 'WebEmails: ' + parent.parent.webEmailsPath + '\r\n'; - if (parent.parent.webPublicOverridePath) { cmdData.result += 'XWebPublic: ' + parent.parent.webPublicOverridePath + '\r\n'; } - if (parent.parent.webViewsOverridePath) { cmdData.result += 'XWebViews: ' + parent.parent.webViewsOverridePath + '\r\n'; } - if (parent.parent.webEmailsOverridePath) { cmdData.result += 'XWebEmails: ' + parent.parent.webEmailsOverridePath + '\r\n'; } - if (domain.webpublicpath) { cmdData.result += 'DomainWebPublic: ' + domain.webpublicpath + '\r\n'; } - if (domain.webviewspath) { cmdData.result += 'DomainWebViews: ' + domain.webviewspath + '\r\n'; } - if (domain.webemailspath) { cmdData.result += 'DomainWebEmails: ' + domain.webemailspath + '\r\n'; } + if (parent.parent.webViewsOverridePath) { cmdData.result += 'XWebPublic: ' + parent.parent.webViewsOverridePath + '\r\n'; } + if (parent.parent.webViewsOverridePath) { cmdData.result += 'XWebViews: ' + parent.parent.webPublicOverridePath + '\r\n'; } } function serverUserCommandMigrationAgents(cmdData) { @@ -7771,9 +6973,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } function serverUserCommandAutoBackup(cmdData) { - cmdData.result = parent.db.performBackup(function (msg) { + var backupResult = parent.db.performBackup(function (msg) { try { ws.send(JSON.stringify({ action: 'serverconsole', value: msg, tag: cmdData.command.tag })); } catch (ex) { } }); + if (backupResult == 0) { cmdData.result = 'Starting auto-backup...'; } else { cmdData.result = 'Backup alreay in progress.'; } } function serverUserCommandBackupConfig(cmdData) { @@ -7878,7 +7081,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Session length if (((docs[i].msgid >= 10) && (docs[i].msgid <= 12)) && (docs[i].msgArgs != null) && (typeof docs[i].msgArgs == 'object') && (typeof docs[i].msgArgs[3] == 'number')) { entry.length = docs[i].msgArgs[3]; } else if ((docs[i].msgid >= 122) && (docs[i].msgid <= 126) && (docs[i].msgArgs != null) && (typeof docs[i].msgArgs == 'object') && (typeof docs[i].msgArgs[0] == 'number')) { entry.length = docs[i].msgArgs[0]; } - else if ((docs[i].msgid == 144) && (docs[i].msgArgs != null) && (typeof docs[i].msgArgs == 'object') && (typeof docs[i].msgArgs[1] == 'number')) { entry.length = docs[i].msgArgs[1]; } if (command.groupBy == 1) { // Add entry to per user if (data.groups[docs[i].userid] == null) { data.groups[docs[i].userid] = { entries: [] }; } @@ -7945,7 +7147,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Session length if (((docs[i].msgid >= 10) && (docs[i].msgid <= 12)) && (docs[i].msgArgs != null) && (typeof docs[i].msgArgs == 'object') && (typeof docs[i].msgArgs[3] == 'number')) { userEntry.length += docs[i].msgArgs[3]; } else if ((docs[i].msgid >= 122) && (docs[i].msgid <= 126) && (docs[i].msgArgs != null) && (typeof docs[i].msgArgs == 'object') && (typeof docs[i].msgArgs[0] == 'number')) { userEntry.length += docs[i].msgArgs[0]; } - else if ((docs[i].msgid == 144) && (docs[i].msgArgs != null) && (typeof docs[i].msgArgs == 'object') && (typeof docs[i].msgArgs[1] == 'number')) { userEntry.length += docs[i].msgArgs[1]; } // Set the user entry userEntries[docs[i].userid] = userEntry; @@ -8014,15 +7215,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use }); } - function databaseRecordsReport(command) { - if (user.siteadmin != 0xFFFFFFFF) return; // This report is only available to full administrators - parent.parent.db.getDbStats(function (stats) { - var data = { groups: { 0: { entries: [] } } }; - data.columns = [{ id: 'record', title: "Record", format: 'records' }, { id: 'recordcount', title: "Count", align: 'center', sumBy: true }]; - for (var i in stats) { if ((i != 'total') && (stats[i] > 0)) { data.groups[0].entries.push({ record: i, recordcount: stats[i] }); } } - try { ws.send(JSON.stringify({ action: 'report', data: data })); } catch (ex) { } - }); - } // Return detailed information about an array of nodeid's function getDeviceDetailedInfo(nodeids, type, func) { @@ -8082,66 +7274,22 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Return detailed information about all nodes this user has access to function getAllDeviceDetailedInfo(type, func) { - // If we are not paging, get all devices visible to this user - if (obj.visibleDevices == null) { + // Get all device groups this user has access to + var links = parent.GetAllMeshIdWithRights(user); - // Get all device groups this user has access to - var links = parent.GetAllMeshIdWithRights(user); + // Add any nodes with direct rights or any nodes with user group direct rights + var extraids = getUserExtraIds(); - // Add any nodes with direct rights or any nodes with user group direct rights - var extraids = getUserExtraIds(); + // Request a list of all nodes + db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, function (err, docs) { + if (docs == null) { docs = []; } + parent.common.unEscapeAllLinksFieldName(docs); - // Request a list of all nodes - db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, obj.deviceSkip, obj.deviceLimit, function (err, docs) { - if (docs == null) { docs = []; } - parent.common.unEscapeAllLinksFieldName(docs); + var results = [], resultPendingCount = 0; + for (i in docs) { + // Check device links, if a link points to an unknown user, remove it. + parent.cleanDevice(docs[i]); - var results = [], resultPendingCount = 0; - if (docs.length == 0) { // no results return blank array - func(docs, type); - } else { - for (i in docs) { - // Check device links, if a link points to an unknown user, remove it. - parent.cleanDevice(docs[i]); - - // Fetch the node from the database - resultPendingCount++; - const getNodeFunc = function (node, rights, visible) { - if ((node != null) && (visible == true)) { - const getNodeSysInfoFunc = function (err, docs) { - const getNodeNetInfoFunc = function (err, docs) { - var netinfo = null; - if ((err == null) && (docs != null) && (docs.length == 1)) { netinfo = docs[0]; } - resultPendingCount--; - getNodeNetInfoFunc.results.push({ node: parent.CloneSafeNode(getNodeNetInfoFunc.node), sys: getNodeNetInfoFunc.sysinfo, net: netinfo }); - if (resultPendingCount == 0) { func(getNodeFunc.results, type); } - } - getNodeNetInfoFunc.results = getNodeSysInfoFunc.results; - getNodeNetInfoFunc.nodeid = getNodeSysInfoFunc.nodeid; - getNodeNetInfoFunc.node = getNodeSysInfoFunc.node; - if ((err == null) && (docs != null) && (docs.length == 1)) { getNodeNetInfoFunc.sysinfo = docs[0]; } - - // Query the database for network information - db.Get('if' + getNodeSysInfoFunc.nodeid, getNodeNetInfoFunc); - } - getNodeSysInfoFunc.results = getNodeFunc.results; - getNodeSysInfoFunc.nodeid = getNodeFunc.nodeid; - getNodeSysInfoFunc.node = node; - - // Query the database for system information - db.Get('si' + getNodeFunc.nodeid, getNodeSysInfoFunc); - } else { resultPendingCount--; } - if (resultPendingCount == 0) { func(getNodeFunc.results.join('\r\n'), type); } - } - getNodeFunc.results = results; - getNodeFunc.nodeid = docs[i]._id; - parent.GetNodeWithRights(domain, user, docs[i]._id, getNodeFunc); - } - } - }); - } else { - // If we are paging, we know what devices the user is look at - for (var id in obj.visibleDevices) { // Fetch the node from the database resultPendingCount++; const getNodeFunc = function (node, rights, visible) { @@ -8172,10 +7320,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (resultPendingCount == 0) { func(getNodeFunc.results.join('\r\n'), type); } } getNodeFunc.results = results; - getNodeFunc.nodeid = id; - parent.GetNodeWithRights(domain, user, id, getNodeFunc); + getNodeFunc.nodeid = docs[i]._id; + parent.GetNodeWithRights(domain, user, docs[i]._id, getNodeFunc); } - } + }); } // Display a notification message for this session only. @@ -8333,29 +7481,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use function count2factoraAuths() { var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null)); var sms2fa = ((parent.parent.smsserver != null) && ((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false))); - var msg2fa = ((parent.parent.msgserver != null) && (parent.parent.msgserver.providers != 0) && ((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false))); - var duo2fa = ((typeof domain.passwordrequirements != 'object') || (typeof domain.passwordrequirements.duo2factor == 'object')); var authFactorCount = 0; if (typeof user.otpsecret == 'string') { authFactorCount++; } // Authenticator time factor if (email2fa && (user.otpekey != null)) { authFactorCount++; } // EMail factor if (sms2fa && (user.phone != null)) { authFactorCount++; } // SMS factor - if (msg2fa && (user.msghandle != null)) { authFactorCount++; } // Messaging factor - if (duo2fa && (user.otpduo != null)) { authFactorCount++; } // Duo authentication factor if (user.otphkeys != null) { authFactorCount += user.otphkeys.length; } // FIDO hardware factor if ((authFactorCount > 0) && (user.otpkeys != null)) { authFactorCount++; } // Backup keys return authFactorCount; } - // Return true if the event is for a device that is part of the currently visible page - function isEventWithinPage(ids) { - if (obj.visibleDevices == null) return true; // Add devices are visible - var r = true; - for (var i in ids) { - // If the event is for a visible device, return true - if (ids[i].startsWith('node/')) { r = false; if (obj.visibleDevices[ids[i]] != null) return true; } - } - return r; // If this event is not for any specific device, return true - } - return obj; }; diff --git a/monitoring.js b/monitoring.js deleted file mode 100644 index ffb03da7..00000000 --- a/monitoring.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @description MeshCentral monitoring module -* @author Simon Smith -* @license Apache-2.0 -* @version v0.0.1 -*/ - -"use strict"; - -module.exports.CreateMonitoring = function (parent, args) { - var obj = {}; - obj.args = args; - obj.parent = parent; - obj.express = require('express'); - obj.app = obj.express(); - obj.prometheus = null; - if (args.compression !== false) { obj.app.use(require('compression')()); } - obj.app.disable('x-powered-by'); - obj.counterMetrics = { // Counter Metrics always start at 0 and increase but never decrease - RelayErrors: { description: "Relay Errors" }, // parent.webserver.relaySessionErrorCount - UnknownGroup: { description: "Unknown Group" }, // meshDoesNotExistCount - InvalidPKCSsignature: { description: "Invalid PKCS signature" }, // invalidPkcsSignatureCount - InvalidRSAsignature: { description: "Invalid RSA signature" }, // invalidRsaSignatureCount - InvalidJSON: { description: "Invalid JSON" }, // invalidJsonCount - UnknownAction: { description: "Unknown Action" }, // unknownAgentActionCount - BadWebCertificate: { description: "Bad Web Certificate" }, // agentBadWebCertHashCount - BadSignature: { description: "Bad Signature" }, // (agentBadSignature1Count + agentBadSignature2Count) - MaxSessionsReached: { description: "Max Sessions Reached" }, // agentMaxSessionHoldCount - UnknownDeviceGroup: { description: "Unknown Device Group" }, // (invalidDomainMeshCount + invalidDomainMesh2Count) - InvalidDeviceGroupType: { description: "Invalid Device Group Type" }, // invalidMeshTypeCount - DuplicateAgent: { description: "Duplicate Agent" }, // duplicateAgentCount - blockedUsers: { description: "Blocked Users" }, // blockedUsers - blockedAgents: { description: "Blocked Agents" }, // blockedAgents - }; - obj.gaugeMetrics = { // Gauge Metrics always start at 0 and can increase and decrease - ConnectedIntelAMT: { description: "Connected Intel AMT" }, // parent.mpsserver.ciraConnections[i].length - UserAccounts: { description: "User Accounts" }, // Object.keys(parent.webserver.users).length - DeviceGroups: { description: "Device Groups" }, // parent.webserver.meshes (ONLY WHERE deleted=null) - AgentSessions: { description: "Agent Sessions" }, // Object.keys(parent.webserver.wsagents).length - ConnectedUsers: { description: "Connected Users" }, // Object.keys(parent.webserver.wssessions).length - UsersSessions: { description: "Users Sessions" }, // Object.keys(parent.webserver.wssessions2).length - RelaySessions: { description: "Relay Sessions" }, // parent.webserver.relaySessionCount - RelayCount: { description: "Relay Count" } // Object.keys(parent.webserver.wsrelays).length30bb4fb74dfb758d36be52a7 - } - obj.collectors = []; - if (parent.config.settings.prometheus != null) { // Create Prometheus Monitoring Endpoint - if ((typeof parent.config.settings.prometheus == 'number') && ((parent.config.settings.prometheus < 1) || (parent.config.settings.prometheus > 65535))) { - console.log('Promethus port number is invalid, Prometheus metrics endpoint has be disabled'); - delete parent.config.settings.prometheus; - } else { - const port = ((typeof parent.config.settings.prometheus == 'number') ? parent.config.settings.prometheus : 9464); - obj.prometheus = require('prom-client'); - const collectDefaultMetrics = obj.prometheus.collectDefaultMetrics; - collectDefaultMetrics(); - for (const key in obj.gaugeMetrics) { - obj.gaugeMetrics[key].prometheus = new obj.prometheus.Gauge({ name: 'meshcentral_' + String(key).toLowerCase(), help: obj.gaugeMetrics[key].description }); - } - for (const key in obj.counterMetrics) { - obj.counterMetrics[key].prometheus = new obj.prometheus.Counter({ name: 'meshcentral_' + String(key).toLowerCase(), help: obj.counterMetrics[key].description }); - } - obj.app.get('/', function (req, res) { res.send('MeshCentral Prometheus server.'); }); - obj.app.listen(port, function () { - console.log('MeshCentral Prometheus server running on port ' + port + '.'); - obj.parent.updateServerState('prometheus-port', port); - }); - obj.app.get('/metrics', async (req, res) => { - try { - // Count the number of device groups that are not deleted - var activeDeviceGroups = 0; - for (var i in parent.webserver.meshes) { if (parent.webserver.meshes[i].deleted == null) { activeDeviceGroups++; } } // This is not ideal for performance, we want to dome something better. - var gauges = { - UserAccounts: Object.keys(parent.webserver.users).length, - DeviceGroups: activeDeviceGroups, - AgentSessions: Object.keys(parent.webserver.wsagents).length, - ConnectedUsers: Object.keys(parent.webserver.wssessions).length, - UsersSessions: Object.keys(parent.webserver.wssessions2).length, - RelaySessions: parent.webserver.relaySessionCount, - RelayCount: Object.keys(parent.webserver.wsrelays).length, - ConnectedIntelAMT: 0 - }; - if (parent.mpsserver != null) { - for (var i in parent.mpsserver.ciraConnections) { - gauges.ConnectedIntelAMT += parent.mpsserver.ciraConnections[i].length; - } - } - for (const key in gauges) { obj.gaugeMetrics[key].prometheus.set(gauges[key]); } - // Take a look at agent errors - var agentstats = parent.webserver.getAgentStats(); - const counters = { - RelayErrors: parent.webserver.relaySessionErrorCount, - UnknownGroup: agentstats.meshDoesNotExistCount, - InvalidPKCSsignature: agentstats.invalidPkcsSignatureCount, - InvalidRSAsignature: agentstats.invalidRsaSignatureCount, - InvalidJSON: agentstats.invalidJsonCount, - UnknownAction: agentstats.unknownAgentActionCount, - BadWebCertificate: agentstats.agentBadWebCertHashCount, - BadSignature: (agentstats.agentBadSignature1Count + agentstats.agentBadSignature2Count), - MaxSessionsReached: agentstats.agentMaxSessionHoldCount, - UnknownDeviceGroup: (agentstats.invalidDomainMeshCount + agentstats.invalidDomainMesh2Count), - InvalidDeviceGroupType: (agentstats.invalidMeshTypeCount + agentstats.invalidMeshType2Count), - DuplicateAgent: agentstats.duplicateAgentCount, - blockedUsers: parent.webserver.blockedUsers, - blockedAgents: parent.webserver.blockedAgents - }; - for (const key in counters) { obj.counterMetrics[key].prometheus.reset(); obj.counterMetrics[key].prometheus.inc(counters[key]); } - res.set('Content-Type', obj.prometheus.register.contentType); - await Promise.all(obj.collectors.map((collector) => (collector(req, res)))); - res.end(await obj.prometheus.register.metrics()); - } catch (ex) { - console.log(ex); - res.status(500).end(); - } - }); - } - } - return obj; -} \ No newline at end of file diff --git a/mpsserver.js b/mpsserver.js index ec5a8312..cacc4241 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -30,7 +30,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { const net = require('net'); const tls = require('tls'); const MAX_IDLE = 90000; // 90 seconds max idle time, higher than the typical KEEP-ALIVE periode of 60 seconds - const KEEPALIVE_INTERVAL = 30; // 30 seconds is typical keepalive interval for AMT CIRA connection + const KEEPALIVE_INTERVAL = 30; // 30 seconds is typical keepalive interval for AMT CIRA connection // This MPS server is also a tiny HTTPS server. HTTP responses are here. obj.httpResponses = { @@ -48,7 +48,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { obj.server = tls.createServer({ key: certificates.mps.key, cert: certificates.mps.cert, requestCert: true, rejectUnauthorized: false, ciphers: "HIGH:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_AES_128_CCM_SHA256:TLS_CHACHA20_POLY1305_SHA256", secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE | constants.SSL_OP_NO_TLSv1 | constants.SSL_OP_NO_TLSv1_1 }, onConnection) } else { // Lower security MPS in order to support older Intel AMT CIRA connections, we have to turn on TLSv1. - obj.server = tls.createServer({ key: certificates.mps.key, cert: certificates.mps.cert, minVersion: 'TLSv1', requestCert: true, rejectUnauthorized: false, ciphers: "HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA:@SECLEVEL=0", secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION }, onConnection) + obj.server = tls.createServer({ key: certificates.mps.key, cert: certificates.mps.cert, minVersion: 'TLSv1', requestCert: true, rejectUnauthorized: false, ciphers: "HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA", secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION }, onConnection) } //obj.server.on('error', function () { console.log('MPS tls server error'); }); obj.server.on('newSession', function (id, data, cb) { if (tlsSessionStoreCount > 1000) { tlsSessionStoreCount = 0; tlsSessionStore = {}; } tlsSessionStore[id.toString('hex')] = data; tlsSessionStoreCount++; cb(); }); @@ -58,7 +58,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { obj.server.listen(args.mpsport, args.mpsportbind, function () { console.log("MeshCentral Intel(R) AMT server running on " + certificates.AmtMpsName + ":" + args.mpsport + ((args.mpsaliasport != null) ? (", alias port " + args.mpsaliasport) : "") + "."); obj.parent.authLog('mps', 'Server listening on ' + ((args.mpsportbind != null) ? args.mpsportbind : '0.0.0.0') + ' port ' + args.mpsport + '.'); - }).on("error", function (err) { console.error("ERROR: MeshCentral Intel(R) AMT server port " + args.mpsport + " is not available. Check if the MeshCentral is already running."); if (args.exactports) { process.exit(); } }); + }).on("error", function (err) { console.error("ERROR: MeshCentral Intel(R) AMT server port " + args.mpsport + " is not available."); if (args.exactports) { process.exit(); } }); obj.server.on('tlsClientError', function (err, tlssocket) { if (args.mpsdebug) { var remoteAddress = tlssocket.remoteAddress; if (tlssocket.remoteFamily == 'IPv6') { remoteAddress = '[' + remoteAddress + ']'; } console.log('MPS:Invalid TLS connection from ' + remoteAddress + ':' + tlssocket.remotePort + '.'); } }); } @@ -733,7 +733,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { return; } else { // Attempts reverse DNS loopup on the device IP address - const reverseDnsLookupHandler = function (err, hostnames) { + require('dns').reverse(socket.remoteAddr, function (err, hostnames) { var hostname = socket.remoteAddr; if ((err == null) && (hostnames != null) && (hostnames.length > 0)) { hostname = hostnames[0]; } @@ -752,8 +752,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { addedDeviceCount++; var change = 'Added CIRA device ' + socket.tag.name + ' to group ' + initialMesh.name; obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: parent.webserver.CloneSafeNode(device), msg: change, domain: initialMesh.domain }); - } - try { require('dns').reverse(socket.remoteAddr, reverseDnsLookupHandler); } catch (ex) { reverseDnsLookupHandler(ex, null); } + }); } } else { // Node is already present diff --git a/multiserver.js b/multiserver.js index 7d87d09d..2a1aa9c6 100644 --- a/multiserver.js +++ b/multiserver.js @@ -86,7 +86,7 @@ module.exports.CreateMultiServer = function (parent, args) { // Start authenticate the peer server by sending a auth nonce & server TLS cert hash. // Send 384 bits SHA384 hash of TLS cert public key + 384 bits nonce - obj.ws.send(Buffer.from(obj.common.ShortToStr(1) + obj.serverCertHash + obj.nonce, 'binary')); // Command 1, hash + nonce + obj.ws.send(obj.common.ShortToStr(1) + obj.serverCertHash + obj.nonce); // Command 1, hash + nonce }); // If a message is received @@ -101,7 +101,7 @@ module.exports.CreateMultiServer = function (parent, args) { switch (cmd) { case 1: { // Server authentication request - if (msg.length != 98) { obj.parent.parent.debug('peer', 'OutPeer: Bad server authentication message, length = ' + msg.length + ', should be 98. HEX: ' + Buffer.from(msg.substring(0, 4096), 'binary').toString('hex')); return; } + if (msg.length != 98) { obj.parent.parent.debug('peer', 'OutPeer: BAD MESSAGE(A1)'); return; } // Check that the server hash matches the TLS server certificate public key hash if (obj.url.toLowerCase().startsWith('wss://') && (obj.serverCertHash != msg.substring(2, 50))) { obj.parent.parent.debug('peer', 'OutPeer: Server hash mismatch.'); disconnect(); return; } @@ -110,7 +110,7 @@ module.exports.CreateMultiServer = function (parent, args) { // Perform the hash signature using the server agent certificate obj.parent.parent.certificateOperations.acceleratorPerformSignature(0, msg.substring(2) + obj.nonce, null, function (tag, signature) { // Send back our certificate + signature - if (obj.ws != null) { obj.ws.send(Buffer.from(obj.common.ShortToStr(2) + obj.common.ShortToStr(obj.agentCertificateAsn1.length) + obj.agentCertificateAsn1 + signature, 'binary')); } // Command 2, certificate + signature + if (obj.ws != null) { obj.ws.send(obj.common.ShortToStr(2) + obj.common.ShortToStr(obj.agentCertificateAsn1.length) + obj.agentCertificateAsn1 + signature); } // Command 2, certificate + signature }); break; @@ -139,7 +139,7 @@ module.exports.CreateMultiServer = function (parent, args) { // Send information about our server to the peer if (obj.connectionState == 15) { - obj.send({ action: 'info', serverid: obj.parent.serverid, dbid: obj.parent.parent.db.identifier, key: obj.parent.parent.serverKey.toString('hex'), serverCertHash: obj.parent.parent.webserver.webCertificateHashBase64 }); + obj.ws.send(JSON.stringify({ action: 'info', serverid: obj.parent.serverid, dbid: obj.parent.parent.db.identifier, key: obj.parent.parent.serverKey.toString('hex'), serverCertHash: obj.parent.parent.webserver.webCertificateHashBase64 })); for (var i in obj.pendingData) { processServerData(obj.pendingData[i]); } // Process any pending data obj.pendingData = []; } @@ -150,7 +150,7 @@ module.exports.CreateMultiServer = function (parent, args) { // Peer server confirmed authentication, we are allowed to send commands to the server obj.connectionState |= 8; if (obj.connectionState == 15) { - obj.send({ action: 'info', serverid: obj.parent.serverid, dbid: obj.parent.parent.db.identifier, key: obj.parent.parent.serverKey.toString('hex'), serverCertHash: obj.parent.parent.webserver.webCertificateHashBase64 }); + obj.ws.send(JSON.stringify({ action: 'info', serverid: obj.parent.serverid, dbid: obj.parent.parent.db.identifier, key: obj.parent.parent.serverKey.toString('hex'), serverCertHash: obj.parent.parent.webserver.webCertificateHashBase64 })); for (var i in obj.pendingData) { processServerData(obj.pendingData[i]); } // Process any pending data obj.pendingData = []; } @@ -187,9 +187,9 @@ module.exports.CreateMultiServer = function (parent, args) { obj.send = function (msg) { try { if (obj.ws == null || obj.connectionState != 15) { return; } - if (typeof msg == 'string') { obj.ws.send(msg); return; } if (typeof msg == 'object') { obj.ws.send(JSON.stringify(msg)); return; } - } catch (ex) { } + if (typeof msg == 'string') { obj.ws.send(msg); return; } + } catch (e) { } }; // Process incoming peer server JSON data @@ -244,11 +244,12 @@ module.exports.CreateMultiServer = function (parent, args) { obj.parent.parent.debug('peer', 'InPeer: Connected (' + obj.remoteaddr + ')'); // Send a message to the peer server - obj.send = function (msg) { + obj.send = function (data) { try { - if (typeof msg == 'string') { obj.ws.send(msg); return; } - if (typeof msg == 'object') { obj.ws.send(JSON.stringify(msg)); return; } - } catch (ex) { } + if (typeof data == 'string') { obj.ws.send(Buffer.from(data, 'binary')); return; } + if (typeof data == 'object') { obj.ws.send(JSON.stringify(data)); return; } + obj.ws.send(data); + } catch (e) { } }; // Disconnect this server @@ -280,7 +281,7 @@ module.exports.CreateMultiServer = function (parent, args) { // Perform the hash signature using the server agent certificate obj.parent.parent.certificateOperations.acceleratorPerformSignature(0, msg.substring(2) + obj.nonce, null, function (tag, signature) { // Send back our certificate + signature - obj.ws.send(Buffer.from(obj.common.ShortToStr(2) + obj.common.ShortToStr(obj.agentCertificateAsn1.length) + obj.agentCertificateAsn1 + signature, 'binary')); // Command 2, certificate + signature + obj.send(obj.common.ShortToStr(2) + obj.common.ShortToStr(obj.agentCertificateAsn1.length) + obj.agentCertificateAsn1 + signature); // Command 2, certificate + signature }); // Check the peer server signature if we can @@ -325,13 +326,13 @@ module.exports.CreateMultiServer = function (parent, args) { // Start authenticate the peer server by sending a auth nonce & server TLS cert hash. // Send 384 bits SHA382 hash of TLS cert public key + 384 bits nonce obj.nonce = obj.crypto.randomBytes(48).toString('binary'); - obj.ws.send(Buffer.from(obj.common.ShortToStr(1) + obj.webCertificateHash + obj.nonce, 'binary')); // Command 1, hash + nonce + obj.send(obj.common.ShortToStr(1) + obj.webCertificateHash + obj.nonce); // Command 1, hash + nonce // Once we get all the information about an peer server, run this to hook everything up to the server function completePeerServerConnection() { if (obj.authenticated != 1) return; - obj.ws.send(Buffer.from(obj.common.ShortToStr(4), 'binary')); - obj.send({ action: 'info', serverid: obj.parent.serverid, dbid: obj.parent.parent.db.identifier, key: obj.parent.parent.serverKey.toString('hex'), serverCertHash: obj.parent.parent.webserver.webCertificateHashBase64 }); + obj.send(obj.common.ShortToStr(4)); + obj.send(JSON.stringify({ action: 'info', serverid: obj.parent.serverid, dbid: obj.parent.parent.db.identifier, key: obj.parent.parent.serverKey.toString('hex'), serverCertHash: obj.parent.parent.webserver.webCertificateHashBase64 })); obj.authenticated = 2; // Process any pending data that was received before peer authentication @@ -404,7 +405,8 @@ module.exports.CreateMultiServer = function (parent, args) { // Dispatch an event to all other MeshCentral2 peer servers obj.DispatchEvent = function (ids, source, event) { - for (var serverid in obj.peerServers) { obj.peerServers[serverid].send({ action: 'bus', ids: ids, event: event }); } + var busmsg = JSON.stringify({ action: 'bus', ids: ids, event: event }); + for (var serverid in obj.peerServers) { obj.peerServers[serverid].send(busmsg); } }; // Dispatch a message to other MeshCentral2 peer servers @@ -435,10 +437,10 @@ module.exports.CreateMultiServer = function (parent, args) { obj.peerServers[peerServerId] = server; // Send the list of connections to the peer - server.send({ action: 'connectivityTable', connectivityTable: obj.parent.peerConnectivityByNode[obj.parent.serverId] }); + server.send(JSON.stringify({ action: 'connectivityTable', connectivityTable: obj.parent.peerConnectivityByNode[obj.parent.serverId] })); // Send a list of user sessions to the peer - server.send({ action: 'sessionsTable', sessionsTable: Object.keys(obj.parent.webserver.wssessions2) }); + server.send(JSON.stringify({ action: 'sessionsTable', sessionsTable: Object.keys(obj.parent.webserver.wssessions2) })); }; // We disconnected to a peer server, clean up everything @@ -586,20 +588,6 @@ module.exports.CreateMultiServer = function (parent, args) { } break; } - case 'agentCommand': { - if (msg.nodeid != null) { - // Route this message to a connected agent - var agent = obj.parent.webserver.wsagents[msg.nodeid]; - if (agent != null) { agent.send(JSON.stringify(msg.command)); } - } else if (msg.meshid != null) { - // Route this message to all connected agents of this mesh - for (var nodeid in obj.parent.webserver.wsagents) { - var agent = obj.parent.webserver.wsagents[nodeid]; - if (agent.dbMeshKey == msg.meshid) { try { agent.send(JSON.stringify(msg.command)); } catch (ex) { } } - } - } - break; - } default: { // Unknown peer server command console.log('Unknown action from peer server ' + peerServerId + ': ' + msg.action + '.'); @@ -648,7 +636,7 @@ module.exports.CreateMultiServer = function (parent, args) { peerTunnel.ws2.on('close', function (req) { peerTunnel.parent.parent.debug('peer', 'FTunnel disconnect ' + peerTunnel.serverid); peerTunnel.close(); }); // If a message is received from the peer, Peer ---> Browser (TODO: Pipe this?) - peerTunnel.ws2.on('message', function (msg, isBinary) { try { peerTunnel.ws2._socket.pause(); peerTunnel.ws1.send((isBinary ? msg : msg.toString('binary')), function () { peerTunnel.ws2._socket.resume(); }); } catch (e) { } }); + peerTunnel.ws2.on('message', function (msg) { try { peerTunnel.ws2._socket.pause(); peerTunnel.ws1.send(msg, function () { peerTunnel.ws2._socket.resume(); }); } catch (e) { } }); // Register the connection event peerTunnel.ws2.on('open', function () { diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index caf31a34..00000000 --- a/package-lock.json +++ /dev/null @@ -1,2448 +0,0 @@ -{ - "name": "meshcentral", - "version": "1.1.35", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "meshcentral", - "version": "1.1.35", - "license": "Apache-2.0", - "dependencies": { - "@seald-io/nedb": "4.0.4", - "archiver": "7.0.1", - "body-parser": "1.20.3", - "cbor": "5.2.0", - "compression": "1.7.5", - "cookie-session": "2.1.0", - "express": "4.21.2", - "express-handlebars": "7.1.3", - "express-ws": "5.0.2", - "ipcheck": "0.1.0", - "minimist": "1.2.8", - "multiparty": "4.2.3", - "node-forge": "1.3.1", - "ua-parser-js": "1.0.39", - "ws": "8.18.0", - "yauzl": "2.10.0" - }, - "bin": { - "meshcentral": "bin/meshcentral" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@seald-io/binary-search-tree": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@seald-io/binary-search-tree/-/binary-search-tree-1.0.3.tgz", - "integrity": "sha512-qv3jnwoakeax2razYaMsGI/luWdliBLHTdC6jU55hQt1hcFqzauH/HsBollQ7IR4ySTtYhT+xyHoijpA16C+tA==" - }, - "node_modules/@seald-io/nedb": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@seald-io/nedb/-/nedb-4.0.4.tgz", - "integrity": "sha512-CUNcMio7QUHTA+sIJ/DC5JzVNNsHe743TPmC4H5Gij9zDLMbmrCT2li3eVB72/gF63BPS8pWEZrjlAMRKA8FDw==", - "license": "MIT", - "dependencies": { - "@seald-io/binary-search-tree": "^1.0.3", - "localforage": "^1.9.0", - "util": "^0.12.4" - } - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "license": "MIT", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/accepts/node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/archiver": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz", - "integrity": "sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==", - "license": "MIT", - "dependencies": { - "archiver-utils": "^5.0.2", - "async": "^3.2.4", - "buffer-crc32": "^1.0.0", - "readable-stream": "^4.0.0", - "readdir-glob": "^1.1.2", - "tar-stream": "^3.0.0", - "zip-stream": "^6.0.1" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/archiver-utils": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-5.0.2.tgz", - "integrity": "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==", - "license": "MIT", - "dependencies": { - "glob": "^10.0.0", - "graceful-fs": "^4.2.0", - "is-stream": "^2.0.1", - "lazystream": "^1.0.0", - "lodash": "^4.17.15", - "normalize-path": "^3.0.0", - "readable-stream": "^4.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/archiver-utils/node_modules/lazystream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", - "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", - "license": "MIT", - "dependencies": { - "readable-stream": "^2.0.5" - }, - "engines": { - "node": ">= 0.6.3" - } - }, - "node_modules/archiver-utils/node_modules/lazystream/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/archiver-utils/node_modules/lazystream/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/archiver-utils/node_modules/readable-stream": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.6.0.tgz", - "integrity": "sha512-cbAdYt0VcnpN2Bekq7PU+k363ZRsPwJoEEJOEtSJQlJXzwaxt3FIo/uL+KeDSGIjJqtkwyge4KQgD2S2kd+CQw==", - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/archiver-utils/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "license": "MIT" - }, - "node_modules/archiver/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/archiver/node_modules/readable-stream": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.6.0.tgz", - "integrity": "sha512-cbAdYt0VcnpN2Bekq7PU+k363ZRsPwJoEEJOEtSJQlJXzwaxt3FIo/uL+KeDSGIjJqtkwyge4KQgD2S2kd+CQw==", - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/archiver/node_modules/readdir-glob": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", - "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", - "license": "Apache-2.0", - "dependencies": { - "minimatch": "^5.1.0" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", - "license": "MIT" - }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "license": "MIT" - }, - "node_modules/available-typed-arrays": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", - "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", - "license": "MIT", - "dependencies": { - "possible-typed-array-names": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/b4a": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", - "integrity": "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==", - "license": "Apache-2.0" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "license": "MIT" - }, - "node_modules/bare-events": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.5.0.tgz", - "integrity": "sha512-/E8dDe9dsbLyh2qrZ64PEPadOQ0F4gbl1sUJOrmph7xOiIxfY8vwab/4bFLh4Y88/Hk/ujKcrQKc+ps0mv873A==", - "license": "Apache-2.0", - "optional": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/bignumber.js": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", - "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/body-parser": { - "version": "1.20.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", - "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.13.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/buffer-crc32": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", - "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", - "license": "MIT", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", - "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.0", - "es-define-property": "^1.0.0", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", - "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", - "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "get-intrinsic": "^1.2.6" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/cbor": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz", - "integrity": "sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==", - "license": "MIT", - "dependencies": { - "bignumber.js": "^9.0.1", - "nofilter": "^1.0.4" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", - "license": "MIT", - "dependencies": { - "mime-db": ">= 1.43.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/compression": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.5.tgz", - "integrity": "sha512-bQJ0YRck5ak3LgtnpKkiabX5pNF7tMUh1BSy2ZBOTh0Dim0BUu6aPPwByIns6/A5Prh8PufSPerMDUklpzes2Q==", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "compressible": "~2.0.18", - "debug": "2.6.9", - "negotiator": "~0.6.4", - "on-headers": "~1.0.2", - "safe-buffer": "5.2.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "license": "MIT", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", - "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-session": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cookie-session/-/cookie-session-2.1.0.tgz", - "integrity": "sha512-u73BDmR8QLGcs+Lprs0cfbcAPKl2HnPcjpwRXT41sEV4DRJ2+W0vJEEZkG31ofkx+HZflA70siRIjiTdIodmOQ==", - "license": "MIT", - "dependencies": { - "cookies": "0.9.1", - "debug": "3.2.7", - "on-headers": "~1.0.2", - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/cookie-session/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/cookie-session/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", - "license": "MIT" - }, - "node_modules/cookies": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.9.1.tgz", - "integrity": "sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==", - "license": "MIT", - "dependencies": { - "depd": "~2.0.0", - "keygrip": "~1.1.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "license": "MIT" - }, - "node_modules/crc-32": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", - "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", - "license": "Apache-2.0", - "bin": { - "crc32": "bin/crc32.njs" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/crc32-stream": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-6.0.0.tgz", - "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==", - "license": "MIT", - "dependencies": { - "crc-32": "^1.2.0", - "readable-stream": "^4.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/crc32-stream/node_modules/readable-stream": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.6.0.tgz", - "integrity": "sha512-cbAdYt0VcnpN2Bekq7PU+k363ZRsPwJoEEJOEtSJQlJXzwaxt3FIo/uL+KeDSGIjJqtkwyge4KQgD2S2kd+CQw==", - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "license": "MIT", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "license": "MIT" - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", - "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "license": "MIT" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "license": "MIT", - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/express": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", - "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", - "license": "MIT", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.3", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.7.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.3.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.3", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.12", - "proxy-addr": "~2.0.7", - "qs": "6.13.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.19.0", - "serve-static": "1.16.2", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/express-handlebars": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-7.1.3.tgz", - "integrity": "sha512-O0W4n14iQ8+iFIDdiMh9HRI2nbVQJ/h1qndlD1TXWxxcfbKjKoqJh+ti2tROkyx4C4VQrt0y3bANBQ5auQAiew==", - "license": "BSD-3-Clause", - "dependencies": { - "glob": "^10.4.2", - "graceful-fs": "^4.2.11", - "handlebars": "^4.7.8" - }, - "engines": { - "node": ">=v16" - } - }, - "node_modules/express-ws": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/express-ws/-/express-ws-5.0.2.tgz", - "integrity": "sha512-0uvmuk61O9HXgLhGl3QhNSEtRsQevtmbL94/eILaliEADZBHZOQUAiHFrGPrgsjikohyrmSG5g+sCfASTt0lkQ==", - "license": "BSD-2-Clause", - "dependencies": { - "ws": "^7.4.6" - }, - "engines": { - "node": ">=4.5.0" - }, - "peerDependencies": { - "express": "^4.0.0 || ^5.0.0-alpha.1" - } - }, - "node_modules/express-ws/node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", - "license": "MIT", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/fast-fifo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", - "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "license": "MIT" - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, - "node_modules/finalhandler": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", - "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "license": "MIT", - "dependencies": { - "is-callable": "^1.1.3" - } - }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/foreground-child/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.6.tgz", - "integrity": "sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "dunder-proto": "^1.0.0", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "function-bind": "^1.1.2", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "license": "ISC" - }, - "node_modules/handlebars": { - "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.2", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "license": "MIT", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "license": "MIT" - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/ipcheck": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ipcheck/-/ipcheck-0.1.0.tgz", - "integrity": "sha512-NwhrmROU0iXKa+U1quGuQ+ag+K/1Bb5V/yh5Q4SylSu/LGymPZcWB7p4u7JgJH0qOR6cTLDO5VZlRbhoeekNzQ==", - "license": "MIT" - }, - "node_modules/is-arguments": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", - "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "license": "MIT", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", - "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", - "license": "MIT", - "dependencies": { - "which-typed-array": "^1.1.16" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/jackspeak/node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/jackspeak/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jackspeak/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jackspeak/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/jackspeak/node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/jackspeak/node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jackspeak/node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/keygrip": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", - "integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==", - "license": "MIT", - "dependencies": { - "tsscmp": "1.0.6" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", - "license": "MIT", - "dependencies": { - "immediate": "~3.0.5" - } - }, - "node_modules/localforage": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", - "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", - "license": "Apache-2.0", - "dependencies": { - "lie": "3.1.1" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "license": "MIT" - }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "license": "ISC" - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", - "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.53.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.53.0.tgz", - "integrity": "sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types/node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "license": "MIT" - }, - "node_modules/multiparty": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.3.tgz", - "integrity": "sha512-Ak6EUJZuhGS8hJ3c2fY6UW5MbkGUPMBEGd13djUzoY/BHqV/gTuFWtC6IuVA7A2+v3yjBS6c4or50xhzTQZImQ==", - "license": "MIT", - "dependencies": { - "http-errors": "~1.8.1", - "safe-buffer": "5.2.1", - "uid-safe": "2.1.5" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/multiparty/node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/multiparty/node_modules/http-errors": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", - "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", - "license": "MIT", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/multiparty/node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/negotiator": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", - "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "license": "MIT" - }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", - "license": "(BSD-3-Clause OR GPL-2.0)", - "engines": { - "node": ">= 6.13.0" - } - }, - "node_modules/nofilter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz", - "integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", - "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "license": "BlueOak-1.0.0" - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", - "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", - "license": "MIT" - }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "license": "MIT" - }, - "node_modules/possible-typed-array-names": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", - "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "license": "MIT" - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/qs": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", - "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.6" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/queue-tick": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", - "license": "MIT" - }, - "node_modules/random-bytes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", - "integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" - }, - "node_modules/send": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", - "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/serve-static": { - "version": "1.16.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", - "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", - "license": "MIT", - "dependencies": { - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.19.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "license": "MIT", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "license": "ISC" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/streamx": { - "version": "2.21.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.21.1.tgz", - "integrity": "sha512-PhP9wUnFLa+91CPy3N6tiQsK+gnYyUNuk15S3YG/zjYE7RuPeCjJngqnzpC31ow0lzBHQ+QGO4cNJnd0djYUsw==", - "license": "MIT", - "dependencies": { - "fast-fifo": "^1.3.2", - "queue-tick": "^1.0.1", - "text-decoder": "^1.1.0" - }, - "optionalDependencies": { - "bare-events": "^2.2.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/tar-stream": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", - "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", - "license": "MIT", - "dependencies": { - "b4a": "^1.6.4", - "fast-fifo": "^1.2.0", - "streamx": "^2.15.0" - } - }, - "node_modules/text-decoder": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", - "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", - "license": "Apache-2.0", - "dependencies": { - "b4a": "^1.6.4" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/tsscmp": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", - "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", - "license": "MIT", - "engines": { - "node": ">=0.6.x" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ua-parser-js": { - "version": "1.0.39", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.39.tgz", - "integrity": "sha512-k24RCVWlEcjkdOxYmVJgeD/0a1TiSpqLg+ZalVGV9lsnr4yqu0w7tX/x2xX6G4zpkgQnRf89lxuZ1wsbjXM8lw==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - }, - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - } - ], - "license": "MIT", - "bin": { - "ua-parser-js": "script/cli.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/uglify-js": { - "version": "3.19.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", - "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", - "license": "BSD-2-Clause", - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/uid-safe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", - "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", - "license": "MIT", - "dependencies": { - "random-bytes": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-typed-array": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.18.tgz", - "integrity": "sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==", - "license": "MIT", - "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "license": "MIT" - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "license": "MIT", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, - "node_modules/yauzl/node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/zip-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.1.tgz", - "integrity": "sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==", - "license": "MIT", - "dependencies": { - "archiver-utils": "^5.0.0", - "compress-commons": "^6.0.2", - "readable-stream": "^4.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/zip-stream/node_modules/compress-commons": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", - "integrity": "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==", - "license": "MIT", - "dependencies": { - "crc-32": "^1.2.0", - "crc32-stream": "^6.0.0", - "is-stream": "^2.0.1", - "normalize-path": "^3.0.0", - "readable-stream": "^4.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/zip-stream/node_modules/readable-stream": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.6.0.tgz", - "integrity": "sha512-cbAdYt0VcnpN2Bekq7PU+k363ZRsPwJoEEJOEtSJQlJXzwaxt3FIo/uL+KeDSGIjJqtkwyge4KQgD2S2kd+CQw==", - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - } - } -} diff --git a/package.json b/package.json index 78cd22bb..41a23901 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "1.1.42", + "version": "1.0.44", "keywords": [ "Remote Device Management", "Remote Device Monitoring", @@ -37,25 +37,24 @@ "sample-config-advanced.json" ], "dependencies": { - "@seald-io/nedb": "4.0.4", - "archiver": "7.0.1", - "body-parser": "1.20.3", - "cbor": "5.2.0", - "compression": "1.7.5", - "cookie-session": "2.1.0", - "express": "4.21.2", - "express-handlebars": "7.1.3", - "express-ws": "5.0.2", - "ipcheck": "0.1.0", - "minimist": "1.2.8", - "multiparty": "4.2.3", - "node-forge": "1.3.1", - "ua-parser-js": "1.0.39", - "ws": "8.18.0", - "yauzl": "2.10.0" + "archiver": "^5.3.1", + "body-parser": "^1.19.0", + "cbor": "~5.2.0", + "compression": "^1.7.4", + "cookie-session": "^1.4.0", + "express": "^4.17.0", + "express-handlebars": "^5.3.5", + "express-ws": "^4.0.0", + "ipcheck": "^0.1.0", + "minimist": "^1.2.5", + "multiparty": "^4.2.1", + "@yetzt/nedb": "^1.8.0", + "node-forge": "^1.0.0", + "ws": "^5.2.3", + "yauzl": "^2.10.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=10.0.0" }, "repository": { "type": "git", diff --git a/pluginHandler.js b/pluginHandler.js index 47c2a42d..83138a4c 100644 --- a/pluginHandler.js +++ b/pluginHandler.js @@ -139,7 +139,7 @@ module.exports.pluginHandler = function (parent) { try { obj.plugins[p][hookName](...args); } catch (e) { - console.log("Error occurred while running plugin hook " + p + ':' + hookName, e); + console.log("Error ocurred while running plugin hook" + p + ':' + hookName + ' (' + e + ')'); } } } @@ -205,7 +205,7 @@ module.exports.pluginHandler = function (parent) { panel[p].header = obj.plugins[p].on_device_header(); panel[p].content = obj.plugins[p].on_device_page(); } catch (e) { - console.log("Error occurred while getting plugin views " + p + ':' + ' (' + e + ')'); + console.log("Error ocurred while getting plugin views " + p + ':' + ' (' + e + ')'); } } } @@ -364,7 +364,7 @@ module.exports.pluginHandler = function (parent) { if (force_url != null) dl_url = force_url; var url = require('url'); var q = url.parse(dl_url, true); - var http = (q.protocol == "http:") ? require('http') : require('https'); + var http = (q.protocol == "http") ? require('http') : require('https'); var opts = { path: q.pathname, host: q.hostname, @@ -409,13 +409,7 @@ module.exports.pluginHandler = function (parent) { zipfile.openReadStream(entry, function (err, readStream) { if (err) throw err; readStream.on('end', function () { zipfile.readEntry(); }); - if (process.platform == 'win32') { - readStream.pipe(obj.fs.createWriteStream(filePath)); - } else { - var fileMode = (entry.externalFileAttributes >> 16) & 0x0fff; - if( fileMode <= 0 ) fileMode = 0o644; - readStream.pipe(obj.fs.createWriteStream(filePath, { mode: fileMode })); - } + readStream.pipe(obj.fs.createWriteStream(filePath)); }); } }); @@ -457,7 +451,7 @@ module.exports.pluginHandler = function (parent) { if (plugin.versionHistoryUrl == null) reject("No version history available for this plugin."); var url = require('url'); var q = url.parse(plugin.versionHistoryUrl, true); - var http = (q.protocol == 'http:') ? require('http') : require('https'); + var http = (q.protocol == 'http') ? require('http') : require('https'); var opts = { path: q.pathname, host: q.hostname, @@ -541,4 +535,4 @@ module.exports.pluginHandler = function (parent) { } } return obj; -}; +}; \ No newline at end of file diff --git a/plugin_development.md b/plugin_development.md new file mode 100644 index 00000000..f93066fe --- /dev/null +++ b/plugin_development.md @@ -0,0 +1,92 @@ +# Plugin Development + +## Overview + +## Anatomy of a plugin: + + - plugin_name/ + -- config.json + -- plugin_name.js + -- modules_meshcore/ // optional + --- plugin_name.js // optional + +## Plugin Configuration File +A valid JSON object within a file named `config.json` in the root folder of your project. An example: + + { + "name": "Plugin Name", + "shortName": "plugin_name", + "version": "0.0.0", + "author": "Author Name", + "description": "Short Description of the plugin", + "hasAdminPanel": false, + "homepage": "https://www.example.com", + "changelogUrl": "https://raw.githubusercontent.com/User/Project/master/changelog.md", + "configUrl": "https://raw.githubusercontent.com/User/Project/master/config.json", + "downloadUrl": "https://github.com/User/Project/archive/master.zip", + "repository": { + "type": "git", + "url": "https://github.com/User/Project.git" + }, + "versionHistoryUrl": "https://api.github.com/repos/User/Project/tags", + "meshCentralCompat": ">0.4.3" + } + +## Configuration File Properties +| Field | Required | Type | Description +|--|--|--|--| +| name | Yes | string | a human-readable name for the plugin +| shortName | Yes | string | an alphanumeric, unique short identifier for the plugin (will be used to access your functions throughout the project +| version | Yes | string | the current version of the plugin +| author | No | string | the author's name +| description | Yes | string | a short, human-readable description of what the plugin does +| hasAdminPanel | Yes | boolean | `true` or `false`, indicates whether or not the plugin will offer its own administrative interface +| homepage | Yes | string | the URL of the projects homepage +| changelogUrl | Yes | string | the URL to the changelog of the project +| configUrl | Yes | string | the URL to the config.json of the project +| downloadUrl | Yes | string | the URL to a ZIP of the project (used for installation/upgrades) +| repository | Yes | JSON object | contains the following attributes +| repository.type | Yes | string | valid values are `git` and in the future, `npm` will also be supported in the future +| repository.url | Yes | string | the URL to the project's repository +| versionHistoryUrl | No | string | the URL to the project's versions/tags +| meshCentralCompat | Yes | string | the minimum version string of required compatibility with the MeshCentral server, can be formatted as "0.1.2-c" or ">=0.1.2-c". Currently only supports minimum version, not full semantic checking. + +## Plugin Hooks +These are separated into the following categories depending on the type of functionality the plugin should offer. + +- Web UI, to modify the MeshCentral admin interface +- Back End, to modify core functionality of the server and communicate with the Web UI layer as well as the Mesh Agent (Node) layer to send commands and data +- Mesh Agent (Node), to introduce functionality to each agent + +### Web UI Hooks +`onDeviceRefreshEnd`: called when a device is selected in the MeshCentral web interface +`registerPluginTab`: callable when a device is selected in the MeshCentral web interface to register a new tab for plugin data, if required. Accepts an object, or function that returns an object, with the following properties: { tabId: "yourShortNameHere", tabTitle: "Your Display Name"}. A tab and div with the associated ID and title will be created for your use +`onDesktopDisconnect`: called when a remote desktop session is disconnected +`onWebUIStartupEnd`: called when the page has loaded for the first time after a login / refresh +`goPageStart`: called before page changes take effect. Passes 2 arguments ( : int, : Event) +`goPageEnd`: called after page changes take effect. Passes 2 arguments ( : int, : Event) + +#### Exports +Any function can be exported to the Web UI layer by adding the name of the function to an `exports` array in the plugin object. + +### Back End Hooks +`server_startup`: called once when the server starts (or when the plugin is first installed) +`hook_agentCoreIsStable`: called once when an agent initially checks in +`hook_processAgentData`: called each time an agent transmits data back to the server +`hook_userLoggedIn`: called when a user has logged into the web interface + +### Mesh Agent +Use of the optional file `plugin_name.js` in the optional folder `modules_meshcore` will include the file in the default meshcore file sent to each endpoint. This is useful to add functionality on each of the endpoints. + +## Structure +Much of MeshCentral revolves around returning objects for your structures, and plugins are no different. Within your plugin you can traverse all the way up to the web server and MeshCentral Server classes to access all the functionality those layers provide. This is done by passing the current object to newly created objects, and assigning that reference to a `parent` variable within that object. + + +## Versioning +Versioning your plugin correctly and consistently is essential to ensure users of your plugin are prompted to upgrade when it is available. Semantic versioning is recommended. + +## Changelog +A changelog is highly recommended so that your users know what's changed since their last version. + +## Sample Plugin +[MeshCentral-Sample](https://github.com/ryanblenis/MeshCentral-Sample) is a simple plugin that, upon disconnecting from remote desktop, prompts the user to enter a manual event (note), pre-filled in with the date and timestamp. diff --git a/public/commander-de.htm b/public/commander-de.htm index 91a57400..c618010f 100644 --- a/public/commander-de.htm +++ b/public/commander-de.htm @@ -12,106 +12,105 @@ function ObjectToStringEx2(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";i 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>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
"+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
'+c+""+g+""+A+"";q.PerformAjax(a+"
",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Ung\u00fcltige Daten";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", -r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
"+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
'+c+""+r+""+z+"";v.PerformAjax(a+"
",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Ung\u00fcltige Daten";if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", +r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& 64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[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])+"-... gewechselt zu"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Fall Eindringen";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"Eine Remote-Serial-Over-LAN-Sitzung wurde eingerichtet.";if(1==c[2])return"Remote Serial Over LAN-Sitzung beendet. Die Benutzersteuerung wurde wiederhergestellt.";if(2==c[2])return"Eine Remote-IDE-Umleitungssitzung wurde eingerichtet."; if(3==c[2])return"Remote-IDE-Umleitungssitzung beendet. Die Benutzersteuerung wurde wiederhergestellt."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="verdrahtet"),4294967293==a?"Alle empfangenen Paketfilter wurden abgeglichen"+b+" Schnittstelle.":4294967292==a?"Alle ausgehenden Paketfilter wurden abgeglichen"+b+" Schnittstelle.":4294967290==a?"Der gef\u00e4lschte Paketfilter wurde angepasst"+b+" Schnittstelle.":"Filter"+a+" wurde auf abgestimmt"+b+" Schnittstelle."; if(192==a)return 0==c[2]?"Sicherheitsrichtlinie aufgerufen. Ein Teil oder der gesamte Netzwerkverkehr (TX) wurde gestoppt.":2==c[2]?"Sicherheitsrichtlinie aufgerufen. Ein Teil oder der gesamte Netzwerkverkehr (RX) wurde gestoppt.":"Sicherheitsrichtlinie aufgerufen.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Benutzeranforderung f\u00fcr Remoteverbindung.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC-Fehler: Versuchen Sie, die Haltung zu ermitteln, w\u00e4hrend NAC in Intel AMT deaktiviert ist."; if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA-Fehler: Allgemeiner Fehler"}return 6==a?"Authentifizierung fehlgeschlagen"+(c[1]+(c[2]<<8))+" mal. Das System wird m\u00f6glicherweise angegriffen.":30==a?"Keine bootf\u00e4higen Medien":32==a?"Betriebssystemsperre oder Stromunterbrechung":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"Systemstartfehler":37==a?"Die Systemfirmware wurde gestartet (mindestens eine CPU wird ordnungsgem\u00e4\u00df ausgef\u00fchrt).":"Unbekannter Sensortyp #"+ -a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0Lokal",h=5);3==b.InitiatorType&&(b.Initiator="KVM-Standardport",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100* -b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+ -e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a), -b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b, -execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+ +e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a), +b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b, +execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
http://schemas.xmlsoap.org/ws/2004/08/addressing
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
http://schemas.xmlsoap.org/ws/2004/08/addressing
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -121,8 +120,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -143,8 +142,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -154,12 +153,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="Nicht spezifiziert. ; Kein Systemspeicher ist physisch im System installiert. ; Kein verwendbarer Systemspeicher, der gesamte installierte Speicher hat einen nicht behebbaren Fehler. ; Nicht behebbarer Festplatten- / ATAPI / IDE-Ger\u00e4tefehler. ; Nicht behebbarer Systemplatinenfehler. ; Nicht behebbare Diskette Subsystemfehler. ; Nicht behebbarer Festplattencontrollerfehler. ; Nicht behebbarer PS / 2- oder USB-Tastaturfehler. ; Wechselmedium nicht gefunden. ; Nicht behebbarer Videocontrollerfehler. ; Kein Videoger\u00e4t erkannt. ; Firmware (BIOS) -ROM-Besch\u00e4digung erkannt. ; Nicht \u00fcbereinstimmende CPU-Spannung (Prozessoren mit derselben Versorgung haben nicht \u00fcbereinstimmende Spannungsanforderungen) ; Fehler bei der Anpassung der CPU-Geschwindigkeit".split(";"), +[a,b,[]])};var E="Nicht spezifiziert. ; Kein Systemspeicher ist physisch im System installiert. ; Kein verwendbarer Systemspeicher, der gesamte installierte Speicher hat einen nicht behebbaren Fehler. ; Nicht behebbarer Festplatten- / ATAPI / IDE-Ger\u00e4tefehler. ; Nicht behebbarer Systemplatinenfehler. ; Nicht behebbare Diskette Subsystemfehler. ; Nicht behebbarer Festplattencontrollerfehler. ; Nicht behebbarer PS / 2- oder USB-Tastaturfehler. ; Wechselmedium nicht gefunden. ; Nicht behebbarer Videocontrollerfehler. ; Kein Videoger\u00e4t erkannt. ; Firmware (BIOS) -ROM-Besch\u00e4digung erkannt. ; Nicht \u00fcbereinstimmende CPU-Spannung (Prozessoren mit derselben Versorgung haben nicht \u00fcbereinstimmende Spannungsanforderungen) ; Fehler bei der Anpassung der CPU-Geschwindigkeit".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="Nicht spezifiziert ; Andere ; Unbekannt ; Prozessor ; Festplatte ; Peripherieger\u00e4t ; Systemverwaltungsmodul ; Systemplatine ; Speichermodul ; Prozessormodul ; Stromversorgung ; Karte hinzuf\u00fcgen ; Frontplatine ; R\u00fcckwandplatine ; Stromversorgungsplatine ; Antriebsr\u00fcckwandplatine ; Systeminterne Erweiterung Karte ; Andere Systemplatine ; Prozessorkarte ; Netzteil ; Leistungsmodul ; Energieverwaltungskarte ; Geh\u00e4use-R\u00fcckwandplatine ; Systemgeh\u00e4use ; Untergeh\u00e4use ; Andere Geh\u00e4useplatine ; Festplattenschacht ; Peripheriefachschacht ; Ger\u00e4teschacht ; L\u00fcfterk\u00fchlung ; K\u00fchleinheit ; Kabelverbindung ; Speicherger\u00e4t ; Systemverwaltungssoftware ; BIOS ; Intel (r) ME ; Systembus ; Gruppe ; Intel (r) ME ; Externe Umgebung ; Batterie ; Verarbeitungsblatt ; Konnektivit\u00e4tsschalter ; Prozessor / Speichermodul ; E / A-Modul ; Prozessor-E / A-Modul ; Firmware des Management-Controllers ; IPMI-Kanal ; PCI-Bus ; PCI-Express-Bus ; SCSI-Bus ; SATA / SAS-Bus ; Prozessor-Front-Side-Bus".split(";"); +l="Nicht spezifiziert ; Andere ; Unbekannt ; Prozessor ; Festplatte ; Peripherieger\u00e4t ; Systemverwaltungsmodul ; Systemplatine ; Speichermodul ; Prozessormodul ; Stromversorgung ; Karte hinzuf\u00fcgen ; Frontplatine ; R\u00fcckwandplatine ; Stromversorgungsplatine ; Antriebsr\u00fcckwandplatine ; Systeminterne Erweiterung Karte ; Andere Systemplatine ; Prozessorkarte ; Netzteil ; Leistungsmodul ; Energieverwaltungskarte ; Geh\u00e4use-R\u00fcckwandplatine ; Systemgeh\u00e4use ; Untergeh\u00e4use ; Andere Geh\u00e4useplatine ; Festplattenschacht ; Peripheriefachschacht ; Ger\u00e4teschacht ; L\u00fcfterk\u00fchlung ; K\u00fchleinheit ; Kabelverbindung ; Speicherger\u00e4t ; Systemverwaltungssoftware ; BIOS ; Intel (r) ME ; Systembus ; Gruppe ; Intel (r) ME ; Externe Umgebung ; Batterie ; Verarbeitungsblatt ; Konnektivit\u00e4tsschalter ; Prozessor / Speichermodul ; E / A-Modul ; Prozessor-E / A-Modul ; Firmware des Management-Controllers ; IPMI-Kanal ; PCI-Bus ; PCI-Express-Bus ; SCSI-Bus ; SATA / SAS-Bus ; Prozessor-Front-Side-Bus".split(";"); e.RealmNames=";; Umleitung ;; Hardware-Asset ; Fernbedienung ; Speicher ; Event Manager ; Speicheradministrator ; Agentenpr\u00e4senz Lokal ; Agentenpr\u00e4senz Remote ; Leistungsschalter ; Netzwerkzeit ; Allgemeine Informationen ; Firmware-Aktualisierung ; EIT ; LocalUN ; Endpunktzugriffskontrolle ; Endpunktzugriffskontrolle Admin ; Ereignisprotokollleser ; \u00dcberwachungsprotokoll ; ACL-Bereich ;;; Lokales System".split(";");e.WatchdogCurrentStates={1:"Nicht angefangen",2:"Gestoppt",4:"Laufen", -8:"Abgelaufen",16:"Suspendiert"};var h="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(";"),r=";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(";"),K={1:"",2:"HTTPS",4:"Local PBA", -8:"WinRE"},B={16:"Sicherheitsadministrator",17:"RCO",18:"Umleitungsmanager",19:"Firmware Update Manager",20:"Sicherheits\u00fcberwachungsprotokoll",21:"Netzwerkzeit",22:"Netzwerkadministration",23:"Speicherverwaltung",24:"Event Manager",25:"Leistungsschalter-Manager",26:"Agent Presence Manager",27:"Drahtlose Konfiguration",28:"EAC",29:"KVM",30:"Benutzer-Opt-In-Ereignisse",32:"Bildschirmausblendung",33:"Watchdog-Ereignisse",1600:"Bereitstellung gestartet",1601:"Bereitstellung abgeschlossen",1602:"ACL-Eintrag hinzugef\u00fcgt", +8:"Abgelaufen",16:"Suspendiert"};var h="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(";"),r=";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(";"),O={1:"",2:"HTTPS",4:"Local PBA", +8:"WinRE"},C={16:"Sicherheitsadministrator",17:"RCO",18:"Umleitungsmanager",19:"Firmware Update Manager",20:"Sicherheits\u00fcberwachungsprotokoll",21:"Netzwerkzeit",22:"Netzwerkadministration",23:"Speicherverwaltung",24:"Event Manager",25:"Leistungsschalter-Manager",26:"Agent Presence Manager",27:"Drahtlose Konfiguration",28:"EAC",29:"KVM",30:"Benutzer-Opt-In-Ereignisse",32:"Bildschirmausblendung",33:"Watchdog-Ereignisse",1600:"Bereitstellung gestartet",1601:"Bereitstellung abgeschlossen",1602:"ACL-Eintrag hinzugef\u00fcgt", 1603:"ACL-Eintrag ge\u00e4ndert",1604:"ACL-Eintrag entfernt",1605:"ACL-Zugriff mit ung\u00fcltigen Anmeldeinformationen",1606:"ACL-Eingangsstatus",1607:"TLS-Status ge\u00e4ndert",1608:"TLS Server Certificate Set",1609:"TLS-Serverzertifikat entfernen",1610:"TLS Trusted Root Certificate hinzugef\u00fcgt",1611:"TLS Trusted Root Certificate entfernt",1612:"TLS Preshared Key Set",1613:"Kerberos-Einstellungen ge\u00e4ndert",1614:"Kerberos-Hauptschl\u00fcssel ge\u00e4ndert",1615:"Blitzverschlei\u00dfz\u00e4hler zur\u00fcckgesetzt", 1616:"Netzteil ge\u00e4ndert",1617:"Stellen Sie den Realm-Authentifizierungsmodus ein",1618:"Aktualisieren Sie den Client auf den Admin-Steuerungsmodus",1619:"Unprovisioning gestartet",1700:"Power Up durchgef\u00fchrt",1701:"Power Down durchgef\u00fchrt",1702:"Aus- und Wiedereinschalten",1703:"Reset durchgef\u00fchrt",1704:"Legen Sie die Startoptionen fest",1705:"Remote graceful power down initiated",1706:"Remote graceful reset initiated",1707:"Remote Standby initiated",1708:"Remote Hiberate initiated", 1709:"Remote NMI initiated",1800:"IDER-Sitzung ge\u00f6ffnet",1801:"IDER-Sitzung geschlossen",1802:"IDER aktiviert",1803:"IDER deaktiviert",1804:"SoL-Sitzung er\u00f6ffnet",1805:"SoL-Sitzung geschlossen",1806:"SoL aktiviert",1807:"SoL deaktiviert",1808:"KVM-Sitzung gestartet",1809:"KVM-Sitzung beendet",1810:"KVM aktiviert",1811:"KVM deaktiviert",1812:"Das VNC-Passwort ist dreimal fehlgeschlagen",1900:"Firmware aktualisiert",1901:"Firmware-Aktualisierung fehlgeschlagen",2E3:"Sicherheits\u00fcberwachungsprotokoll gel\u00f6scht", @@ -169,17 +168,17 @@ e.RealmNames=";; Umleitung ;; Hardware-Asset ; Fernbedienung ; Speicher ; Event 2900:"KVM-Anmeldung aktiviert",2901:"KVM-Anmeldung deaktiviert",2902:"KVM-Passwort ge\u00e4ndert",2903:"KVM-Zustimmung erfolgreich",2904:"KVM-Zustimmung fehlgeschlagen",3E3:"\u00c4nderung der Opt-In-Richtlinie",3001:"Einwilligungscode-Ereignis senden",3002:"Starten Sie das blockierte Opt-In-Ereignis",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.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["Ung\u00fcltiger ME-Zugriff","Ung\u00fcltiger MEBx-Zugriff"][b.charCodeAt(0)];if(1606==a){var c=["Behindert","aktiviert"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"Fernbedienung"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Lokal"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b, 0)]+","+["NoAuth","Auth","Behindert"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","Lokale MEI","Lokaler WSMAN","Remote-WSAMN"][b.charCodeAt(0)]:1900==a?"Von"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" zu"+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?"Von"+["Keiner","KVM","Alle"][b.charCodeAt(0)]+" zu"+["Keiner","KVM","Alle"][b.charCodeAt(1)]: -3001==a?["Erfolg","3 mal fehlgeschlagen"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +3001==a?["Erfolg","3 mal fehlgeschlagen"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])};return e}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?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -248,27 +247,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -893,43 +891,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
Wird geladen...
",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -945,7 +943,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -963,28 +961,28 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Uhr synchronisieren",3,syncClockEx,"Intel AMT Uhr mit diesem Computer synchronisieren?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Zeit konnte nicht eingestellt werden, Status ="+d):0!=a.Body.ReturnValue?messagebox("","Zeit konnte nicht eingestellt werden, Fehler: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})} var DMTFPowerStates=";;Ein;Leichter Schlaf;Tiefschlaf;Aus- und Wiedereinschalten (Soft off);Aus - Schwer;Ruhezustand (Aus weich);Weich aus;Aus- und Wiedereinschalten (Aus-hart);Hauptbus zur\u00fcckgesetzt;Diagnose-Interrupt (NMI);Unzutreffend;Aus - Weich anmutig;Aus - Schwer anmutig;Master-Bus zur\u00fcckgesetzt anmutig;Aus- und Wiedereinschalten (Aus - Weich anmutig);Aus- und Wiedereinschalten (Aus - Hart anmutig);Diagnoseunterbrechung (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99Unbekannt";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Keiner":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 n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5Unbekannt";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Keiner":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 n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["Prim\u00e4re Anzeige","Sekund\u00e4ranzeige", +v=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),n=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),e=amtfeatures[3]=void 0;5n.DefaultScreen&&(g=["Prim\u00e4re Anzeige","Sekund\u00e4ranzeige", "3. Anzeige"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+=", Port 5900 aktiviert"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
"); -QH(15,d);d="
"+TableEnd("
 "+AddRefreshButton("PullSystemStatus(1)")+" Das \u00c4ndern der Netzwerkeinstellungen kann dazu f\u00fchren, dass diese Seite nicht mehr verf\u00fcgbar ist.");d=d+"

Allgemeine Einstellungen

"+TableStart();g="";"Keiner"!=c&&(1==v.SharedFQDN&&(g=", mit dem Betriebssystem geteilt"),0==v.SharedFQDN&&(g=", anders als OS"));d+=TableEntry("Name & Domain", -addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="Behindert";1==v.DDNSUpdateEnabled?c="Jeweils aktiviert"+v.DDNSPeriodicUpdateInterval+" Minuten ist TTL"+v.DDNSTTL+" Protokoll":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Update per DHCP-Server");d+=TableEntry("Dynamisches 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+="

"+(amtwirelessif==a?"Drahtlose Schnittstelle":"Kabelgebundene Schnittstelle")+"

";d+=TableStart();d+=TableEntry("Verbindungsstatus",1==c.LinkIsUp?"Link ist aktiv":"Link ist ausgefallen");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&& +QH(15,d);d="
"+TableEnd("
 "+AddRefreshButton("PullSystemStatus(1)")+" Das \u00c4ndern der Netzwerkeinstellungen kann dazu f\u00fchren, dass diese Seite nicht mehr verf\u00fcgbar ist.");d=d+"

Allgemeine Einstellungen

"+TableStart();g="";"Keiner"!=c&&(1==u.SharedFQDN&&(g=", mit dem Betriebssystem geteilt"),0==u.SharedFQDN&&(g=", anders als OS"));d+=TableEntry("Name & Domain", +addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="Behindert";1==u.DDNSUpdateEnabled?c="Jeweils aktiviert"+u.DDNSPeriodicUpdateInterval+" Minuten ist TTL"+u.DDNSTTL+" Protokoll":1==u.DDNSUpdateByDHCPServerEnabled&&(c="Update per DHCP-Server");d+=TableEntry("Dynamisches 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+="

"+(amtwirelessif==a?"Drahtlose Schnittstelle":"Kabelgebundene Schnittstelle")+"

";d+=TableStart();d+=TableEntry("Verbindungsstatus",1==c.LinkIsUp?"Link ist aktiv":"Link ist ausgefallen");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&& g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Link-Richtlinie",addLinkConditional(0==g.length?"Nicht verf\u00fcgbar":"Verf\u00fcgbar in: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC-Adresse",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Zustand",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:"Keiner")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled? "aktiviert":"Behindert","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"aktiviert":"Behindert","showUefiWifiCoExDlg()", -xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Antworten Sie auf Ping",addLinkConditional(["Behindert","ICMP-Antwort","RMCP-Antwort","ICMP & RMCP Antwort"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Automatisch mit DHCP-Server":"Statische IP-Adresse",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("IPv4-Status",addLinkConditional(g,"showIPSetupDlg()", +xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Antworten Sie auf Ping",addLinkConditional(["Behindert","ICMP-Antwort","RMCP-Antwort","ICMP & RMCP Antwort"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Automatisch mit DHCP-Server":"Statische IP-Adresse",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("IPv4-Status",addLinkConditional(g,"showIPSetupDlg()", xxAccountAdminName)));d+=TableEntry("IPv4-Adresse",isIpAddress(c.IPAddress,"Keiner"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("IPv4-Gateway / Maske",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Keiner")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("IPv4-Domainnamenserver",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
");a+="
";a+="

  EventTimeQuelleBeschreibung";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

"+(parseInt(a)+1)+'
'+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
"+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
"+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

  EventTimeQuelleBeschreibung";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

"+(parseInt(a)+1)+'
'+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
"+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
"+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"Ereignisprotokoll l\u00f6schen?"),setDialogMode(1,"Ereignisprotokoll",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Ereignisprotokoll","Fehler beim L\u00f6schen, Fehler: "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
"+addHtmlValue("Zeit",c.Time.toLocaleString());a+=addHtmlValue("Quelle",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Beschreibung",c.Desc);a+=MoreStart();a+=addHtmlValue("Ger\u00e4teadresse",c.DeviceAddress);a+=addHtmlValue("Entit\u00e4t",c.Entity);a+=addHtmlValue("Entit\u00e4tsinstanz",c.EntityInstance);var d="",g;for(g in c.EventData)0";messagebox(format("Ereignis # {0} Details",b+1),a)}} @@ -1032,8 +1030,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Behindert":"aktiviert",c&2&&(b+=", Gesperrt"),c&4&&(b+=", Fast voll"),c&8&&(b+=", Voll"),c&16&&(b+=", Kein Schl\u00fcssel"),c="

\u00dcberwachungsprotokolleinstellungen

"+TableStart(),c+=TableEntry("Zustand",b),c+=TableEntry("Lager",a[0].CurrentNumberOfRecords+" Aufzeichnungen),"+a[0].PercentageFree+"% kostenlos"),c+=TableEntry("Richtlinie \u00fcberschreiben",2==a[0].OverwritePolicy?"Wraps wenn voll":"\u00dcberschreibt nie"), c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
 
'+AddRefreshButton("PullAuditLog(1)")+AddButton("Speichern...","SaveAuditLog()")+AddButton("Protokoll l\u00f6schen","ClearAuditLog()"))+"
");if(0==c.length)d="Es wurden keine \u00dcberwachungsprotokollereignisse gefunden.";else{var g= -0;d+="

  ZeitInitiatorAction";for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
  "+v.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
"+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
"}QH(50,d)} +0;d+="

  ZeitInitiatorAction";for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0  '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
  "+u.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
"+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
"}QH(50,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(60,"\u00dcberwachungsprotokoll l\u00f6schen?");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="
"+addHtmlValue("Zeit",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiator",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Adresse",a.NetAddress));d+=addHtmlValue("Anwendung",a.AuditApp);d+=addHtmlValue("Veranstaltung",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Erweiterte Daten",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
Zertifikat
Security
Remote CN\'s
';setDialogMode(11, @@ -1084,7 +1082,7 @@ function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabi "PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Unbekannt;Andere;aktiviert;Behindert;Herunterfahren;Unzutreffend;Aktiviert aber offline;Im Test;Aufgeschoben;Ruhe;Beginnend".split(";"),watchdogMonitoredEntity="Unbekannt;Andere;Betriebssystem;Startvorgang des Betriebssystems;Prozess zum Herunterfahren des Betriebssystems;Firmware-Startvorgang;BIOS-Startvorgang;Anwendung;Serviceprozessor".split(";"); function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Maximale Wachhunde",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" Aufpasser");b+=TableEntry("Maximale Gesamtaktionen",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" Aktionen");b+=TableEnd()+"
";b+=TableStart2();b+="

Verwalten Sie Intel® AMT-Agenten-Anwesenheits-Watchdogs.

";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses|| 0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
Kein Agent Presence Watchdog gefunden.

";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+="
";a.transitions&&(b+='");b+="
"+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
");d+=getWatchdogTransitionStr(v.OldState)+" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : Zu protokollierendes Ereignis")}""!= +c+")>";a.transitions&&(b+='");b+="
"+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
");d+=getWatchdogTransitionStr(u.OldState)+" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : Zu protokollierendes Ereignis")}""!= d&&(b+="
"+d+"
");b+="
"}b=b+"
"+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Watchdog hinzuf\u00fcgen ...","AddWatchdog()"));b+="
";QH(54,b)}}function getWatchdogTransitionStr(b){if(31==b)return"Jeder Staat";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("Beschreibung",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("\u00dcberwachte Entit\u00e4t",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Aktuellen Zustand",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Aktivierter Status",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Startintervall", b.StartupInterval+" Sekunde (n)");c+=addHtmlValue("Timeout-Intervall",b.TimeoutInterval+" Sekunde (n)");setDialogMode(11,format("Wachhund {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1106,12 +1104,12 @@ a}b+=TableStart();c="Keiner";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemD if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
Keine Systemverteidigungsrichtlinien gefunden.

";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
"+ EscapeHtml(a.PolicyName)+""+d+"
";b+="

Verwalten Sie Intel® AMT-Systemschutzfilter.

";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
Es wurden keine Systemverteidigungsfilter gefunden.

";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])|| (d="Alle Ethernet-Protokoll"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" beim"+a.FilterProfileData+" Paket / Sek"),1==a.ActionEventOnMatch&&(d+=", Ereignis beim Spiel"),b+="
"+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c]; -(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Alle Ethernet-Protokoll"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" beim"+a.FilterProfileData+" Paket / Sek");1==a.ActionEventOnMatch&&(d+=", Ereignis beim Spiel");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
"+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+ +(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Alle Ethernet-Protokoll"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" beim"+a.FilterProfileData+" Paket / Sek");1==a.ActionEventOnMatch&&(d+=", Ereignis beim Spiel");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
"+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+ ", "+d+"
"}}b+="
"+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Filter hinzuf\u00fcgen ...","AddDefenseFilter()")+AddButton("Richtlinie hinzuf\u00fcgen ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
Standardrichtlinie
",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1124,12 +1122,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
=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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="Hdr"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Systemverteidigungsfilter hinzuf\u00fcgen","Filter kann nicht hinzugef\u00fcgt werden, Fehler #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Ethernet-Verkehr",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Alle Ethernet-Protokoll"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="IP-Verkehr",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Alle IP-Protokoll"+d.HdrIPVersion));var n;n=""+addHtmlValue("Name",EscapeHtml(d.Name));n+=addHtmlValue("Art",g);n+=addHtmlValue("Passender Verkehr", -a);n+=addHtmlValue("Richtung",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filter"+a,g));n+=addHtmlValue("Ereignis beim Spiel",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk, -n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Filter entfernen","Filter kann nicht entfernt werden. Stellen Sie sicher, dass er nicht verwendet wird."):PullSystemDefense()}var xxAddDefensePolicyFilters; +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="Ethernet-Verkehr",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Alle Ethernet-Protokoll"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="IP-Verkehr",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Alle IP-Protokoll"+d.HdrIPVersion));var n;n=""+addHtmlValue("Name",EscapeHtml(d.Name));n+=addHtmlValue("Art",g);n+=addHtmlValue("Passender Verkehr", +a);n+=addHtmlValue("Richtung",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filter"+a,g));n+=addHtmlValue("Ereignis beim Spiel",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk, +n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Filter entfernen","Filter kann nicht entfernt werden. Stellen Sie sicher, dass er nicht verwendet wird."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
Name
Standard TX / RX
';b+= "
";if(0
Filter hinzuf\u00fcgen
"}setDialogMode(11,"Systemverteidigungsrichtlinie hinzuf\u00fcgen",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())} @@ -1162,8 +1160,8 @@ function updateWifiDialog(){var b=!0,c=c25.value,a=c27.value;QV(66,4>c);QV(65,3< c28.value==c29.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 *CIM_Battery".split(" "),processHardware);amtFirstPull|=1} var DMTFCPUStatus="Unbekannt;aktiviert;Vom Benutzer deaktiviert;Vom BIOS deaktiviert (POST-Fehler);Leerlauf;Andere".split(";"),DMTFMemType="Unbekannt;Andere;DRAM;Synchroner DRAM;Cache-DRAM;EDO;EDRAM;VRAM;SRAM;RAM;Rom;Blitz;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Andere;Unbekannt;SIMM;SCHLUCK;Chip;TAUCHEN;ZIP;Propriet\u00e4re Karte;DIMM;TSOP;Reihe von Chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"), DMTFProcFamilly={191:"Intel® Core ™ 2 Duo Prozessor",192:"Intel® Core ™ 2 Solo Prozessor",193:"Intel® Core ™ 2 Extreme Prozessor",194:"Intel® Core ™ 2 Quad-Prozessor",195:"Intel® Core ™ 2 Extreme Mobilprozessor",196:"Intel® Core ™ 2 Duo Mobilprozessor",197:"Intel® Core ™ 2 Solo Mobilprozessor",198:"Intel® Core ™ i7-Prozessor",199:"Dual-Core Intel® Celeron® Prozessor"},HardwareInventory; -function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
 "+AddRefreshButton("PullHardware(1)")+AddButton("Speichern...","SaveHardwareLog()")+" Hardwareinformationen werden beim Systemstart erfasst.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

Plattform

"+FullTable({Computermodell:c.Model,Hersteller:c.Manufacturer, -"Ausf\u00fchrung":c.Version,Ordnungsnummer:c.SerialNumber,"System ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

Fu\u00dfleiste

";b+=FullTable({Hersteller:d.Manufacturer,Produktname:d.Model,"Ausf\u00fchrung":d.Version,Ordnungsnummer:d.SerialNumber,"Asset-Tag":d.Tag,"Austauschbar?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

BIOS

";b+=FullTable({"Verk\u00e4ufer":a.CIM_BIOSElement.response.Manufacturer,"Ausf\u00fchrung":v,"Ver\u00f6ffentlichungsdatum":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", +function processHardware(b,c,a,d){if(200==d){var g;b="
";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
 "+AddRefreshButton("PullHardware(1)")+AddButton("Speichern...","SaveHardwareLog()")+" Hardwareinformationen werden beim Systemstart erfasst.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

Plattform

"+FullTable({Computermodell:c.Model,Hersteller:c.Manufacturer, +"Ausf\u00fchrung":c.Version,Ordnungsnummer:c.SerialNumber,"System ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

Fu\u00dfleiste

";b+=FullTable({Hersteller:d.Manufacturer,Produktname:d.Model,"Ausf\u00fchrung":d.Version,Ordnungsnummer:d.SerialNumber,"Asset-Tag":d.Tag,"Austauschbar?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

BIOS

";b+=FullTable({"Verk\u00e4ufer":a.CIM_BIOSElement.response.Manufacturer,"Ausf\u00fchrung":u,"Ver\u00f6ffentlichungsdatum":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", {timeZone:"UTC"})},"");b+="
";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

Prozessor "+(parseInt(g)+1)+"

",b+=FullTable({Hersteller:trademarks(d.Manufacturer),Familie:DMTFProcFamilly[c.Family],"Ausf\u00fchrung":trademarks(d.Version),"Maximale Sockelgeschwindigkeit":c.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[c.CPUStatus]},"");b+="
";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

Speichermodul "+(+g+ 1)+"

",b+=FullTable({"Bank Label":c.BankLabel,Hersteller:c.Manufacturer,Ordnungsnummer:c.SerialNumber,"Gr\u00f6\u00dfe":parseInt(c.Capacity/1048576)+" MB",Formfaktor:DMTFMemFormFactor[c.FormFactor],Art:DMTFMemType[c.MemoryType],"Asset-Tag":c.Tag,Artikelnummer:c.PartNumber},"");b+="
";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

Speichermedium "+(parseInt(g)+1)+"

",b+=FullTable({Modell:d.Model,Ordnungsnummer:""== d.SerialNumber?"Unknown":d.SerialNumber,"Gr\u00f6\u00dfe":parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="
";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+="

Battery

",g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,Hersteller:c.Manufacturer,"Manufacture date":g,Ordnungsnummer:c.SerialNumber, @@ -1174,18 +1172,18 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

Verwalten Sie die Intel® AMT-Benutzerkonten f\u00fcr diesen Computer.

",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!= -a.AccessPermission){2==v&&(n+="Behindert,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Bereiche[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Wirtschaftspr\u00fcfer,");n=0<=a.Realms.indexOf(3)?n+"Administrator":1==l?n+"1 Reich":n+(l+" Bereiche")}else n+="Administrator",a.Handle=-1;b+="
";0

Verwalten Sie die Intel® AMT-Benutzerkonten f\u00fcr diesen Computer.

",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!= +a.AccessPermission){2==u&&(n+="Behindert,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Bereiche[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="Wirtschaftspr\u00fcfer,");n=0<=a.Realms.indexOf(3)?n+"Administrator":1==k?n+"1 Reich":n+(k+" Bereiche")}else n+="Administrator",a.Handle=-1;b+="
";0'+d+"
"+n+"
"}}c='
 "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()"); xxAccountAdminName&&(c+=AddButton("Neues Konto","newAccountButton()"));b+="
"+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"Konto bearbeiten",-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,"Neues Konto",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Kontofehler","Ung\u00fcltige Parameter");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, -l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("Kontofehler","Ung\u00fcltige Parameter");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, +k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Name",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Zustand",1==xxAccountEnabledInfo[b].Enabled?"aktiviert":"Behindert"));if(g==xxAccountAdminName)a+=addHtmlValue("Genehmigung","Administrator");else{var a=a+addHtmlValue("Genehmigung",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v="Administrator", -0<=c.Realms.indexOf(20)&&(v+=", Wirtschaftspr\u00fcfer");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("Konto"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Name",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Zustand",1==xxAccountEnabledInfo[b].Enabled?"aktiviert":"Behindert"));if(g==xxAccountAdminName)a+=addHtmlValue("Genehmigung","Administrator");else{var a=a+addHtmlValue("Genehmigung",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u="Administrator", +0<=c.Realms.indexOf(20)&&(u+=", Wirtschaftspr\u00fcfer");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("Konto"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (Leeren)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    Error #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1233,10 +1231,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0, -70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0, +70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"Server":"")+"IDE-R-Sitzung , verbunden,"+ider.m.bytesFromAmt+" im,"+ider.m.bytesToAmt+" aus.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CD-ROM , Bl\u00f6cke sind {0} Bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Diskette , Bl\u00f6cke sind {0} Bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height= +function iderSectorStats(b,c,a,d,g){var u=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=u.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CD-ROM , Bl\u00f6cke sind {0} Bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Diskette , Bl\u00f6cke sind {0} Bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height= 6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Periodische Verbindung",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Verwalten von Intel® AMT-Remoteverwaltungsservern.

    ";if(0==xxCiraServers.length)b+="

    Keine Remote-Server gefunden.

    "; +if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format("alle {0} Sekunden",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("Periodische Verbindung",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Verwalten von Intel® AMT-Remoteverwaltungsservern.

    ";if(0==xxCiraServers.length)b+="

    Keine Remote-Server gefunden.

    "; else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    Verwalten von HTTP-Proxys, die f\u00fcr Verwaltungsverbindungen verwendet werden.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="

    Keine Proxys konfiguriert.

    "; else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("Server hinzuf\u00fcgen...","AddRemoteAccessServer()"),a&&(d+=AddButton("Proxy hinzuf\u00fcgen ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(52,b)}}var xxEditMpsPolicyType; function editMpsPolicy(b){var c="",a=11"); 1==b?QH(63,c):setDialogMode(11,"Umgebungserkennung",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)}} @@ -1361,7 +1359,7 @@ rsepass=1,setDialogMode(11,"Power-Aktionen",3,powerActionDlg,b)):106==b||107==b? function powerActionDlgRPE(b){var c;c="Confirm execution of Intel® Remote Platform Erase?

    WARNUNG: Dadurch werden Daten auf dem Remote-System gel\u00f6scht.
    ";var a=[],d=amtPowerBootCapabilities.PlatformErase;d&4&&a.push("");d&64&&a.push("");d&33554432&&a.push(""); d&67108864&&a.push("");d&-2147483648&&a.push("");1Select the actions to take:

    {0}

    ",a.join("
    ")));c+="";setDialogMode(11,"Power-Aktionen",3,powerActionDlgRPEEx,c,b);QE("c54",!1)}function powerActionDlgRPEValidate(){var b=0,c=amtPowerBootCapabilities.PlatformErase,a=[2,6,25,26,31],d;for(d in a)c&1<b&&2amtversion&&(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("c39").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); @@ -1394,12 +1392,12 @@ targetPowerAction=b;11==b&&(b=10);999>b?(console.log("RequestPowerStateChange("+ function powerActionResponse5(b,c,a,d){}function consentChanged(){QE("c54",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",2c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(D){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Verwalten Sie den Intel® AMT-Speicher f\u00fcr diesen Computer.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+ -" / "+p):g+"Wurzel";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Herunterladen","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" Bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0== -q&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Keine Dateien gefunden.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+ -(v?AddButton("Hochladen...","UploadToStorage()"):""));QH(55,a)}else QH(55,"Speicherdaten k\u00f6nnen nicht geladen werden ...
    "+AddButton("Aktualisierung","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Verk\u00e4ufer",b));""!=c&&(g+=addHtmlValue("Anwendung",c));g+=addHtmlValue("Name",a);g+=addHtmlValue("Gr\u00f6\u00dfe",v.size+" bytes");v.link&&(g+=addHtmlValue("Verkn\u00fcpfung",v.link));setDialogMode(11,"Aufbewahrungsgegenstand",5,showStorageDetailsEx,g,d)}} +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Verwalten Sie den Intel® AMT-Speicher f\u00fcr diesen Computer.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+ +" / "+p):g+"Wurzel";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Herunterladen","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" Bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0== +v&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Keine Dateien gefunden.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+ +(u?AddButton("Hochladen...","UploadToStorage()"):""));QH(55,a)}else QH(55,"Speicherdaten k\u00f6nnen nicht geladen werden ...
    "+AddButton("Aktualisierung","PullStorage()"))} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Verk\u00e4ufer",b));""!=c&&(g+=addHtmlValue("Anwendung",c));g+=addHtmlValue("Name",a);g+=addHtmlValue("Gr\u00f6\u00dfe",u.size+" bytes");u.link&&(g+=addHtmlValue("Verkn\u00fcpfung",u.link));setDialogMode(11,"Aufbewahrungsgegenstand",5,showStorageDetailsEx,g,d)}} function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Lager",format("Datei kann nicht gel\u00f6scht werden (ERR {0}). \u00dcberpr\u00fcfen Sie, ob der Computer eingeschaltet ist.",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","noopener,noreferrer");a.opener=null;a.focus()}} function PushToStorage(b,c,a){var d=null;7E3";else xxAlarms=null,b+="

    Es wurden keine Weckalarme registriert.

    ";d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Entfernen Sie alle Alarme","RemoveAllAlarms()")+ AddButton("Hinzuf\u00fcgen","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"Entfernen Sie alle Weckalarme",3,RemoveAllAlarmsEx,"Entfernen aller Weckalarme best\u00e4tigen?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"Entfernen Sie alle Weckalarme",3,RemoveAllAlarmsEx,"Entfernen aller Weckalarme best\u00e4tigen?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"Neuen Alarm hinzuf\u00fcgen",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 \u00dcberpr\u00fcfen Sie, ob der Alarm f\u00fcr eine zuk\u00fcnftige Zeit gilt.",d)):0!=c.Body.ReturnValue?messagebox("Alarm hinzuf\u00fcgen",format("Alarm {0} konnte nicht hinzugef\u00fcgt werden.
    \u00dcberpr\u00fcfen Sie, ob der Alarm f\u00fcr eine zuk\u00fcnftige Zeit gilt.", -c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Alarm bearbeiten",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Alarm hinzuf\u00fcgen",format("Fehler beim Hinzuf\u00fcgen eines Alarms. Status: {0}.
    \u00dcberpr\u00fcfen Sie, ob der Alarm f\u00fcr eine zuk\u00fcnftige Zeit gilt.",d)):0!=c.Body.ReturnValue?messagebox("Alarm hinzuf\u00fcgen",format("Alarm {0} konnte nicht hinzugef\u00fcgt werden.
    \u00dcberpr\u00fcfen Sie, ob der Alarm f\u00fcr eine zuk\u00fcnftige Zeit gilt.", +c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Alarm bearbeiten",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("Name",c.ElementName)+addHtmlValue("Weckzeit",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("Intern",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Nach dem Aufwachen",1==c.DeleteOnCompletion?"Alarm l\u00f6schen":"Alarm halten")+"
    ";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,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"OK",401:"Authentifizierungsfehler",408:"Timeout-Fehler",601:"WSMAN-Analysefehler",602:"HTTP-Antwortheader kann nicht analysiert werden",603:"Unerwartete HTTP-Enum-Antwort",604:"Unerwartete HTTP-Pull-Antwort",997:"Ung\u00fcltiger Verdauungsbereich"}; +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"OK",401:"Authentifizierungsfehler",408:"Timeout-Fehler",601:"WSMAN-Analysefehler",602:"HTTP-Antwortheader kann nicht analysiert werden",603:"Unerwartete HTTP-Enum-Antwort",604:"Unerwartete HTTP-Pull-Antwort",997:"Ung\u00fcltiger Verdauungsbereich"}; 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("Fehler # {0}",b)),401==b&&QH(5,'Authentifizierungsfehler

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Anruffehler",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Anruffehler",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""} function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Datos inv\u00e1lidos";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", -r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Datos inv\u00e1lidos";if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", +r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& 64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18== a&&170==c[0])return"Agente de vigilancia"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... cambiado a"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Intrusi\u00f3n de casos";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"Se estableci\u00f3 una sesi\u00f3n remota Serial Over LAN.";if(1==c[2])return"Sesi\u00f3n remota serie en LAN finalizada. Se restableci\u00f3 el control del usuario.";if(2==c[2])return"Se estableci\u00f3 una sesi\u00f3n remota de redirecci\u00f3n de IDE."; if(3==c[2])return"Sesi\u00f3n remota de redirecci\u00f3n de IDE finalizada. Se restableci\u00f3 el control del usuario."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="cableado"),4294967293==a?"Todos los filtros de paquetes recibidos coinciden"+b+" interfaz.":4294967292==a?"Todos los filtros de paquetes salientes coincidieron con"+b+" interfaz.":4294967290==a?"El filtro de paquetes falsificado se hizo coincidir"+b+" interfaz.":"Filtrar"+a+" fue emparejado en"+b+" interfaz."; if(192==a)return 0==c[2]?"Pol\u00edtica de seguridad invocada. Se detuvo parte o todo el tr\u00e1fico de red (TX).":2==c[2]?"Pol\u00edtica de seguridad invocada. Se detuvo parte o todo el tr\u00e1fico de red (RX).":"Pol\u00edtica de seguridad invocada.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Solicitud del usuario para conexi\u00f3n remota.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"Error de EAC: intente obtener una postura mientras NAC en Intel\u00ae AMT est\u00e1 desactivado."; if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Error de HWA: error general"}return 6==a?"Autenticaci\u00f3n fallida"+(c[1]+(c[2]<<8))+" veces. El sistema puede estar bajo ataque.":30==a?"No hay medios de arranque":32==a?"Bloqueo del sistema operativo o interrupci\u00f3n de energ\u00eda":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"Falla de arranque del sistema":37==a?"Se inici\u00f3 el firmware del sistema (al menos una CPU se est\u00e1 ejecutando correctamente).":"Tipo de sensor desconocido #"+ -a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0Local",h=5);3==b.InitiatorType&&(b.Initiator="Puerto predeterminado de KVM",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r); -b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions= -function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m, -p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml= -function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions= +function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m, +p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml= +function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -121,8 +120,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -143,8 +142,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -154,12 +153,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="Sin especificar. No hay memoria del sistema instalada f\u00edsicamente en el sistema. No hay memoria utilizable del sistema, toda la memoria instalada ha experimentado una falla irrecuperable. Falla irrecuperable del disco duro / dispositivo ATAPI / IDE. Falla irrecuperable de la placa del sistema. falla del subsistema. ; Falla irrecuperable del controlador del disco duro. ; Falla irrecuperable del teclado PS / 2 o USB. ; No se encontr\u00f3 el medio de arranque extra\u00edble. ; Falla irrecuperable del controlador de video. ; No se detect\u00f3 ning\u00fan dispositivo de video. ; Se detect\u00f3 corrupci\u00f3n de ROM del firmware (BIOS). ; Falta de coincidencia de voltaje de la CPU (los procesadores que comparten el mismo suministro tienen requisitos de voltaje no coincidentes)".split(";"), +[a,b,[]])};var E="Sin especificar. No hay memoria del sistema instalada f\u00edsicamente en el sistema. No hay memoria utilizable del sistema, toda la memoria instalada ha experimentado una falla irrecuperable. Falla irrecuperable del disco duro / dispositivo ATAPI / IDE. Falla irrecuperable de la placa del sistema. falla del subsistema. ; Falla irrecuperable del controlador del disco duro. ; Falla irrecuperable del teclado PS / 2 o USB. ; No se encontr\u00f3 el medio de arranque extra\u00edble. ; Falla irrecuperable del controlador de video. ; No se detect\u00f3 ning\u00fan dispositivo de video. ; Se detect\u00f3 corrupci\u00f3n de ROM del firmware (BIOS). ; Falta de coincidencia de voltaje de la CPU (los procesadores que comparten el mismo suministro tienen requisitos de voltaje no coincidentes)".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="Sin especificar ; Otro ; Desconocido ; Procesador ; Disco ; Perif\u00e9rico ; M\u00f3dulo de gesti\u00f3n del sistema ; Placa del sistema ; M\u00f3dulo de memoria ; M\u00f3dulo del procesador ; Fuente de alimentaci\u00f3n ; Agregar tarjeta ; Placa del panel frontal ; Placa del panel posterior ; Placa del sistema de alimentaci\u00f3n ; Placa posterior de la unidad ; Expansi\u00f3n interna del sistema placa ; Otra placa del sistema ; Placa del procesador ; Unidad de potencia ; M\u00f3dulo de potencia ; Placa de administraci\u00f3n de energ\u00eda ; Placa del panel posterior del chasis ; Chasis del sistema ; Chasis secundario ; Otra placa del chasis ; Compartimento de la unidad de disco ; Compartimento perif\u00e9rico ; Compartimento del dispositivo ; Refrigeraci\u00f3n del ventilador ; Unidad de refrigeraci\u00f3n ; Interconexi\u00f3n de cables ; Dispositivo de memoria ; Software de gesti\u00f3n del sistema ; BIOS ; Intel (r) ME ; Bus del sistema ; Grupo ; Intel (r) ME ; Entorno externo ; Bater\u00eda ; Blade de procesamiento ; Interruptor de conectividad ; M\u00f3dulo de procesador / memoria ; M\u00f3dulo de E / S ; M\u00f3dulo de E / S del procesador ; Firmware del controlador de gesti\u00f3n ; Canal IPMI ; Bus PCI ; Bus PCI express ; Bus SCSI ; Bus SATA / SAS ; Bus frontal del procesador".split(";"); +l="Sin especificar ; Otro ; Desconocido ; Procesador ; Disco ; Perif\u00e9rico ; M\u00f3dulo de gesti\u00f3n del sistema ; Placa del sistema ; M\u00f3dulo de memoria ; M\u00f3dulo del procesador ; Fuente de alimentaci\u00f3n ; Agregar tarjeta ; Placa del panel frontal ; Placa del panel posterior ; Placa del sistema de alimentaci\u00f3n ; Placa posterior de la unidad ; Expansi\u00f3n interna del sistema placa ; Otra placa del sistema ; Placa del procesador ; Unidad de potencia ; M\u00f3dulo de potencia ; Placa de administraci\u00f3n de energ\u00eda ; Placa del panel posterior del chasis ; Chasis del sistema ; Chasis secundario ; Otra placa del chasis ; Compartimento de la unidad de disco ; Compartimento perif\u00e9rico ; Compartimento del dispositivo ; Refrigeraci\u00f3n del ventilador ; Unidad de refrigeraci\u00f3n ; Interconexi\u00f3n de cables ; Dispositivo de memoria ; Software de gesti\u00f3n del sistema ; BIOS ; Intel (r) ME ; Bus del sistema ; Grupo ; Intel (r) ME ; Entorno externo ; Bater\u00eda ; Blade de procesamiento ; Interruptor de conectividad ; M\u00f3dulo de procesador / memoria ; M\u00f3dulo de E / S ; M\u00f3dulo de E / S del procesador ; Firmware del controlador de gesti\u00f3n ; Canal IPMI ; Bus PCI ; Bus PCI express ; Bus SCSI ; Bus SATA / SAS ; Bus frontal del procesador".split(";"); e.RealmNames=";; Redirecci\u00f3n ;; Activo de hardware ; Control remoto ; Almacenamiento ; Administrador de eventos ; Administrador de almacenamiento ; Presencia de agente local ; Presencia de agente remoto ; Disyuntor ; Tiempo de red ; Informaci\u00f3n general ; Actualizaci\u00f3n de firmware ; EIT ; LocalUN ; Control de acceso de punto final ; Control de acceso de punto final Admin ; Lector de registro de eventos ; Registro de auditor\u00eda ; Reino ACL ;;; Sistema local".split(";");e.WatchdogCurrentStates= {1:"No empezado",2:"Detenido",4:"Corriendo",8:"Caducado",16:"Suspendido"};var h="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(";"),r=";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(";"), -K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Administrador de seguridad",17:"RCO",18:"Gerente de redireccionamiento",19:"Administrador de actualizaci\u00f3n de firmware",20:"Registro de auditor\u00eda de seguridad",21:"Tiempo de red",22:"Administraci\u00f3n de red",23:"Administraci\u00f3n de almacenamiento",24:"Administrador de evento",25:"Gerente de disyuntores",26:"Gerente de presencia de agente",27:"Configuraci\u00f3n inal\u00e1mbrica",28:"EAC",29:"KVM",30:"Eventos de aceptaci\u00f3n del usuario", +O={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"Administrador de seguridad",17:"RCO",18:"Gerente de redireccionamiento",19:"Administrador de actualizaci\u00f3n de firmware",20:"Registro de auditor\u00eda de seguridad",21:"Tiempo de red",22:"Administraci\u00f3n de red",23:"Administraci\u00f3n de almacenamiento",24:"Administrador de evento",25:"Gerente de disyuntores",26:"Gerente de presencia de agente",27:"Configuraci\u00f3n inal\u00e1mbrica",28:"EAC",29:"KVM",30:"Eventos de aceptaci\u00f3n del usuario", 32:"Pantalla en blanco",33:"Eventos de vigilancia",1600:"Aprovisionamiento iniciado",1601:"Aprovisionamiento completado",1602:"Entrada de ACL agregada",1603:"Entrada de ACL modificada",1604:"Entrada de ACL eliminada",1605:"Acceso a ACL con credenciales no v\u00e1lidas",1606:"Estado de entrada de ACL",1607:"Estado de TLS cambiado",1608:"Conjunto de certificados de servidor TLS",1609:"Certificado de servidor TLS Eliminar",1610:"Certificado TLS Trusted Root agregado",1611:"Certificado ra\u00edz de confianza TLS eliminado", 1612:"Juego de llaves TLS previamente compartidas",1613:"Configuraci\u00f3n de Kerberos modificada",1614:"Clave principal de Kerberos modificada",1615:"Restablecimiento de contadores de desgaste de flash",1616:"Paquete de energ\u00eda modificado",1617:"Establecer modo de autenticaci\u00f3n de reino",1618:"Actualizar cliente al modo de control de administrador",1619:"Desaprovisionamiento iniciado",1700:"Encendido realizado",1701:"Apagado realizado",1702:"Ciclo de energ\u00eda realizado",1703:"Reinicio realizado", 1704:"Establecer opciones de arranque",1705:"Remote graceful power down initiated",1706:"Remote graceful reset initiated",1707:"Remote Standby initiated",1708:"Remote Hiberate initiated",1709:"Remote NMI initiated",1800:"Sesi\u00f3n IDER abierta",1801:"Sesi\u00f3n IDER cerrada",1802:"IDER habilitado",1803:"IDER deshabilitado",1804:"Sesi\u00f3n de SoL abierta",1805:"Sesi\u00f3n de SoL cerrada",1806:"SoL habilitado",1807:"SoL deshabilitado",1808:"Sesi\u00f3n KVM iniciada",1809:"Sesi\u00f3n KVM finalizada", @@ -170,17 +169,17 @@ K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Administrador de seguridad",17 2903:"Consentimiento de KVM exitoso",2904:"Consentimiento de KVM fallido",3E3:"Cambio de pol\u00edtica de aceptaci\u00f3n",3001:"Enviar evento de c\u00f3digo de consentimiento",3002:"Iniciar evento bloqueado de aceptaci\u00f3n",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.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["Acceso inv\u00e1lido a m\u00ed","Acceso no v\u00e1lido a MEBx"][b.charCodeAt(0)];if(1606==a){var c=["Discapacitado","Habilitado"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"Remoto"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Local"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["NoAuth","Autenticaci\u00f3n","Discapacitado"][b.charCodeAt(4)]: 1619==a?["BIOS","MEBx","MEI local","WSMAN local","WSAMN remota"][b.charCodeAt(0)]:1900==a?"Desde"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" a"+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?"Desde"+["Ninguna","KVM","Todas"][b.charCodeAt(0)]+" a"+["Ninguna","KVM","Todas"][b.charCodeAt(1)]:3001==a?["\u00c9xito","Fall\u00f3 3 veces"][b.charCodeAt(0)]: -null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])};return e}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?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -249,27 +248,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -894,43 +892,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    Cargando...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -946,7 +944,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -964,28 +962,28 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Sincronizar reloj",3,syncClockEx,"\u00bfSincronizar el reloj Intel AMT con esta computadora?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Error al establecer la hora, estado ="+d):0!=a.Body.ReturnValue?messagebox("","Error al establecer la hora, error: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})} var DMTFPowerStates=";;Encendido;Sue\u00f1o ligero;Sue\u00f1o profundo;Ciclo de encendido (apagado suave);Apagado: duro;Hibernar (apagado suave);Suave apagado;Ciclo de encendido (apagado);Reinicio del bus principal;Interrupci\u00f3n de diagn\u00f3stico (NMI);No aplica;Apagado: suave y elegante;Apagado: duro y elegante;Reinicio del bus maestro agraciado;Ciclo de encendido (apagado - suave y elegante);Ciclo de encendido (Apagado - Gracioso duro);Interrupci\u00f3n de diagn\u00f3stico (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99Desconocido";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Ninguna":EscapeHtml(c);d+=TableEntry("Nombre y dominio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? -d+=TableEntry("ID del sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID del sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5Desconocido";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Ninguna":EscapeHtml(c);d+=TableEntry("Nombre y dominio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? +d+=TableEntry("ID del sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID del sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["Pantalla principal", +v=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),n=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),e=amtfeatures[3]=void 0;5n.DefaultScreen&&(g=["Pantalla principal", "Pantalla secundaria","Tercera pantalla"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+=", Puerto 5900 habilitado"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    "); -QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" Cambiar la configuraci\u00f3n de red puede hacer que esta p\u00e1gina no est\u00e9 disponible.");d=d+"

    Configuraci\u00f3n general

    "+TableStart();g="";"Ninguna"!=c&&(1==v.SharedFQDN&&(g=", compartido con el sistema operativo"),0==v.SharedFQDN&&(g=", diferente del sistema operativo"));d+=TableEntry("Nombre y dominio", -addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="Discapacitado";1==v.DDNSUpdateEnabled?c="Habilitado cada"+v.DDNSPeriodicUpdateInterval+" minutos, TTL es"+v.DDNSTTL+" minutos":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Actualizaci\u00f3n por servidor DHCP");d+=TableEntry("DNS Din\u00e1mico",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+="

    "+(amtwirelessif==a?"Interfaz inal\u00e1mbrica":"Interfaz cableada")+"

    ";d+=TableStart();d+=TableEntry("Estado de enlace",1==c.LinkIsUp?"Enlace est\u00e1 arriba":"El enlace est\u00e1 ca\u00eddo");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"), -224==c.LinkPolicy[C]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Pol\u00edtica de enlaces",addLinkConditional(0==g.length?"No disponible":"Disponible en: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Direcci\u00f3n MAC",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Estado",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()", +"showEnableBootServiceDlg()",xxAccountAdminName)));if(null!=AmtSystemPowerSchemes)for(var g=amtsysstate.CIM_ElementSettingData.responses,B=0;B
    "); +QH(15,d);d="
    "+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" Cambiar la configuraci\u00f3n de red puede hacer que esta p\u00e1gina no est\u00e9 disponible.");d=d+"

    Configuraci\u00f3n general

    "+TableStart();g="";"Ninguna"!=c&&(1==u.SharedFQDN&&(g=", compartido con el sistema operativo"),0==u.SharedFQDN&&(g=", diferente del sistema operativo"));d+=TableEntry("Nombre y dominio", +addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="Discapacitado";1==u.DDNSUpdateEnabled?c="Habilitado cada"+u.DDNSPeriodicUpdateInterval+" minutos, TTL es"+u.DDNSTTL+" minutos":1==u.DDNSUpdateByDHCPServerEnabled&&(c="Actualizaci\u00f3n por servidor DHCP");d+=TableEntry("DNS Din\u00e1mico",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+="

    "+(amtwirelessif==a?"Interfaz inal\u00e1mbrica":"Interfaz cableada")+"

    ";d+=TableStart();d+=TableEntry("Estado de enlace",1==c.LinkIsUp?"Enlace est\u00e1 arriba":"El enlace est\u00e1 ca\u00eddo");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"), +224==c.LinkPolicy[B]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Pol\u00edtica de enlaces",addLinkConditional(0==g.length?"No disponible":"Disponible en: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Direcci\u00f3n MAC",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Estado",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:"Ninguna")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled? "Habilitado":"Discapacitado","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"Habilitado":"Discapacitado", -"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Responder al ping",addLinkConditional(["Discapacitado","Respuesta ICMP","Respuesta RMCP","Respuesta ICMP y RMCP"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Autom\u00e1tico usando el servidor DHCP":"Direcci\u00f3n IP est\u00e1tica",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Estado IPv4", +"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Responder al ping",addLinkConditional(["Discapacitado","Respuesta ICMP","Respuesta RMCP","Respuesta ICMP y RMCP"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Autom\u00e1tico usando el servidor DHCP":"Direcci\u00f3n IP est\u00e1tica",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Estado IPv4", addLinkConditional(g,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("Direcci\u00f3n IPv4",isIpAddress(c.IPAddress,"Ninguna"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("Puerta de enlace IPv4 / M\u00e1scara",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Ninguna")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("Servidor de nombres de dominio IPv4",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="

      EventTimeFuenteDescripci\u00f3n";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTimeFuenteDescripci\u00f3n";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"\u00bfBorrar el registro de eventos?"),setDialogMode(1,"Registro de eventos",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Registro de eventos","No se puede borrar, error: "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("Hora",c.Time.toLocaleString());a+=addHtmlValue("Fuente",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Descripci\u00f3n",c.Desc);a+=MoreStart();a+=addHtmlValue("Direcci\u00f3n del dispositivo",c.DeviceAddress);a+=addHtmlValue("Entidad",c.Entity);a+=addHtmlValue("Instancia de entidad",c.EntityInstance);var d="",g;for(g in c.EventData)0";messagebox(format("Evento # {0} Detalles",b+1),a)}} @@ -1033,8 +1031,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Discapacitado":"Habilitado",c&2&&(b+=", Bloqueado"),c&4&&(b+=", Casi lleno"),c&8&&(b+=", Completo"),c&16&&(b+=", No hay llave"),c="

    Configuraci\u00f3n del registro de auditor\u00eda

    "+TableStart(),c+=TableEntry("Estado",b),c+=TableEntry("Almacenamiento",a[0].CurrentNumberOfRecords+" registros),"+a[0].PercentageFree+"% gratis"),c+=TableEntry("Pol\u00edtica de sobrescritura",2==a[0].OverwritePolicy?"Se envuelve cuando est\u00e1 lleno": "Nunca sobrescribe"),c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("Salvar...","SaveAuditLog()")+AddButton("Borrar registro","ClearAuditLog()"))+"
    ");if(0==c.length)d="No se encontraron eventos de registro de auditor\u00eda.";else{var g=0;d+="

      HoraIniciadorAction"; -for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit", -minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Registro de auditor\u00eda de Intel AMT",auditLog)} +for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0
      '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit", +minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Registro de auditor\u00eda de Intel AMT",auditLog)} function ClearAuditLog(b){QH(60,"\u00bfBorrar el registro de auditor\u00eda?");setDialogMode(1,"Registro de auditor\u00eda",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("Registro de auditor\u00eda","Error: "+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("Hora",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Iniciador",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Habla a",a.NetAddress));d+=addHtmlValue("Solicitud",a.AuditApp);d+=addHtmlValue("Evento",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Datos extendidos",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
    Certificado
    Security
    CN remotos
    ';setDialogMode(11, @@ -1085,8 +1083,8 @@ function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabi "PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Desconocido;Otro;Habilitado;Discapacitado;Apagando;No aplica;Habilitado pero sin conexi\u00f3n;En prueba;Diferido;Quietud;Comenzando".split(";"),watchdogMonitoredEntity="Desconocido;Otro;Sistema operativo;Proceso de arranque del sistema operativo;Proceso de apagado del sistema operativo;Proceso de arranque del firmware;Proceso de arranque del BIOS;Solicitud;Procesador de servicio".split(";"); function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Watchdogs m\u00e1ximos",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" perros guardianes");b+=TableEntry("M\u00e1ximo total de acciones",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" comportamiento");b+=TableEnd()+"
    ";b+=TableStart2();b+="

    Administre los perros guardianes de presencia de agente Intel® AMT.

    ";if(null== xxWatchdog.AMT_AgentPresenceWatchdog.responses||0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    No se encontr\u00f3 ning\u00fan agente de vigilancia de presencia de agentes.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+ -" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : Evento para registrar")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("A\u00f1adir perro guardi\u00e1n ...","AddWatchdog()"));b+="
    ";QH(54,b)}} +b+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+ +" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : Evento para registrar")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("A\u00f1adir perro guardi\u00e1n ...","AddWatchdog()"));b+="
    ";QH(54,b)}} function getWatchdogTransitionStr(b){if(31==b)return"Cualquier estado";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("Descripci\u00f3n",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Entidad monitoreada",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Estado actual",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Estado habilitado",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Intervalo de inicio", b.StartupInterval+" segundos)");c+=addHtmlValue("Intervalo de tiempo de espera",b.TimeoutInterval+" segundos)");setDialogMode(11,format("Perro guardi\u00e1n {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1108,12 +1106,12 @@ a}b+=TableStart();c="Ninguna";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystem if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
    No se encontraron pol\u00edticas de defensa del sistema.

    ";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
    "+EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    Administre los filtros de defensa del sistema Intel® AMT.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    No se encontraron filtros de defensa del sistema.

    ";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c], (d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="Todo el protocolo de Ethernet"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" a"+a.FilterProfileData+" paquete / seg"),1==a.ActionEventOnMatch&&(d+=", Evento en partido"),b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a= -xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Todo el protocolo de Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" a"+a.FilterProfileData+" paquete / seg");1==a.ActionEventOnMatch&&(d+=", Evento en partido");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
    "+(0== +xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Todo el protocolo de Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" a"+a.FilterProfileData+" paquete / seg");1==a.ActionEventOnMatch&&(d+=", Evento en partido");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0== a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("A\u00f1adir filtro...","AddDefenseFilter()")+AddButton("Agregar pol\u00edtica ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    Pol\u00edtica predeterminada
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1126,12 +1124,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="Hdr"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Agregar filtro de defensa del sistema","No se puede agregar el filtro, error #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Tr\u00e1fico Ethernet",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Todo el protocolo de Ethernet"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="Tr\u00e1fico IP",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Todo el protocolo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nombre",EscapeHtml(d.Name));n+=addHtmlValue("Tipo", -g);n+=addHtmlValue("Tr\u00e1fico a juego",a);n+=addHtmlValue("Direcci\u00f3n",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtrar"+a,g));n+=addHtmlValue("Evento en partido",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11, -"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Eliminar filtro","No se puede quitar el filtro, aseg\u00farese de que no est\u00e9 en uso."):PullSystemDefense()}var xxAddDefensePolicyFilters; +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="Tr\u00e1fico Ethernet",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Todo el protocolo de Ethernet"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="Tr\u00e1fico IP",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Todo el protocolo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nombre",EscapeHtml(d.Name));n+=addHtmlValue("Tipo", +g);n+=addHtmlValue("Tr\u00e1fico a juego",a);n+=addHtmlValue("Direcci\u00f3n",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtrar"+a,g));n+=addHtmlValue("Evento en partido",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11, +"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Eliminar filtro","No se puede quitar el filtro, aseg\u00farese de que no est\u00e9 en uso."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    Nombre
    TX / RX predeterminado
    ';b+= "
    ";if(0
    A\u00f1adir filtro
    "}setDialogMode(11,"Agregar pol\u00edtica de defensa del sistema",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())} @@ -1164,9 +1162,9 @@ function updateWifiDialog(){var b=!0,c=c25.value,a=c27.value;QV(66,4>c);QV(65,3< c28.value==c29.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 *CIM_Battery".split(" "),processHardware);amtFirstPull|=1} var DMTFCPUStatus="Desconocido;Habilitado;Deshabilitado por el usuario;Deshabilitado por BIOS (error POST);Ocioso;Otro".split(";"),DMTFMemType="Desconocido;Otro;DRACMA;DRAM sincr\u00f3nico;DRAM de cach\u00e9;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Destello;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Otro;Desconocido;SIMM;sorbo;Chip;INMERSI\u00d3N;ZIP;Tarjeta propietaria;DIMM;TSOP;Fila de papas fritas;RIMM;SODIMM;SRIMM;FB-DIM".split(";"), DMTFProcFamilly={191:"Procesador Intel® Core ™ 2 Duo",192:"Procesador Intel® Core ™ 2 Solo",193:"Procesador Intel® Core ™ 2 Extreme",194:"Procesador Intel® Core ™ 2 Quad",195:"Procesador m\u00f3vil Intel® Core ™ 2 Extreme",196:"Procesador m\u00f3vil Intel® Core ™ 2 Duo",197:"Procesador m\u00f3vil Intel® Core ™ 2 Solo",198:"Procesador Intel® Core ™ i7",199:"Procesador Intel® Celeron® de doble n\u00facleo"},HardwareInventory; -function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Salvar...","SaveHardwareLog()")+" La informaci\u00f3n de hardware se recopila en el momento del arranque del sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Plataforma

    "+FullTable({"Modelo de computadora":c.Model, +function processHardware(b,c,a,d){if(200==d){var g;b="
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Salvar...","SaveHardwareLog()")+" La informaci\u00f3n de hardware se recopila en el momento del arranque del sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Plataforma

    "+FullTable({"Modelo de computadora":c.Model, Fabricante:c.Manufacturer,"Versi\u00f3n":c.Version,"N\u00famero de serie":c.SerialNumber,"ID del sistema":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    Z\u00f3calo

    ";b+=FullTable({Fabricante:d.Manufacturer,"Nombre del producto":d.Model,"Versi\u00f3n":d.Version,"N\u00famero de serie":d.SerialNumber,"Etiqueta de propiedad":d.Tag,"\u00bfReemplazable?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({Vendedor:a.CIM_BIOSElement.response.Manufacturer, -"Versi\u00f3n":v,"Fecha de lanzamiento":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Procesador "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabricante:trademarks(d.Manufacturer),Familia:DMTFProcFamilly[c.Family],"Versi\u00f3n":trademarks(d.Version),"Velocidad m\u00e1xima del z\u00f3calo":c.MaxClockSpeed+" megahercio",Estado:DMTFCPUStatus[c.CPUStatus]}, +"Versi\u00f3n":u,"Fecha de lanzamiento":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Procesador "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabricante:trademarks(d.Manufacturer),Familia:DMTFProcFamilly[c.Family],"Versi\u00f3n":trademarks(d.Version),"Velocidad m\u00e1xima del z\u00f3calo":c.MaxClockSpeed+" megahercio",Estado:DMTFCPUStatus[c.CPUStatus]}, "");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

    M\u00f3dulo de memoria "+(+g+1)+"

    ",b+=FullTable({"Etiqueta del banco":c.BankLabel,Fabricante:c.Manufacturer,"N\u00famero de serie":c.SerialNumber,Talla:parseInt(c.Capacity/1048576)+" MEGABYTE","Factor de forma":DMTFMemFormFactor[c.FormFactor],Tipo:DMTFMemType[c.MemoryType],"Etiqueta de propiedad":c.Tag,"N\u00famero de pieza":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c= a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

    Medios de almacenamiento "+(parseInt(g)+1)+"

    ",b+=FullTable({Modelo:d.Model,"N\u00famero de serie":""==d.SerialNumber?"Unknown":d.SerialNumber,Talla:parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MEGABYTE"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+="

    Battery

    ", g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,Fabricante:c.Manufacturer,"Manufacture date":g,"N\u00famero de serie":c.SerialNumber,Tipo:"Otro;Desconocido;Lead Acid;Nickel Cadmium;Nickel Metal Hydride;Lithium-ion;Zinc air;Lithium Polymer".split(";")[a.CIM_Battery.response.Chemistry],"Design capacity":a.CIM_Battery.response.DesignCapacity+" mWatt-hours","Design voltage":a.CIM_Battery.response.DesignVoltage+" mVolts"},c.OtherIdentifyingInfo&& @@ -1176,18 +1174,18 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

    Administre las cuentas de usuario Intel® AMT para esta computadora.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== -v&&(n+="Discapacitado,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Reinos[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Auditor,");n=0<=a.Realms.indexOf(3)?n+"Administrador":1==l?n+"1 reino":n+(l+" reinos")}else n+="Administrador",a.Handle=-1;b+="
    ";0

    Administre las cuentas de usuario Intel® AMT para esta computadora.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== +u&&(n+="Discapacitado,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Reinos[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="Auditor,");n=0<=a.Realms.indexOf(3)?n+"Administrador":1==k?n+"1 reino":n+(k+" reinos")}else n+="Administrador",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("Nueva cuenta", "newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"Editar cuenta",-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,"Nueva cuenta",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Error de cuenta","Par\u00e1metros inv\u00e1lidos");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, -l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("Error de cuenta","Par\u00e1metros inv\u00e1lidos");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, +k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nombre",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Estado",1==xxAccountEnabledInfo[b].Enabled?"Habilitado":"Discapacitado"));if(g==xxAccountAdminName)a+=addHtmlValue("Permiso","Administrador");else{var a=a+addHtmlValue("Permiso",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v="Administrador", -0<=c.Realms.indexOf(20)&&(v+="Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("Cuenta"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nombre",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Estado",1==xxAccountEnabledInfo[b].Enabled?"Habilitado":"Discapacitado"));if(g==xxAccountAdminName)a+=addHtmlValue("Permiso","Administrador");else{var a=a+addHtmlValue("Permiso",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u="Administrador", +0<=c.Realms.indexOf(20)&&(u+="Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("Cuenta"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (Vac\u00edo)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    Error #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1235,10 +1233,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0, -70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0, +70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"Servidor":"")+"Sesi\u00f3n IDE-R , conectada,"+ider.m.bytesFromAmt+" en,"+ider.m.bytesToAmt+" fuera.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , los bloques son {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Disquete , los bloques son {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height= +function iderSectorStats(b,c,a,d,g){var u=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=u.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , los bloques son {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Disquete , los bloques son {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height= 6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Conexi\u00f3n peri\u00f3dica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Administre los servidores de administraci\u00f3n remota Intel® AMT.

    "; +"PolicyRuleName","Peri\u00f3dico");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format(", cada {0} segundos",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("Conexi\u00f3n peri\u00f3dica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Administre los servidores de administraci\u00f3n remota Intel® AMT.

    "; if(0==xxCiraServers.length)b+="

    No se encontraron servidores remotos.

    ";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    Administre los servidores proxy HTTP utilizados para las conexiones de administraci\u00f3n.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses, 0==c.length)b+="

    No hay proxies configurados.

    ";else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("Agregar servidor...","AddRemoteAccessServer()"),a&&(d+=AddButton("A\u00f1adir proxy ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+ d);QH(52,b)}}var xxEditMpsPolicyType; @@ -1296,9 +1294,9 @@ c+="

    Administre el almacenamiento Intel® AMT para esta computadora.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+ -" / "+p):g+"Ra\u00edz";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Descargar","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0== -q&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    No se encontraron archivos.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+ -(v?AddButton("Subir...","UploadToStorage()"):""));QH(55,a)}else QH(55,"No se pueden cargar los datos de almacenamiento ...
    "+AddButton("Actualizar","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Vendedor",b));""!=c&&(g+=addHtmlValue("Solicitud",c));g+=addHtmlValue("Nombre",a);g+=addHtmlValue("Talla",v.size+" bytes");v.link&&(g+=addHtmlValue("Enlace",v.link));setDialogMode(11,"Art\u00edculo de almacenamiento",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Administre el almacenamiento Intel® AMT para esta computadora.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+ +" / "+p):g+"Ra\u00edz";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Descargar","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0== +v&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    No se encontraron archivos.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+ +(u?AddButton("Subir...","UploadToStorage()"):""));QH(55,a)}else QH(55,"No se pueden cargar los datos de almacenamiento ...
    "+AddButton("Actualizar","PullStorage()"))} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Vendedor",b));""!=c&&(g+=addHtmlValue("Solicitud",c));g+=addHtmlValue("Nombre",a);g+=addHtmlValue("Talla",u.size+" bytes");u.link&&(g+=addHtmlValue("Enlace",u.link));setDialogMode(11,"Art\u00edculo de almacenamiento",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} function storageDeleteResponse(b,c){200!=c?messagebox("Almacenamiento",format("No se puede eliminar el archivo (ERR {0}), verifique que la computadora est\u00e9 encendida.",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","noopener,noreferrer");a.opener=null;a.focus()}}function PushToStorage(b,c,a){var d=null;7E3c[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";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+= -"Content-Encoding: gzip");a+="Content-Type: "+g+"";""!=v&&(a+=""+v+"");a+=""+b.target.result;PushToStorage(c,a)}function _fmtdatetime(b){return b.replace("T"," ").replace("Z","")} +function UploadToStorageEx2(b){var c;c=Q("mstoragevendor").value;var a=Q("mstorageapplication").value,d=Q("mstoragefilename").value;""==d&&(d="Filename");var g=Q("mstoragetype").value;""==g&&(g="application/octet-stream");var u=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="";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+= +"Content-Encoding: gzip");a+="Content-Type: "+g+"";""!=u&&(a+=""+u+"");a+=""+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"," dias").replace("H"," horas").replace("M"," minutos");b=b.replace(" 1 d\u00eda"," 1 d\u00eda").replace(" 1 hora"," 1 hora").replace(" 1 minuto "," 1 minuto ");return b.substring(0,b.length-1)}function _fmttimepad(b){for(b=""+b;2>b.length;)b="0"+b;return b}var xxAlarms=null; function PullAlarms(){var b=TableStart2()+"

    Gestionar alarmas de despertador.

    ";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,g){if(200==g){QV("go23",!0);if(0"+d[c].ElementName+", despertar en "+(new Date(d[c].StartTime.Datetime)).toLocaleString().replace(", "," a"),void 0!=d[c].Interval&&(a+=" y cada"+_fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&&(a+=", eliminar cuando haya terminado"), b+="
    ",xxAccountAdminName&&(b+=" "+AddButton2("Editar...",'showAddAlarm(" + i + ")')),b+="
    "+a+"
    ";else xxAlarms=null,b+="

    No hay alarmas de despertador registradas.

    ";d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Eliminar todas las alarmas","RemoveAllAlarms()")+ AddButton("A\u00f1adir","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"Eliminar todas las alarmas de activaci\u00f3n",3,RemoveAllAlarmsEx,"\u00bfConfirmar la eliminaci\u00f3n de todas las alarmas de activaci\u00f3n?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"Eliminar todas las alarmas de activaci\u00f3n",3,RemoveAllAlarmsEx,"\u00bfConfirmar la eliminaci\u00f3n de todas las alarmas de activaci\u00f3n?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"Agregar nueva alarma",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 Verifique que la alarma sea para un tiempo futuro.",d)):0!=c.Body.ReturnValue?messagebox("Agregar alarma",format("No se pudo agregar la alarma {0}.
    Verifique que la alarma sea para un tiempo futuro.", -c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Editar alarma",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Agregar alarma",format("No se pudo agregar la alarma. Estado: {0}.
    Verifique que la alarma sea para un tiempo futuro.",d)):0!=c.Body.ReturnValue?messagebox("Agregar alarma",format("No se pudo agregar la alarma {0}.
    Verifique que la alarma sea para un tiempo futuro.", +c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Editar alarma",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("Nombre",c.ElementName)+addHtmlValue("Hora de despertarse",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("Interno",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Despues de despertar",1==c.DeleteOnCompletion?"Eliminar alarma":"Mantener alarma")+"
    ";messagebox(format("Alarma {0}",c.ElementName),a);setDialogMode(11, -"Alarma"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +"Alarma"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"Okay",401:"Error de autenticaci\u00f3n",408:"Error de tiempo de espera",601:"Error de an\u00e1lisis de WSMAN",602:"No se puede analizar el encabezado de respuesta HTTP",603:"Respuesta inesperada de enumeraci\u00f3n HTTP",604:"Respuesta de extracci\u00f3n HTTP inesperada",997:"Reino de resumen inv\u00e1lido"}; +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"Okay",401:"Error de autenticaci\u00f3n",408:"Error de tiempo de espera",601:"Error de an\u00e1lisis de WSMAN",602:"No se puede analizar el encabezado de respuesta HTTP",603:"Respuesta inesperada de enumeraci\u00f3n HTTP",604:"Respuesta de extracci\u00f3n HTTP inesperada",997:"Reino de resumen inv\u00e1lido"}; 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,'Error de autenticaci\u00f3n

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Error de llamada",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Error de llamada",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""} function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Donn\u00e9es invalides";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", -r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Donn\u00e9es invalides";if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", +r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& 64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18== a&&170==c[0])return"Agent de surveillance"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... chang\u00e9 en"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Intrusion de cas";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"Une session Serial Over LAN distante a \u00e9t\u00e9 \u00e9tablie.";if(1==c[2])return"La session Serial Over LAN \u00e0 distance est termin\u00e9e. Le contr\u00f4le utilisateur a \u00e9t\u00e9 restaur\u00e9.";if(2==c[2])return"Une session IDE-Redirection distante a \u00e9t\u00e9 \u00e9tablie."; if(3==c[2])return"Session IDE-Redirection distante termin\u00e9e. Le contr\u00f4le utilisateur a \u00e9t\u00e9 restaur\u00e9."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="c\u00e2bl\u00e9"),4294967293==a?"Tous les filtres de paquets re\u00e7us ont \u00e9t\u00e9 mis en correspondance sur"+b+" interface.":4294967292==a?"Tous les filtres de paquets sortants ont \u00e9t\u00e9 mis en correspondance sur"+b+" interface.":4294967290==a?"Le filtre de paquets usurp\u00e9 a \u00e9t\u00e9 mis en correspondance sur"+ b+" interface.":"Filtre"+a+" a \u00e9t\u00e9 appari\u00e9 sur"+b+" interface.";if(192==a)return 0==c[2]?"Politique de s\u00e9curit\u00e9 invoqu\u00e9e. Une partie ou la totalit\u00e9 du trafic r\u00e9seau (TX) a \u00e9t\u00e9 arr\u00eat\u00e9e.":2==c[2]?"Politique de s\u00e9curit\u00e9 invoqu\u00e9e. Une partie ou la totalit\u00e9 du trafic r\u00e9seau (RX) a \u00e9t\u00e9 arr\u00eat\u00e9e.":"Politique de s\u00e9curit\u00e9 invoqu\u00e9e.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Demande de connexion \u00e0 distance par l'utilisateur."; if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"Erreur EAC: essayez d'obtenir la posture alors que NAC dans Intel\ufffd AMT est d\u00e9sactiv\u00e9.";if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Erreur HWA: erreur g\u00e9n\u00e9rale"}return 6==a?"Authentification \u00e9chou\u00e9e"+(c[1]+(c[2]<<8))+" fois. Le syst\u00e8me peut \u00eatre attaqu\u00e9.":30==a?"Pas de support de d\u00e9marrage":32==a?"Blocage du syst\u00e8me d'exploitation ou interruption d'alimentation":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.": -"\u00c9chec de d\u00e9marrage du syst\u00e8me":37==a?"Le microprogramme du syst\u00e8me a d\u00e9marr\u00e9 (au moins un processeur s\u2019ex\u00e9cute correctement).":"Type de capteur inconnu #"+a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0Local",h=5);3==b.InitiatorType&&(b.Initiator="Port par d\u00e9faut KVM",h=5);r=ReadInt(a,h); -b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"]; -e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a), -function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a, -b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountLocal",h=5);3==b.InitiatorType&&(b.Initiator="Port par d\u00e9faut KVM",h=5);r=ReadInt(a,h); +b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"]; +e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a), +function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a, +b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -121,8 +120,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -143,8 +142,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -154,12 +153,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="Non sp\u00e9cifi\u00e9. ; Aucune m\u00e9moire syst\u00e8me n'est physiquement install\u00e9e dans le syst\u00e8me. ; Aucune m\u00e9moire syst\u00e8me utilisable, toute la m\u00e9moire install\u00e9e a rencontr\u00e9 une d\u00e9faillance irr\u00e9cup\u00e9rable. ; D\u00e9faillance irr\u00e9cup\u00e9rable du disque dur / ATAPI / IDE. ; D\u00e9faillance irr\u00e9cup\u00e9rable de la carte syst\u00e8me. ; Disquette irr\u00e9cup\u00e9rable \u00e9chec du sous-syst\u00e8me. ; \u00c9chec du contr\u00f4leur de disque dur irr\u00e9cup\u00e9rable. ; \u00c9chec du clavier PS / 2 ou USB irr\u00e9cup\u00e9rable. ; Support de d\u00e9marrage amovible introuvable. ; \u00c9chec du contr\u00f4leur vid\u00e9o irr\u00e9cup\u00e9rable. ; Aucun p\u00e9riph\u00e9rique vid\u00e9o d\u00e9tect\u00e9. ; Corruption de la ROM du micrologiciel (BIOS) d\u00e9tect\u00e9e. ; Inad\u00e9quation de la tension du processeur (les processeurs qui partagent la m\u00eame alimentation ont des exigences de tension non adapt\u00e9es) ; \u00c9chec de correspondance de la vitesse du processeur".split(";"), +[a,b,[]])};var E="Non sp\u00e9cifi\u00e9. ; Aucune m\u00e9moire syst\u00e8me n'est physiquement install\u00e9e dans le syst\u00e8me. ; Aucune m\u00e9moire syst\u00e8me utilisable, toute la m\u00e9moire install\u00e9e a rencontr\u00e9 une d\u00e9faillance irr\u00e9cup\u00e9rable. ; D\u00e9faillance irr\u00e9cup\u00e9rable du disque dur / ATAPI / IDE. ; D\u00e9faillance irr\u00e9cup\u00e9rable de la carte syst\u00e8me. ; Disquette irr\u00e9cup\u00e9rable \u00e9chec du sous-syst\u00e8me. ; \u00c9chec du contr\u00f4leur de disque dur irr\u00e9cup\u00e9rable. ; \u00c9chec du clavier PS / 2 ou USB irr\u00e9cup\u00e9rable. ; Support de d\u00e9marrage amovible introuvable. ; \u00c9chec du contr\u00f4leur vid\u00e9o irr\u00e9cup\u00e9rable. ; Aucun p\u00e9riph\u00e9rique vid\u00e9o d\u00e9tect\u00e9. ; Corruption de la ROM du micrologiciel (BIOS) d\u00e9tect\u00e9e. ; Inad\u00e9quation de la tension du processeur (les processeurs qui partagent la m\u00eame alimentation ont des exigences de tension non adapt\u00e9es) ; \u00c9chec de correspondance de la vitesse du processeur".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="Non sp\u00e9cifi\u00e9 ; Autre ; Inconnu ; Processeur ; Disque ; P\u00e9riph\u00e9rique ; Module de gestion du syst\u00e8me ; Carte syst\u00e8me ; Module de m\u00e9moire ; Module processeur ; Alimentation \u00e9lectrique ; Ajouter dans la carte ; Carte du panneau avant ; Carte du panneau arri\u00e8re ; Carte du syst\u00e8me d'alimentation ; Fond de panier du lecteur ; Expansion interne du syst\u00e8me carte ; Autre carte syst\u00e8me ; Carte processeur ; Unit\u00e9 d'alimentation ; Module d'alimentation ; Carte de gestion de l'alimentation ; Carte du panneau arri\u00e8re du ch\u00e2ssis ; Ch\u00e2ssis syst\u00e8me ; Ch\u00e2ssis secondaire ; Autre carte de ch\u00e2ssis ; Baie d'unit\u00e9 de disque ; Baie p\u00e9riph\u00e9rique ; Baie de p\u00e9riph\u00e9rique ; Refroidissement par ventilateur ; Unit\u00e9 de refroidissement ; Interconnexion par c\u00e2ble ; P\u00e9riph\u00e9rique m\u00e9moire ; Logiciel de gestion du syst\u00e8me ; BIOS ; Intel (r) ME ; Bus syst\u00e8me ; Groupe ; Intel (r) ME ; Environnement externe ; Batterie ; Lame de traitement ; Commutateur de connectivit\u00e9 ; Processeur / module de m\u00e9moire ; Module d'E / S ; Module d'E / S du processeur ; Micrologiciel du contr\u00f4leur de gestion ; Canal IPMI ; Bus PCI ; Bus PCI express ; Bus SCSI ; Bus SATA / SAS ; Bus frontal du processeur".split(";"); +l="Non sp\u00e9cifi\u00e9 ; Autre ; Inconnu ; Processeur ; Disque ; P\u00e9riph\u00e9rique ; Module de gestion du syst\u00e8me ; Carte syst\u00e8me ; Module de m\u00e9moire ; Module processeur ; Alimentation \u00e9lectrique ; Ajouter dans la carte ; Carte du panneau avant ; Carte du panneau arri\u00e8re ; Carte du syst\u00e8me d'alimentation ; Fond de panier du lecteur ; Expansion interne du syst\u00e8me carte ; Autre carte syst\u00e8me ; Carte processeur ; Unit\u00e9 d'alimentation ; Module d'alimentation ; Carte de gestion de l'alimentation ; Carte du panneau arri\u00e8re du ch\u00e2ssis ; Ch\u00e2ssis syst\u00e8me ; Ch\u00e2ssis secondaire ; Autre carte de ch\u00e2ssis ; Baie d'unit\u00e9 de disque ; Baie p\u00e9riph\u00e9rique ; Baie de p\u00e9riph\u00e9rique ; Refroidissement par ventilateur ; Unit\u00e9 de refroidissement ; Interconnexion par c\u00e2ble ; P\u00e9riph\u00e9rique m\u00e9moire ; Logiciel de gestion du syst\u00e8me ; BIOS ; Intel (r) ME ; Bus syst\u00e8me ; Groupe ; Intel (r) ME ; Environnement externe ; Batterie ; Lame de traitement ; Commutateur de connectivit\u00e9 ; Processeur / module de m\u00e9moire ; Module d'E / S ; Module d'E / S du processeur ; Micrologiciel du contr\u00f4leur de gestion ; Canal IPMI ; Bus PCI ; Bus PCI express ; Bus SCSI ; Bus SATA / SAS ; Bus frontal du processeur".split(";"); e.RealmNames=";; Redirection ;; Asset Hardware ; Remote Control ; Storage ; Event Manager ; Storage Admin ; Agent Presence Local ; Agent Presence Remote ; Disjoncteur ; Time Network ; Information g\u00e9n\u00e9rale ; Firmware Update ; EIT ; LocalUN ; Endpoint Access Control ; Endpoint Access Control Admin ; Lecteur de journal des \u00e9v\u00e9nements ; Journal d'audit ; Domaine ACL ;;; Syst\u00e8me local".split(";");e.WatchdogCurrentStates={1:"Pas commenc\u00e9",2:"Arr\u00eat\u00e9",4:"Fonctionnement", -8:"Expir\u00e9",16:"Suspendu"};var h="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(";"),r=";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(";"),K={1:"",2:"HTTPS",4:"Local PBA", -8:"WinRE"},B={16:"Administrateur de la s\u00e9curit\u00e9",17:"RCO",18:"Gestionnaire de redirection",19:"Gestionnaire de mise \u00e0 jour du micrologiciel",20:"Journal d'audit de s\u00e9curit\u00e9",21:"Heure du r\u00e9seau",22:"L'administration du r\u00e9seau",23:"Administration du stockage",24:"Responsable de l'\u00e9v\u00e9nement",25:"Gestionnaire de disjoncteurs",26:"Gestionnaire de pr\u00e9sence d'agent",27:"Configuration sans fil",28:"EAC",29:"KVM",30:"\u00c9v\u00e9nements de participation des utilisateurs", +8:"Expir\u00e9",16:"Suspendu"};var h="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(";"),r=";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(";"),O={1:"",2:"HTTPS",4:"Local PBA", +8:"WinRE"},C={16:"Administrateur de la s\u00e9curit\u00e9",17:"RCO",18:"Gestionnaire de redirection",19:"Gestionnaire de mise \u00e0 jour du micrologiciel",20:"Journal d'audit de s\u00e9curit\u00e9",21:"Heure du r\u00e9seau",22:"L'administration du r\u00e9seau",23:"Administration du stockage",24:"Responsable de l'\u00e9v\u00e9nement",25:"Gestionnaire de disjoncteurs",26:"Gestionnaire de pr\u00e9sence d'agent",27:"Configuration sans fil",28:"EAC",29:"KVM",30:"\u00c9v\u00e9nements de participation des utilisateurs", 32:"Masquage d'\u00e9cran",33:"\u00c9v\u00e9nements de surveillance",1600:"Provisioning Started",1601:"Approvisionnement termin\u00e9",1602:"Entr\u00e9e ACL ajout\u00e9e",1603:"Entr\u00e9e ACL modifi\u00e9e",1604:"Entr\u00e9e ACL supprim\u00e9e",1605:"Acc\u00e8s ACL avec des informations d'identification non valides",1606:"\u00c9tat d'entr\u00e9e ACL",1607:"\u00c9tat TLS modifi\u00e9",1608:"Jeu de certificats du serveur TLS",1609:"Certificat de serveur TLS Supprimer",1610:"Certificat racine s\u00e9curis\u00e9 TLS ajout\u00e9", 1611:"Suppression du certificat racine de confiance TLS",1612:"Jeu de cl\u00e9s pr\u00e9partag\u00e9es TLS",1613:"Param\u00e8tres Kerberos modifi\u00e9s",1614:"Cl\u00e9 principale Kerberos modifi\u00e9e",1615:"R\u00e9initialisation des compteurs d'usure du flash",1616:"Groupe d'alimentation modifi\u00e9",1617:"D\u00e9finir le mode d'authentification du domaine",1618:"Mettre \u00e0 niveau le client en mode de contr\u00f4le administrateur",1619:"D\u00e9provisionnement d\u00e9marr\u00e9",1700:"Mise sous tension effectu\u00e9e", 1701:"Mise hors tension effectu\u00e9e",1702:"Cycle d'alimentation ex\u00e9cut\u00e9",1703:"R\u00e9initialisation effectu\u00e9e",1704:"D\u00e9finir les options de d\u00e9marrage",1705:"Remote graceful power down initiated",1706:"Remote graceful reset initiated",1707:"Remote Standby initiated",1708:"Remote Hiberate initiated",1709:"Remote NMI initiated",1800:"Ouverture de la session IDER",1801:"Session IDER ferm\u00e9e",1802:"IDER activ\u00e9",1803:"IDER d\u00e9sactiv\u00e9",1804:"Ouverture de la session SoL", @@ -170,18 +169,18 @@ e.RealmNames=";; Redirection ;; Asset Hardware ; Remote Control ; Storage ; Even 2804:"Options de configuration EAC",2900:"Activation KVM activ\u00e9e",2901:"Activation KVM d\u00e9sactiv\u00e9e",2902:"Mot de passe KVM modifi\u00e9",2903:"Consentement KVM r\u00e9ussi",2904:"\u00c9chec du consentement KVM",3E3:"Modification de la politique d'adh\u00e9sion",3001:"Envoyer un \u00e9v\u00e9nement de code de consentement",3002:"D\u00e9marrer l'\u00e9v\u00e9nement bloqu\u00e9 par opt-in",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"}; e.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["Acc\u00e8s ME invalide","Acc\u00e8s MEBx non valide"][b.charCodeAt(0)];if(1606==a){var c=["d\u00e9sactiv\u00e9","Activ\u00e9e"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"\u00c9loign\u00e9"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Local"+["NoAuth", "ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["NoAuth","Auth","d\u00e9sactiv\u00e9"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","MEI local","WSMAN local","WSAMN distant"][b.charCodeAt(0)]:1900==a?"De"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" \u00e0"+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?"De"+["Aucun","KVM","Tout"][b.charCodeAt(0)]+" \u00e0"+["Aucun","KVM","Tout"][b.charCodeAt(1)]:3001==a?["Succ\u00e8s","\u00c9chec 3 fois"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};return e}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))} +a?"De"+["Aucun","KVM","Tout"][b.charCodeAt(0)]+" \u00e0"+["Aucun","KVM","Tout"][b.charCodeAt(1)]:3001==a?["Succ\u00e8s","\u00c9chec 3 fois"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__namespace,d=a?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -250,27 +249,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -895,43 +893,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    Chargement...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -947,7 +945,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -965,28 +963,28 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Synchroniser l'horloge",3,syncClockEx,"Synchroniser l'horloge Intel AMT avec cet ordinateur?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Impossible de r\u00e9gler l'heure, \u00e9tat ="+d):0!=a.Body.ReturnValue?messagebox("","Impossible de r\u00e9gler l'heure, erreur: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})} var DMTFPowerStates=";;Allumer;Sommeil l\u00e9ger;Sommeil profond;Cycle d'alimentation (Soft off);Arr\u00eat - Difficile;Hibernation (Off soft);Arr\u00eat progressif;Cycle d'alimentation (hors tension);R\u00e9initialisation du bus principal;Interruption de diagnostic (NMI);N'est pas applicable;Off - doux gracieux;Off - Gracieux dur;R\u00e9initialisation du bus ma\u00eetre gracieuse;Cycle d'alimentation (Off - Soft graceful);Cycle d'alimentation (Off - Hard graceful);Interruption de diagnostic (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99Inconnue";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Aucun":EscapeHtml(c);d+=TableEntry("Nom et domaine",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? -d+=TableEntry("ID syst\u00e8me",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID syst\u00e8me",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5Inconnue";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Aucun":EscapeHtml(c);d+=TableEntry("Nom et domaine",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? +d+=TableEntry("ID syst\u00e8me",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID syst\u00e8me",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["Affichage principal","Affichage secondaire","3e affichage"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+=", Port 5900 activ\u00e9"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    ");QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" La modification des param\u00e8tres r\u00e9seau peut rendre cette page indisponible.");d=d+"

    r\u00e9glages g\u00e9n\u00e9raux

    "+TableStart(); -g="";"Aucun"!=c&&(1==v.SharedFQDN&&(g=", partag\u00e9 avec OS"),0==v.SharedFQDN&&(g=", diff\u00e9rent du syst\u00e8me d'exploitation"));d+=TableEntry("Nom et domaine",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="d\u00e9sactiv\u00e9";1==v.DDNSUpdateEnabled?c="Activ\u00e9 chacun"+v.DDNSPeriodicUpdateInterval+" minutes, TTL est"+v.DDNSTTL+" minutes":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Mise \u00e0 jour par serveur DHCP");d+=TableEntry("DNS dynamique",addLinkConditional(c, +g="";"Aucun"!=c&&(1==u.SharedFQDN&&(g=", partag\u00e9 avec OS"),0==u.SharedFQDN&&(g=", diff\u00e9rent du syst\u00e8me d'exploitation"));d+=TableEntry("Nom et domaine",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="d\u00e9sactiv\u00e9";1==u.DDNSUpdateEnabled?c="Activ\u00e9 chacun"+u.DDNSPeriodicUpdateInterval+" minutes, TTL est"+u.DDNSTTL+" minutes":1==u.DDNSUpdateByDHCPServerEnabled&&(c="Mise \u00e0 jour par serveur DHCP");d+=TableEntry("DNS dynamique",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+="

    "+(amtwirelessif==a?"Interface sans fil":"Interface filaire")+"

    ";d+=TableStart();d+=TableEntry("\u00c9tat du lien",1==c.LinkIsUp?"Le lien est en place":"Le lien est en panne");if(c.LinkPolicy){c.LinkPolicy= -MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Politique de lien",addLinkConditional(0==g.length?"Indisponible":"Disponible en: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Adresse Mac",c.MACAddress));amtwirelessif==a&&xxWireless&& +MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Politique de lien",addLinkConditional(0==g.length?"Indisponible":"Disponible en: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Adresse Mac",c.MACAddress));amtwirelessif==a&&xxWireless&& xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Etat",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("\u00c9tat de la radio",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"Aucun")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&& (d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?"Activ\u00e9e":"d\u00e9sactiv\u00e9","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing", -addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"Activ\u00e9e":"d\u00e9sactiv\u00e9","showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("R\u00e9pondre au ping",addLinkConditional(["d\u00e9sactiv\u00e9","R\u00e9ponse ICMP","R\u00e9ponse RMCP","R\u00e9ponse ICMP et RMCP"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)), +addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"Activ\u00e9e":"d\u00e9sactiv\u00e9","showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("R\u00e9pondre au ping",addLinkConditional(["d\u00e9sactiv\u00e9","R\u00e9ponse ICMP","R\u00e9ponse RMCP","R\u00e9ponse ICMP et RMCP"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)), g=1==c.DHCPEnabled?"Automatique \u00e0 l'aide du serveur DHCP":"Adresse IP statique",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("\u00c9tat IPv4",addLinkConditional(g,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("Adresse IPv4",isIpAddress(c.IPAddress,"Aucun"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("Passerelle / masque IPv4",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Aucun")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("Serveur de nom de domaine IPv4", -g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="

      EventTimeLa sourceLa description";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTimeLa sourceLa description";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"Effacer le journal des \u00e9v\u00e9nements?"),setDialogMode(1,"Journal des \u00e9v\u00e9nements",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Journal des \u00e9v\u00e9nements","Impossible d'effacer, erreur: "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("Temps",c.Time.toLocaleString());a+=addHtmlValue("La source",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("La description",c.Desc);a+=MoreStart();a+=addHtmlValue("Adresse de l'appareil",c.DeviceAddress);a+=addHtmlValue("Entit\u00e9",c.Entity);a+=addHtmlValue("Instance d'entit\u00e9",c.EntityInstance);var d="",g;for(g in c.EventData)0";messagebox(format("D\u00e9tails de l'\u00e9v\u00e9nement # {0}",b+1),a)}} @@ -1034,8 +1032,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"d\u00e9sactiv\u00e9":"Activ\u00e9e",c&2&&(b+=", Ferm\u00e9 \u00e0 cl\u00e9"),c&4&&(b+=", Presque plein"),c&8&&(b+=", Plein"),c&16&&(b+=", NoKey"),c="

    Param\u00e8tres du journal d'audit

    "+TableStart(),c+=TableEntry("Etat",b),c+=TableEntry("Espace de rangement",a[0].CurrentNumberOfRecords+" enregistrement (s),"+a[0].PercentageFree+"% gratuit"),c+=TableEntry("\u00c9craser la politique",2==a[0].OverwritePolicy?"S'enveloppe lorsqu'il est plein": "N'\u00e9crase jamais"),c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("Sauver...","SaveAuditLog()")+AddButton("Effacer le journal","ClearAuditLog()"))+"
    ");if(0==c.length)d="Aucun \u00e9v\u00e9nement de journal d'audit trouv\u00e9.";else{var g=0;d+="

      TempsInitiateurAction"; -for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit", -minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Journal d'audit Intel AMT",auditLog)} +for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0
      '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit", +minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Journal d'audit Intel AMT",auditLog)} function ClearAuditLog(b){QH(60,"Effacer le journal d'audit?");setDialogMode(1,"Journal d'audit",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("Journal d'audit","Erreur: "+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("Temps",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiateur",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Adresse",a.NetAddress));d+=addHtmlValue("Application",a.AuditApp);d+=addHtmlValue("un \u00e9v\u00e9nement",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Donn\u00e9es \u00e9tendues",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
    Certificat
    Security
    CN distants
    '; @@ -1087,8 +1085,8 @@ function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabi "PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Inconnue;Autre;Activ\u00e9e;d\u00e9sactiv\u00e9;\u00c9teindre;N'est pas applicable;Activ\u00e9 mais hors ligne;En test;Diff\u00e9r\u00e9;Au repos;D\u00e9part".split(";"),watchdogMonitoredEntity="Inconnue;Autre;Syst\u00e8me op\u00e9rateur;Processus de d\u00e9marrage du syst\u00e8me d'exploitation;Processus d'arr\u00eat du syst\u00e8me d'exploitation;Processus de d\u00e9marrage du micrologiciel;Processus de d\u00e9marrage du BIOS;Application;Processeur de service".split(";"); function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Nombre maximum",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" chiens de garde");b+=TableEntry("Nombre total maximum d'actions",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" Actions");b+=TableEnd()+"
    ";b+=TableStart2();b+="

    G\u00e9rez les chiens de garde de pr\u00e9sence d'agent Intel® AMT.

    ";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses|| 0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    Aucun chien de garde de pr\u00e9sence d'agent n'a \u00e9t\u00e9 trouv\u00e9.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+" → "+getWatchdogTransitionStr(v.NewState); -v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : \u00c9v\u00e9nement \u00e0 consigner")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Ajouter un chien de garde ...","AddWatchdog()"));b+="
    ";QH(54,b)}} +c+')>";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+" → "+getWatchdogTransitionStr(u.NewState); +u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : \u00c9v\u00e9nement \u00e0 consigner")}""!=d&&(b+="
    "+d+"
    ");b+=""}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Ajouter un chien de garde ...","AddWatchdog()"));b+="
    ";QH(54,b)}} function getWatchdogTransitionStr(b){if(31==b)return"N'importe quel \u00c9tat";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("La description",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Entit\u00e9 surveill\u00e9e",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("\u00c9tat actuel",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("\u00c9tat activ\u00e9",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Intervalle de d\u00e9marrage", b.StartupInterval+" seconde (s)");c+=addHtmlValue("Intervalle de temporisation",b.TimeoutInterval+" seconde (s)");setDialogMode(11,format("Chien de garde {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1110,12 +1108,12 @@ a}b+=TableStart();c="Aucun";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemDe if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
    Aucune politique de d\u00e9fense du syst\u00e8me trouv\u00e9e.

    ";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
    "+EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    G\u00e9rez les filtres de d\u00e9fense du syst\u00e8me Intel® AMT.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    Aucun filtre de d\u00e9fense du syst\u00e8me n'a \u00e9t\u00e9 trouv\u00e9.

    ";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a= xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="Protocole Ethernet"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" \u00e0"+a.FilterProfileData+" paquet / s"),1==a.ActionEventOnMatch&&(d+=", \u00c9v\u00e9nement sur match"),b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+ -"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Protocole Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" \u00e0"+a.FilterProfileData+" paquet / s");1==a.ActionEventOnMatch&&(d+=", \u00c9v\u00e9nement sur match");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Protocole Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" \u00e0"+a.FilterProfileData+" paquet / s");1==a.ActionEventOnMatch&&(d+=", \u00c9v\u00e9nement sur match");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Ajouter un filtre ...","AddDefenseFilter()")+AddButton("Ajouter une strat\u00e9gie ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    Politique par d\u00e9faut
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1128,12 +1126,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="Hdr"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Ajouter un filtre de d\u00e9fense du syst\u00e8me","Impossible d'ajouter le filtre, erreur #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Trafic Ethernet",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Protocole Ethernet"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="Trafic IP",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Tous les protocoles IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nom",EscapeHtml(d.Name));n+=addHtmlValue("Type",g);n+=addHtmlValue("Trafic correspondant", -a);n+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtre"+a,g));n+=addHtmlValue("\u00c9v\u00e9nement sur match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Filtre Ethernet #"+d.InstanceID, -5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Supprimer le filtre","Impossible de supprimer le filtre, assurez-vous qu'il n'est pas utilis\u00e9."):PullSystemDefense()}var xxAddDefensePolicyFilters; +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="Trafic Ethernet",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Protocole Ethernet"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="Trafic IP",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Tous les protocoles IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nom",EscapeHtml(d.Name));n+=addHtmlValue("Type",g);n+=addHtmlValue("Trafic correspondant", +a);n+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtre"+a,g));n+=addHtmlValue("\u00c9v\u00e9nement sur match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Filtre Ethernet #"+d.InstanceID, +5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Supprimer le filtre","Impossible de supprimer le filtre, assurez-vous qu'il n'est pas utilis\u00e9."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    Nom
    TX / RX par d\u00e9faut
    ';b+= "
    ";if(0
    Ajouter un filtre
    "}setDialogMode(11,"Ajouter une strat\u00e9gie de d\u00e9fense du syst\u00e8me",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}} @@ -1165,9 +1163,9 @@ function updateWifiDialog(){var b=!0,c=c25.value,a=c27.value;QV(66,4>c);QV(65,3< c28.value==c29.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 *CIM_Battery".split(" "),processHardware);amtFirstPull|=1} var DMTFCPUStatus="Inconnue;Activ\u00e9e;D\u00e9sactiv\u00e9 par l'utilisateur;D\u00e9sactiv\u00e9 par le BIOS (erreur POST);Tourner au ralenti;Autre".split(";"),DMTFMemType="Inconnue;Autre;DRACHME;DRAM synchrone;Cache DRAM;EDO;EDRAM;VRAM;SRAM;RAM;ROM;\u00c9clat;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Autre;Inconnue;SIMM;siroter;Puce;TREMPER;ZIP;Carte propri\u00e9taire;DIMM;TSOP;Rang\u00e9e de jetons;RIMM;SODIMM;SRIMM;FB-DIM".split(";"), DMTFProcFamilly={191:"Processeur Intel® Core ™ 2 Duo",192:"Processeur Intel® Core ™ 2 Solo",193:"Processeur Intel® Core ™ 2 Extreme",194:"Processeur Intel® Core ™ 2 Quad",195:"Processeur mobile Intel® Core ™ 2 Extreme",196:"Processeur mobile Intel® Core ™ 2 Duo",197:"Processeur mobile Intel® Core ™ 2 Solo",198:"Processeur Intel® Core ™ i7",199:"Processeur Intel® Celeron® double c\u0153ur"},HardwareInventory; -function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Sauver...","SaveHardwareLog()")+" Les informations sur le mat\u00e9riel sont collect\u00e9es au d\u00e9marrage du syst\u00e8me.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Plate-forme

    "+ +function processHardware(b,c,a,d){if(200==d){var g;b="
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Sauver...","SaveHardwareLog()")+" Les informations sur le mat\u00e9riel sont collect\u00e9es au d\u00e9marrage du syst\u00e8me.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Plate-forme

    "+ FullTable({"Mod\u00e8le informatique":c.Model,Fabricant:c.Manufacturer,Version:c.Version,"Num\u00e9ro de s\u00e9rie":c.SerialNumber,"ID syst\u00e8me":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    Plinthe

    ";b+=FullTable({Fabricant:d.Manufacturer,"Nom du produit":d.Model,Version:d.Version,"Num\u00e9ro de s\u00e9rie":d.SerialNumber,"\u00c9tiquette d'inventaire":d.Tag,"Rempla\u00e7able?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({Vendeur:a.CIM_BIOSElement.response.Manufacturer, -Version:v,"Date de sortie":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Processeur "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabricant:trademarks(d.Manufacturer),Famille:DMTFProcFamilly[c.Family],Version:trademarks(d.Version),"Vitesse de prise maximale":c.MaxClockSpeed+" MHz",Statut:DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c= +Version:u,"Date de sortie":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Processeur "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabricant:trademarks(d.Manufacturer),Famille:DMTFProcFamilly[c.Family],Version:trademarks(d.Version),"Vitesse de prise maximale":c.MaxClockSpeed+" MHz",Statut:DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c= a.CIM_PhysicalMemory.responses[g],b+="

    Module de m\u00e9moire "+(+g+1)+"

    ",b+=FullTable({"\u00c9tiquette de banque":c.BankLabel,Fabricant:c.Manufacturer,"Num\u00e9ro de s\u00e9rie":c.SerialNumber,Taille:parseInt(c.Capacity/1048576)+" MB","Facteur de forme":DMTFMemFormFactor[c.FormFactor],Type:DMTFMemType[c.MemoryType],"\u00c9tiquette d'inventaire":c.Tag,"Num\u00e9ro d'article":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+ 1],b+="

    Supports de stockage "+(parseInt(g)+1)+"

    ",b+=FullTable({"Mod\u00e8le":d.Model,"Num\u00e9ro de s\u00e9rie":""==d.SerialNumber?"Unknown":d.SerialNumber,Taille:parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+="

    Battery

    ",g=(new Date(c.ManufactureDate.Datetime)).toDateString(), a={"Device name":a.CIM_Battery.response.DeviceID,Fabricant:c.Manufacturer,"Manufacture date":g,"Num\u00e9ro de s\u00e9rie":c.SerialNumber,Type:"Autre;Inconnue;Lead Acid;Nickel Cadmium;Nickel Metal Hydride;Lithium-ion;Zinc air;Lithium Polymer".split(";")[a.CIM_Battery.response.Chemistry],"Design capacity":a.CIM_Battery.response.DesignCapacity+" mWatt-hours","Design voltage":a.CIM_Battery.response.DesignVoltage+" mVolts"},c.OtherIdentifyingInfo&&(a["Other Info"]=c.OtherIdentifyingInfo),b+=FullTable(a, @@ -1177,18 +1175,18 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

    G\u00e9rez les comptes d'utilisateurs Intel® AMT pour cet ordinateur.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!= -a.AccessPermission){2==v&&(n+="D\u00e9sactiv\u00e9,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Royaumes[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Auditeur,");n=0<=a.Realms.indexOf(3)?n+"Administrateur":1==l?n+"1 royaume":n+(l+" royaumes")}else n+="Administrateur",a.Handle=-1;b+="
    ";0

    G\u00e9rez les comptes d'utilisateurs Intel® AMT pour cet ordinateur.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!= +a.AccessPermission){2==u&&(n+="D\u00e9sactiv\u00e9,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Royaumes[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="Auditeur,");n=0<=a.Realms.indexOf(3)?n+"Administrateur":1==k?n+"1 royaume":n+(k+" royaumes")}else n+="Administrateur",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()"); xxAccountAdminName&&(c+=AddButton("Nouveau compte","newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"Modifier le compte",-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,"Nouveau compte",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Erreur de compte","Param\u00e8tres invalides");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, -l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("Erreur de compte","Param\u00e8tres invalides");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, +k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nom",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Etat",1==xxAccountEnabledInfo[b].Enabled?"Activ\u00e9e":"d\u00e9sactiv\u00e9"));if(g==xxAccountAdminName)a+=addHtmlValue("Autorisation","Administrateur");else{var a=a+addHtmlValue("Autorisation",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v= -"Administrateur",0<=c.Realms.indexOf(20)&&(v+=", Auditeur");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("Compte"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nom",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Etat",1==xxAccountEnabledInfo[b].Enabled?"Activ\u00e9e":"d\u00e9sactiv\u00e9"));if(g==xxAccountAdminName)a+=addHtmlValue("Autorisation","Administrateur");else{var a=a+addHtmlValue("Autorisation",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u= +"Administrateur",0<=c.Realms.indexOf(20)&&(u+=", Auditeur");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("Compte"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (Vide)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    Erreur #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1236,10 +1234,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0, -70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0, +70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"Serveur":"")+"Session IDE-R , Connect\u00e9,"+ider.m.bytesFromAmt+" dans,"+ider.m.bytesToAmt+" en dehors.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , les blocs font {0} octets.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Disquette , les blocs font {0} octets.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height= +function iderSectorStats(b,c,a,d,g){var u=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=u.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , les blocs font {0} octets.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Disquette , les blocs font {0} octets.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height= 6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Connexion p\u00e9riodique",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    G\u00e9rez les serveurs de gestion \u00e0 distance Intel® AMT.

    "; +"PolicyRuleName","P\u00e9riodique");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format(", chaque {0} seconde",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("Connexion p\u00e9riodique",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    G\u00e9rez les serveurs de gestion \u00e0 distance Intel® AMT.

    "; if(0==xxCiraServers.length)b+="

    Aucun serveur distant trouv\u00e9.

    ";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    G\u00e9rez les proxys HTTP utilis\u00e9s pour les connexions de gestion.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses, 0==c.length)b+="

    Aucun proxy configur\u00e9.

    ";else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("Ajouter un serveur ...","AddRemoteAccessServer()"),a&&(d+=AddButton("Ajouter un proxy ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+ d);QH(52,b)}}var xxEditMpsPolicyType; @@ -1297,9 +1295,9 @@ c+="

    G\u00e9rez le stockage Intel® AMT pour cet ordinateur.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+ -" / "+p):g+"Racine";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("T\u00e9l\u00e9charger","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" octets
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0== -q&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Aucun fichier trouv\u00e9.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+ -(v?AddButton("T\u00e9l\u00e9charger...","UploadToStorage()"):""));QH(55,a)}else QH(55,"Impossible de charger les donn\u00e9es de stockage ...
    "+AddButton("Rafra\u00eechir","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Vendeur",b));""!=c&&(g+=addHtmlValue("Application",c));g+=addHtmlValue("Nom",a);g+=addHtmlValue("Taille",v.size+" bytes");v.link&&(g+=addHtmlValue("Lien",v.link));setDialogMode(11,"Article de stockage",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    G\u00e9rez le stockage Intel® AMT pour cet ordinateur.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+ +" / "+p):g+"Racine";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("T\u00e9l\u00e9charger","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" octets
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0== +v&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Aucun fichier trouv\u00e9.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+ +(u?AddButton("T\u00e9l\u00e9charger...","UploadToStorage()"):""));QH(55,a)}else QH(55,"Impossible de charger les donn\u00e9es de stockage ...
    "+AddButton("Rafra\u00eechir","PullStorage()"))} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Vendeur",b));""!=c&&(g+=addHtmlValue("Application",c));g+=addHtmlValue("Nom",a);g+=addHtmlValue("Taille",u.size+" bytes");u.link&&(g+=addHtmlValue("Lien",u.link));setDialogMode(11,"Article de stockage",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} function storageDeleteResponse(b,c){200!=c?messagebox("Espace de rangement",format("Impossible de supprimer le fichier (ERR {0}), v\u00e9rifiez que l'ordinateur est sous tension.",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","noopener,noreferrer");a.opener=null;a.focus()}}function PushToStorage(b,c,a){var d=null;7E3c[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";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+= -"Content-Encoding: gzip");a+="Content-Type: "+g+"";""!=v&&(a+=""+v+"");a+=""+b.target.result;PushToStorage(c,a)}function _fmtdatetime(b){return b.replace("T"," ").replace("Z","")} +function UploadToStorageEx2(b){var c;c=Q("mstoragevendor").value;var a=Q("mstorageapplication").value,d=Q("mstoragefilename").value;""==d&&(d="Filename");var g=Q("mstoragetype").value;""==g&&(g="application/octet-stream");var u=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="";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+= +"Content-Encoding: gzip");a+="Content-Type: "+g+"";""!=u&&(a+=""+u+"");a+=""+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"," journ\u00e9es").replace("H"," heures").replace("M"," minutes");b=b.replace(" 1 jour"," Un jour").replace(" 1 heure"," 1 heure").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}var xxAlarms=null; function PullAlarms(){var b=TableStart2()+"

    G\u00e9rez les alarmes de r\u00e9veil.

    ";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,g){if(200==g){QV("go23",!0);if(0"+d[c].ElementName+", r\u00e9veiller sur "+(new Date(d[c].StartTime.Datetime)).toLocaleString().replace(", "," \u00e0"),void 0!=d[c].Interval&&(a+=" et chacun"+_fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&& (a+=", supprimer une fois termin\u00e9"),b+="
    ",xxAccountAdminName&&(b+=" "+AddButton2("\u00c9diter...",'showAddAlarm(" + i + ")')),b+="
    "+a+"
    ";else xxAlarms=null,b+="

    Aucune alarme de r\u00e9veil enregistr\u00e9e.

    ";d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Supprimer toutes les alarmes", "RemoveAllAlarms()")+AddButton("Ajouter","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"Supprimer toutes les alarmes de r\u00e9veil",3,RemoveAllAlarmsEx,"Confirmer la suppression de toutes les alarmes de r\u00e9veil?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"Supprimer toutes les alarmes de r\u00e9veil",3,RemoveAllAlarmsEx,"Confirmer la suppression de toutes les alarmes de r\u00e9veil?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"Ajouter une nouvelle alarme",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 V\u00e9rifiez que l'alarme est pour une heure future.",d)):0!=c.Body.ReturnValue?messagebox("Ajouter une alarme",format("\u00c9chec de l'ajout de l'alarme {0}.
    V\u00e9rifiez que l'alarme est pour une heure future.", -c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Modifier l'alarme",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Ajouter une alarme",format("Impossible d'ajouter l'alarme. Statut: {0}.
    V\u00e9rifiez que l'alarme est pour une heure future.",d)):0!=c.Body.ReturnValue?messagebox("Ajouter une alarme",format("\u00c9chec de l'ajout de l'alarme {0}.
    V\u00e9rifiez que l'alarme est pour une heure future.", +c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Modifier l'alarme",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("Nom",c.ElementName)+addHtmlValue("Heure de r\u00e9veil",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("Interne",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Apr\u00e8s le r\u00e9veil",1==c.DeleteOnCompletion?"Supprimer l'alarme":"Garder l'alarme")+"
    ";messagebox(format("Alarme {0}",c.ElementName),a);setDialogMode(11, -"Alarme"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +"Alarme"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"D'accord",401:"Erreur d'authentification",408:"Erreur de temporisation",601:"Erreur d'analyse WSMAN",602:"Impossible d'analyser l'en-t\u00eate de r\u00e9ponse HTTP",603:"R\u00e9ponse d'\u00e9num\u00e9ration HTTP inattendue",604:"R\u00e9ponse de pull HTTP inattendue",997:"Domaine de r\u00e9sum\u00e9 non valide"}; +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"D'accord",401:"Erreur d'authentification",408:"Erreur de temporisation",601:"Erreur d'analyse WSMAN",602:"Impossible d'analyser l'en-t\u00eate de r\u00e9ponse HTTP",603:"R\u00e9ponse d'\u00e9num\u00e9ration HTTP inattendue",604:"R\u00e9ponse de pull HTTP inattendue",997:"Domaine de r\u00e9sum\u00e9 non valide"}; 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("Erreur # {0}",b)),401==b&&QH(5,'Erreur d\'authentification

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Erreur d'appel",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Erreur d'appel",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""} function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Dati non validi";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", -r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Dati non validi";if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", +r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& 64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18== a&&170==c[0])return"Cane da guardia dell'agente"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... cambiato in"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Caso di intrusione";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"\u00c8 stata stabilita una sessione seriale su LAN remota.";if(1==c[2])return"Sessione remota su seriale via LAN terminata. Il controllo utente \u00e8 stato ripristinato.";if(2==c[2])return"\u00c8 stata stabilita una sessione di reindirizzamento IDE remoto."; if(3==c[2])return"Sessione di reindirizzamento IDE remoto terminata. Il controllo utente \u00e8 stato ripristinato."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="cablata"),4294967293==a?"Tutti i filtri di pacchetti ricevuti sono stati abbinati"+b+" interfaccia.":4294967292==a?"Tutto il filtro pacchetti in uscita \u00e8 stato associato"+b+" interfaccia.":4294967290==a?"Il filtro pacchetti contraffatto \u00e8 stato abbinato"+b+" interfaccia.":"Filtro"+a+" \u00e8 stato abbinato"+ b+" interfaccia.";if(192==a)return 0==c[2]?"Politica di sicurezza invocata. Parte o tutto il traffico di rete (TX) \u00e8 stato arrestato.":2==c[2]?"Politica di sicurezza invocata. Parte o tutto il traffico di rete (RX) \u00e8 stato arrestato.":"Politica di sicurezza invocata.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Richiesta dell'utente per la connessione remota.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"Errore EAC: tenta di ottenere la postura mentre NAC in Intel AMT \u00e8 disabilitato."; if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Errore HWA: errore generale"}return 6==a?"Autenticazione fallita"+(c[1]+(c[2]<<8))+" volte. Il sistema potrebbe essere sotto attacco.":30==a?"Nessun supporto di avvio":32==a?"Blocco del sistema operativo o interruzione dell'alimentazione":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"Errore di avvio del sistema":37==a?"Firmware di sistema avviato (almeno una CPU si sta eseguendo correttamente).":"Tipo di sensore sconosciuto #"+a} -function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0Locale",h=5);3==b.InitiatorType&&(b.Initiator="Porta predefinita KVM",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr= -e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2* -e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put= -function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml=function(a, -b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2* +e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put= +function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml=function(a, +b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -121,8 +120,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -143,8 +142,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -154,12 +153,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="Non specificato. ; Nessuna memoria di sistema fisicamente installata nel sistema. ; Nessuna memoria di sistema utilizzabile, tutta la memoria installata ha riscontrato un errore irreversibile. ; Errore irreversibile del disco fisso / ATAPI / IDE. ; Errore irreversibile della scheda di sistema. ; Dischetto irreversibile errore del sottosistema. ; Errore irreversibile del controller del disco fisso. ; Errore irreversibile della tastiera PS / 2 o USB. ; Supporto di avvio rimovibile non trovato. ; Errore irreversibile del controller video. ; Nessun dispositivo video rilevato. ; Corruzione del firmware (BIOS) ROM rilevata. ; Mancata corrispondenza della tensione della CPU (i processori che condividono la stessa alimentazione hanno requisiti di tensione non corrispondenti) ; Errore di corrispondenza della velocit\u00e0 della CPU".split(";"), +[a,b,[]])};var E="Non specificato. ; Nessuna memoria di sistema fisicamente installata nel sistema. ; Nessuna memoria di sistema utilizzabile, tutta la memoria installata ha riscontrato un errore irreversibile. ; Errore irreversibile del disco fisso / ATAPI / IDE. ; Errore irreversibile della scheda di sistema. ; Dischetto irreversibile errore del sottosistema. ; Errore irreversibile del controller del disco fisso. ; Errore irreversibile della tastiera PS / 2 o USB. ; Supporto di avvio rimovibile non trovato. ; Errore irreversibile del controller video. ; Nessun dispositivo video rilevato. ; Corruzione del firmware (BIOS) ROM rilevata. ; Mancata corrispondenza della tensione della CPU (i processori che condividono la stessa alimentazione hanno requisiti di tensione non corrispondenti) ; Errore di corrispondenza della velocit\u00e0 della CPU".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="Non specificato ; Altro ; Sconosciuto ; Processore ; Disco ; Periferiche ; Modulo di gestione del sistema ; Scheda di sistema ; Modulo di memoria ; Modulo del processore ; Alimentazione ; Scheda aggiuntiva ; Scheda del pannello anteriore ; Scheda del pannello posteriore ; Scheda del sistema di alimentazione ; Backplane dell'unit\u00e0 ; Espansione interna del sistema scheda ; Altre schede di sistema ; Scheda del processore ; Unit\u00e0 di potenza ; Modulo di potenza ; Scheda di gestione dell'alimentazione ; Scheda del pannello posteriore del telaio ; Telaio del sistema ; Sottotelaio ; Altre schede del telaio ; Alloggiamento unit\u00e0 disco ; Alloggiamento periferiche ; Alloggiamento dispositivo ; Ventola di raffreddamento ; Unit\u00e0 di raffreddamento ; Cavo di interconnessione ; Dispositivo di memoria ; Software di gestione del sistema ; BIOS ; Intel (r) ME ; Bus di sistema ; Gruppo ; Intel (r) ME ; Ambiente esterno ; Batteria ; Lama di elaborazione ; Interruttore di connettivit\u00e0 ; Modulo processore / memoria ; Modulo I / O ; Modulo I / O del processore ; Firmware del controller di gestione ; Canale IPMI ; Bus PCI ; Bus PCI express ; Bus SCSI ; Bus SATA / SAS ; Bus lato anteriore del processore".split(";"); +l="Non specificato ; Altro ; Sconosciuto ; Processore ; Disco ; Periferiche ; Modulo di gestione del sistema ; Scheda di sistema ; Modulo di memoria ; Modulo del processore ; Alimentazione ; Scheda aggiuntiva ; Scheda del pannello anteriore ; Scheda del pannello posteriore ; Scheda del sistema di alimentazione ; Backplane dell'unit\u00e0 ; Espansione interna del sistema scheda ; Altre schede di sistema ; Scheda del processore ; Unit\u00e0 di potenza ; Modulo di potenza ; Scheda di gestione dell'alimentazione ; Scheda del pannello posteriore del telaio ; Telaio del sistema ; Sottotelaio ; Altre schede del telaio ; Alloggiamento unit\u00e0 disco ; Alloggiamento periferiche ; Alloggiamento dispositivo ; Ventola di raffreddamento ; Unit\u00e0 di raffreddamento ; Cavo di interconnessione ; Dispositivo di memoria ; Software di gestione del sistema ; BIOS ; Intel (r) ME ; Bus di sistema ; Gruppo ; Intel (r) ME ; Ambiente esterno ; Batteria ; Lama di elaborazione ; Interruttore di connettivit\u00e0 ; Modulo processore / memoria ; Modulo I / O ; Modulo I / O del processore ; Firmware del controller di gestione ; Canale IPMI ; Bus PCI ; Bus PCI express ; Bus SCSI ; Bus SATA / SAS ; Bus lato anteriore del processore".split(";"); e.RealmNames=";; Reindirizzamento ;; Risorse hardware ; Telecomando ; Archiviazione ; Gestione eventi ; Amministratore archiviazione ; Presenza agente locale ; Presenza agente remoto ; Interruttore automatico ; Tempo di rete ; Informazioni generali ; Aggiornamento firmware ; EIT ; LocalUN ; Controllo accesso endpoint ; Controllo accesso endpoint Amministratore ; Lettore registro eventi ; Registro controllo ; Regno ACL ;;; Sistema locale".split(";");e.WatchdogCurrentStates={1:"Non iniziato",2:"Fermato", -4:"In esecuzione",8:"Scaduto",16:"Sospeso"};var h="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(";"),r=";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(";"),K={1:"", -2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Security Admin",17:"RCO",18:"Manager di reindirizzamento",19:"Firmware Update Manager",20:"Registro di controllo della sicurezza",21:"Tempo di rete",22:"Amministrazione di rete",23:"Amministrazione archiviazione",24:"Manager di eventi",25:"Responsabile dell'interruttore",26:"Manager di presenza agente",27:"Configurazione senza fili",28:"EAC",29:"KVM",30:"Eventi di attivazione dell'utente",32:"Oscuramento dello schermo",33:"Eventi del cane da guardia",1600:"Provisioning avviato", +4:"In esecuzione",8:"Scaduto",16:"Sospeso"};var h="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(";"),r=";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(";"),O={1:"", +2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"Security Admin",17:"RCO",18:"Manager di reindirizzamento",19:"Firmware Update Manager",20:"Registro di controllo della sicurezza",21:"Tempo di rete",22:"Amministrazione di rete",23:"Amministrazione archiviazione",24:"Manager di eventi",25:"Responsabile dell'interruttore",26:"Manager di presenza agente",27:"Configurazione senza fili",28:"EAC",29:"KVM",30:"Eventi di attivazione dell'utente",32:"Oscuramento dello schermo",33:"Eventi del cane da guardia",1600:"Provisioning avviato", 1601:"Provisioning completato",1602:"Voce ACL aggiunta",1603:"Voce ACL modificata",1604:"Voce ACL rimossa",1605:"Accesso ACL con credenziali non valide",1606:"Stato di ingresso ACL",1607:"Stato TLS modificato",1608:"Set di certificati server TLS",1609:"Rimuovi certificato server TLS",1610:"Aggiunto certificato radice attendibile TLS",1611:"Certificato radice radice TLS rimosso",1612:"Set chiavi precondivise TLS",1613:"Impostazioni Kerberos modificate",1614:"Chiave principale Kerberos modificata", 1615:"Ripristino contatori flash usurati",1616:"Pacchetto di alimentazione modificato",1617:"Imposta la modalit\u00e0 di autenticazione del realm",1618:"Aggiorna il client alla modalit\u00e0 di controllo amministratore",1619:"Annullamento del provisioning avviato",1700:"Accensione eseguita",1701:"Spegnimento eseguito",1702:"Ciclo di potenza eseguito",1703:"Ripristino eseguito",1704:"Imposta le opzioni di avvio",1705:"Remote graceful power down initiated",1706:"Remote graceful reset initiated",1707:"Remote Standby initiated", 1708:"Remote Hiberate initiated",1709:"Remote NMI initiated",1800:"Sessione IDER aperta",1801:"Sessione IDER chiusa",1802:"IDER abilitato",1803:"IDER disabilitato",1804:"Sessione SoL aperta",1805:"Sessione SoL chiusa",1806:"SoL abilitato",1807:"SoL disabilitato",1808:"Sessione KVM avviata",1809:"Sessione KVM terminata",1810:"KVM abilitato",1811:"KVM disabilitato",1812:"Password VNC non riuscita 3 volte",1900:"Firmware aggiornato",1901:"Aggiornamento firmware non riuscito",2E3:"Registro controllo sicurezza cancellato", @@ -169,17 +168,17 @@ e.RealmNames=";; Reindirizzamento ;; Risorse hardware ; Telecomando ; Archiviazi 2902:"Password KVM modificata",2903:"Consenso KVM riuscito",2904:"Consenso KVM non riuscito",3E3:"Modifica della politica di attivazione",3001:"Invia evento codice consenso",3002:"Avvia evento bloccato opt-in",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.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["Accesso ME non valido","Accesso MEBx non valido"][b.charCodeAt(0)];if(1606==a){var c=["Disabilitato","Abilitato"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"A distanza"+["noauth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Locale"+["noauth","ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["noauth","auth","Disabilitato"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","MEI locale", "WSMAN locale","WSAMN remoto"][b.charCodeAt(0)]:1900==a?"A partire dal"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" per"+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?"A partire dal"+["Nessuna","KVM","Tutti"][b.charCodeAt(0)]+" per"+["Nessuna","KVM","Tutti"][b.charCodeAt(1)]:3001==a?["Successo","Fallito 3 volte"][b.charCodeAt(0)]: -null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])};return e}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?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -248,27 +247,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -893,43 +891,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    Caricamento in corso...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -945,7 +943,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -963,28 +961,28 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Sincronizza orologio",3,syncClockEx,"Sincronizzare l'orologio Intel AMT con questo computer?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Impossibile impostare l'ora, status ="+d):0!=a.Body.ReturnValue?messagebox("","Impossibile impostare l'ora, errore: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})} var DMTFPowerStates=";;Accensione;Sonno leggero;Sonno profondo;Ciclo di accensione (soft off);Off - Difficile;Ibernazione (Off soft);Soft off;Ciclo di accensione (Off-hard);Ripristino del bus principale;Diagnostic interrupt (NMI);Non applicabile;Off - Morbido grazioso;Off - Hard aggraziato;Ripristino del bus principale aggraziato;Ciclo di accensione (Off - Soft aggraziato);Ciclo di accensione (Off - Hard Graceful);Interruzione diagnostica (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99Sconosciuto";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Nessuna":EscapeHtml(c);d+=TableEntry("Nome e dominio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? -d+=TableEntry("ID di sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID di sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5Sconosciuto";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Nessuna":EscapeHtml(c);d+=TableEntry("Nome e dominio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? +d+=TableEntry("ID di sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID di sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["Display principale","Display secondario","3 \u00b0 display"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+=", Porta 5900 abilitata"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    "); -QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" La modifica delle impostazioni di rete potrebbe rendere questa pagina non disponibile.");d=d+"

    impostazioni generali

    "+TableStart();g="";"Nessuna"!=c&&(1==v.SharedFQDN&&(g=", condiviso con il sistema operativo"),0==v.SharedFQDN&&(g=", diverso dal sistema operativo"));d+=TableEntry("Nome e dominio",addLinkConditional(c+ -g,"showEditNameDlg(1)",xxAccountAdminName));c="Disabilitato";1==v.DDNSUpdateEnabled?c="Abilitato ciascuno"+v.DDNSPeriodicUpdateInterval+" minuti, TTL \u00e8"+v.DDNSTTL+" minuti":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Aggiornamento dal server DHCP");d+=TableEntry("DNS dinamico",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+="

    "+(amtwirelessif==a?"Interfaccia wireless":"Interfaccia cablata")+"

    ";d+=TableStart();d+=TableEntry("Stato di collegamento",1==c.LinkIsUp?"Il collegamento \u00e8 attivo":"Il link non \u00e8 attivo");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&& +addLinkConditional(n,"showEnableBootServiceDlg()",xxAccountAdminName)));if(null!=AmtSystemPowerSchemes)for(var g=amtsysstate.CIM_ElementSettingData.responses,B=0;B
    "); +QH(15,d);d="
    "+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" La modifica delle impostazioni di rete potrebbe rendere questa pagina non disponibile.");d=d+"

    impostazioni generali

    "+TableStart();g="";"Nessuna"!=c&&(1==u.SharedFQDN&&(g=", condiviso con il sistema operativo"),0==u.SharedFQDN&&(g=", diverso dal sistema operativo"));d+=TableEntry("Nome e dominio",addLinkConditional(c+ +g,"showEditNameDlg(1)",xxAccountAdminName));c="Disabilitato";1==u.DDNSUpdateEnabled?c="Abilitato ciascuno"+u.DDNSPeriodicUpdateInterval+" minuti, TTL \u00e8"+u.DDNSTTL+" minuti":1==u.DDNSUpdateByDHCPServerEnabled&&(c="Aggiornamento dal server DHCP");d+=TableEntry("DNS dinamico",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+="

    "+(amtwirelessif==a?"Interfaccia wireless":"Interfaccia cablata")+"

    ";d+=TableStart();d+=TableEntry("Stato di collegamento",1==c.LinkIsUp?"Il collegamento \u00e8 attivo":"Il link non \u00e8 attivo");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&& g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Politica di collegamento",addLinkConditional(0==g.length?"Non disponibile":"Disponibili in: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Indirizzo MAC",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Stato",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)), s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Stato radio",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"Nessuna")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled? "Abilitato":"Disabilitato","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"Abilitato":"Disabilitato", -"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Rispondi al ping",addLinkConditional(["Disabilitato","Risposta ICMP","Risposta RMCP","Risposta ICMP e RMCP"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Automatico tramite server DHCP":"Indirizzo IP statico",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Stato IPv4",addLinkConditional(g, +"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Rispondi al ping",addLinkConditional(["Disabilitato","Risposta ICMP","Risposta RMCP","Risposta ICMP e RMCP"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Automatico tramite server DHCP":"Indirizzo IP statico",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Stato IPv4",addLinkConditional(g, "showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("Indirizzo IPv4",isIpAddress(c.IPAddress,"Nessuna"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("Gateway / maschera IPv4",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Nessuna")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("Server dei nomi di dominio IPv4",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="

      EventTimefonteDescrizione";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTimefonteDescrizione";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"Cancella registro eventi?"),setDialogMode(1,"Registro eventi",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Registro eventi","Impossibile cancellare, errore: "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("Tempo",c.Time.toLocaleString());a+=addHtmlValue("fonte",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Descrizione",c.Desc);a+=MoreStart();a+=addHtmlValue("Indirizzo dispositivo",c.DeviceAddress);a+=addHtmlValue("Entit\u00e0",c.Entity);a+=addHtmlValue("Istanza dell'entit\u00e0",c.EntityInstance);var d="",g;for(g in c.EventData)0";messagebox(format("Dettagli evento n. {0}",b+1),a)}} @@ -1032,8 +1030,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Disabilitato":"Abilitato",c&2&&(b+=", Bloccato"),c&4&&(b+=", Quasi pieno"),c&8&&(b+=", Pieno"),c&16&&(b+=", NoKey"),c="

    Impostazioni registro di controllo

    "+TableStart(),c+=TableEntry("Stato",b),c+=TableEntry("Conservazione",a[0].CurrentNumberOfRecords+" record (s),"+a[0].PercentageFree+"% gratuito"),c+=TableEntry("Sovrascrivi politica",2==a[0].OverwritePolicy?"Si avvolge quando \u00e8 pieno":"Non sovrascrive mai"), c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("Salva...","SaveAuditLog()")+AddButton("Pulisci il registro","ClearAuditLog()"))+"
    ");if(0==c.length)d="Nessun evento del registro di controllo trovato.";else{var g=0;d+="

      TempoIniziatoreAction"; -for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit", -minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Log di controllo Intel AMT",auditLog)} +for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0
      '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit", +minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Log di controllo Intel AMT",auditLog)} function ClearAuditLog(b){QH(60,"Cancella registro di controllo?");setDialogMode(1,"Registro di audizione",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("Registro di audizione","Errore: "+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("Tempo",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Iniziatore",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Indirizzo",a.NetAddress));d+=addHtmlValue("Applicazione",a.AuditApp);d+=addHtmlValue("Evento",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Dati estesi",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
    Certificato
    Security
    CN remoti
    ';setDialogMode(11,"Impostazioni TLS",3,showSetTlsSecurityDlgOk, @@ -1084,7 +1082,7 @@ function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabi "PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Sconosciuto;Altro;Abilitato;Disabilitato;Chiudere;Non applicabile;Abilitato ma offline;In prova;differite;quiesce;Di partenza".split(";"),watchdogMonitoredEntity="Sconosciuto;Altro;Sistema operativo;Processo di avvio del sistema operativo;Processo di spegnimento del sistema operativo;Processo di avvio del firmware;Processo di avvio del BIOS;Applicazione;Processore di servizio".split(";"); function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Numero massimo",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" cani da guardia");b+=TableEntry("Numero massimo di azioni totali",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" Azioni");b+=TableEnd()+"
    ";b+=TableStart2();b+="

    Gestisci i watchdog di presenza degli agenti Intel® AMT.

    ";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses|| 0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    Nessun watchdog di presenza agente trovato.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : Evento da registrare")}""!=d&&(b+="
    "+ +c+")>";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : Evento da registrare")}""!=d&&(b+="
    "+ d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Aggiungi watchdog ...","AddWatchdog()"));b+="
    ";QH(54,b)}}function getWatchdogTransitionStr(b){if(31==b)return"Qualsiasi stato";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("Descrizione",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Entit\u00e0 monitorata",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Stato attuale",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Stato abilitato",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Intervallo di avvio", b.StartupInterval+" secondo (s)");c+=addHtmlValue("Intervallo di timeout",b.TimeoutInterval+" secondo (s)");setDialogMode(11,format("Cane da guardia {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1106,12 +1104,12 @@ a}b+=TableStart();c="Nessuna";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystem if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
    Nessuna politica di difesa del sistema trovata.

    ";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
    "+ EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    Gestisci i filtri di difesa del sistema Intel® AMT.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    Nessun filtro di difesa del sistema trovato.

    ";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])|| (d="Tutto il protocollo Ethernet"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" a"+a.FilterProfileData+" pacchetto / sec"),1==a.ActionEventOnMatch&&(d+=", Evento in partita"),b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c]; -(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Tutto il protocollo Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" a"+a.FilterProfileData+" pacchetto / sec");1==a.ActionEventOnMatch&&(d+=", Evento in partita");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+ +(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="Tutto il protocollo Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" a"+a.FilterProfileData+" pacchetto / sec");1==a.ActionEventOnMatch&&(d+=", Evento in partita");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+ ", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Aggiungi filtro ...","AddDefenseFilter()")+AddButton("Aggiungi politica ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    Politica di default
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1124,12 +1122,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="Hdr"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Aggiungi filtro di difesa del sistema","Impossibile aggiungere il filtro, errore #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Ethernet Traffic",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Tutto il protocollo Ethernet"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="IP Traffic",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Tutto il protocollo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nome",EscapeHtml(d.Name));n+=addHtmlValue("genere", -g);n+=addHtmlValue("Traffico corrispondente",a);n+=addHtmlValue("Direzione",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtro"+a,g));n+=addHtmlValue("Evento in partita",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11, -"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Rimuovi filtro","Impossibile rimuovere il filtro, assicurarsi che non sia in uso."):PullSystemDefense()}var xxAddDefensePolicyFilters; +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="Ethernet Traffic",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Tutto il protocollo Ethernet"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="IP Traffic",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Tutto il protocollo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nome",EscapeHtml(d.Name));n+=addHtmlValue("genere", +g);n+=addHtmlValue("Traffico corrispondente",a);n+=addHtmlValue("Direzione",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtro"+a,g));n+=addHtmlValue("Evento in partita",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11, +"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Rimuovi filtro","Impossibile rimuovere il filtro, assicurarsi che non sia in uso."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    Nome
    TX / RX predefinito
    ';b+= "
    ";if(0
    Aggiungi filtro
    "}setDialogMode(11,"Aggiungi politica di difesa del sistema",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())} @@ -1160,8 +1158,8 @@ function updateWifiDialog(){var b=!0,c=c25.value,a=c27.value;QV(66,4>c);QV(65,3< c28.value==c29.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 *CIM_Battery".split(" "),processHardware);amtFirstPull|=1} var DMTFCPUStatus="Sconosciuto;Abilitato;Disabilitato dall'utente;Disabilitato dal BIOS (errore POST);Inattivo;Altro".split(";"),DMTFMemType="Sconosciuto;Altro;DRAM;DRAM sincrona;Cache DRAM;EDO;EDRAM;VRAM;SRAM;RAM;rom;Veloce;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Altro;Sconosciuto;SIMM;SORSO;Patata fritta;TUFFO;ZIP;Carta proprietaria;DIMM;TSOP;Fila di patatine;RIMM;SODIMM;SRIMM;FB-DIM".split(";"), DMTFProcFamilly={191:"Processore Intel® Core ™ 2 Duo",192:"Processore Intel® Core ™ 2 Solo",193:"Processore Intel® Core ™ 2 Extreme",194:"Processore Intel® Core ™ 2 Quad",195:"Processore mobile Intel® Core ™ 2 Extreme",196:"Processore mobile Intel® Core ™ 2 Duo",197:"Processore mobile Intel® Core ™ 2 Solo",198:"Processore Intel® Core ™ i7",199:"Processore Intel® Celeron® dual-core"},HardwareInventory; -function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Salva...","SaveHardwareLog()")+" Le informazioni sull'hardware vengono raccolte all'avvio del sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    piattaforma

    "+FullTable({"Modello di computer":c.Model, -fabbricante:c.Manufacturer,Versione:c.Version,"Numero di serie":c.SerialNumber,"ID di sistema":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    zoccolo

    ";b+=FullTable({fabbricante:d.Manufacturer,"Nome del prodotto":d.Model,Versione:d.Version,"Numero di serie":d.SerialNumber,"Etichetta delle risorse":d.Tag,"Sostituibile?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({venditore:a.CIM_BIOSElement.response.Manufacturer,Versione:v,"Data di rilascio":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", +function processHardware(b,c,a,d){if(200==d){var g;b="
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Salva...","SaveHardwareLog()")+" Le informazioni sull'hardware vengono raccolte all'avvio del sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    piattaforma

    "+FullTable({"Modello di computer":c.Model, +fabbricante:c.Manufacturer,Versione:c.Version,"Numero di serie":c.SerialNumber,"ID di sistema":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    zoccolo

    ";b+=FullTable({fabbricante:d.Manufacturer,"Nome del prodotto":d.Model,Versione:d.Version,"Numero di serie":d.SerialNumber,"Etichetta delle risorse":d.Tag,"Sostituibile?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({venditore:a.CIM_BIOSElement.response.Manufacturer,Versione:u,"Data di rilascio":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", {timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Processore "+(parseInt(g)+1)+"

    ",b+=FullTable({fabbricante:trademarks(d.Manufacturer),Famiglia:DMTFProcFamilly[c.Family],Versione:trademarks(d.Version),"Velocit\u00e0 massima della presa":c.MaxClockSpeed+" MHz",Stato:DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

    Modulo di memoria "+(+g+ 1)+"

    ",b+=FullTable({"Etichetta bancaria":c.BankLabel,fabbricante:c.Manufacturer,"Numero di serie":c.SerialNumber,Dimensione:parseInt(c.Capacity/1048576)+" MB","Fattore di forma":DMTFMemFormFactor[c.FormFactor],genere:DMTFMemType[c.MemoryType],"Etichetta delle risorse":c.Tag,"Numero parte":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

    Supporti di memorizzazione "+(parseInt(g)+1)+"

    ", b+=FullTable({Modello:d.Model,"Numero di serie":""==d.SerialNumber?"Unknown":d.SerialNumber,Dimensione:parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+="

    Battery

    ",g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,fabbricante:c.Manufacturer, @@ -1172,18 +1170,18 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

    Gestire gli account utente Intel® AMT per questo computer.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== -v&&(n+="Disabilitato,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Sindaco,");n=0<=a.Realms.indexOf(3)?n+"Amministratore":1==l?n+"1 regno":n+(l+" regni")}else n+="Amministratore",a.Handle=-1;b+="
    ";0

    Gestire gli account utente Intel® AMT per questo computer.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== +u&&(n+="Disabilitato,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="Sindaco,");n=0<=a.Realms.indexOf(3)?n+"Amministratore":1==k?n+"1 regno":n+(k+" regni")}else n+="Amministratore",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("Nuovo account", "newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"Modifica 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,"Nuovo account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Errore dell'account","Parametri non validi");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, -l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("Errore dell'account","Parametri non validi");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, +k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nome",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Stato",1==xxAccountEnabledInfo[b].Enabled?"Abilitato":"Disabilitato"));if(g==xxAccountAdminName)a+=addHtmlValue("Autorizzazione","Amministratore");else{var a=a+addHtmlValue("Autorizzazione",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v= -"Amministratore",0<=c.Realms.indexOf(20)&&(v+=", Revisore contabile");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("account"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nome",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Stato",1==xxAccountEnabledInfo[b].Enabled?"Abilitato":"Disabilitato"));if(g==xxAccountAdminName)a+=addHtmlValue("Autorizzazione","Amministratore");else{var a=a+addHtmlValue("Autorizzazione",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u= +"Amministratore",0<=c.Realms.indexOf(20)&&(u+=", Revisore contabile");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("account"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (Vuoto)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    Errore n."+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1231,10 +1229,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0, -70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0, +70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"server":"")+"Sessione IDE-R , connessa,"+ider.m.bytesFromAmt+" in,"+ider.m.bytesToAmt+" su.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , i blocchi sono {0} byte.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Floppy , i blocchi sono {0} byte.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height=6*(Math.floor(a/ +function iderSectorStats(b,c,a,d,g){var u=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=u.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , i blocchi sono {0} byte.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Floppy , i blocchi sono {0} byte.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height=6*(Math.floor(a/ (heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Connessione periodica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Gestire i server di gestione remota Intel® AMT.

    ";if(0==xxCiraServers.length)b+="

    Nessun server remoto trovato.

    "; +"periodico");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format(", ogni {0} secondi",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("Connessione periodica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Gestire i server di gestione remota Intel® AMT.

    ";if(0==xxCiraServers.length)b+="

    Nessun server remoto trovato.

    "; else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    Gestire i proxy HTTP utilizzati per le connessioni di gestione.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="

    Nessun proxy configurato.

    ";else for(d in c)b+= "
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("Aggiungi server...","AddRemoteAccessServer()"),a&&(d+=AddButton("Aggiungi proxy ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(52,b)}}var xxEditMpsPolicyType; function editMpsPolicy(b){var c="",a=11"); 1==b?QH(63,c):setDialogMode(11,"Rilevamento dell'ambiente",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)}} @@ -1358,7 +1356,7 @@ rsepass=1,setDialogMode(11,"Azioni di potere",3,powerActionDlg,b)):106==b||107== function powerActionDlgRPE(b){var c;c="Confirm execution of Intel® Remote Platform Erase?

    ATTENZIONE: Questo canceller\u00e0 i dati sul sistema remoto.
    ";var a=[],d=amtPowerBootCapabilities.PlatformErase;d&4&&a.push("");d&64&&a.push("");d&33554432&&a.push(""); d&67108864&&a.push("");d&-2147483648&&a.push("");1Select the actions to take:

    {0}

    ",a.join("
    ")));c+="";setDialogMode(11,"Azioni di potere",3,powerActionDlgRPEEx,c,b);QE("c54",!1)}function powerActionDlgRPEValidate(){var b=0,c=amtPowerBootCapabilities.PlatformErase,a=[2,6,25,26,31],d;for(d in a)c&1<b&&2amtversion&&(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("c39").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); @@ -1391,12 +1389,12 @@ targetPowerAction=b;11==b&&(b=10);999>b?(console.log("RequestPowerStateChange("+ function powerActionResponse5(b,c,a,d){}function consentChanged(){QE("c54",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",2c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(D){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Gestisci lo storage Intel® AMT per questo computer.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+ -p):g+"Radice";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Scarica","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" byte
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("", -function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Nessun file trovato.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("Caricare...","UploadToStorage()"): +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Gestisci lo storage Intel® AMT per questo computer.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+ +p):g+"Radice";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Scarica","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" byte
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==v&&(wsstack.comm.PerformAjax("", +function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Nessun file trovato.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(u?AddButton("Caricare...","UploadToStorage()"): ""));QH(55,a)}else QH(55,"Impossibile caricare i dati di archiviazione ...
    "+AddButton("ricaricare","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("venditore",b));""!=c&&(g+=addHtmlValue("Applicazione",c));g+=addHtmlValue("Nome",a);g+=addHtmlValue("Dimensione",v.size+" bytes");v.link&&(g+=addHtmlValue("collegamento",v.link));setDialogMode(11,"Articolo di archiviazione",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("venditore",b));""!=c&&(g+=addHtmlValue("Applicazione",c));g+=addHtmlValue("Nome",a);g+=addHtmlValue("Dimensione",u.size+" bytes");u.link&&(g+=addHtmlValue("collegamento",u.link));setDialogMode(11,"Articolo di archiviazione",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} function storageDeleteResponse(b,c){200!=c?messagebox("Conservazione",format("Impossibile eliminare il file (ERR {0}), verificare che il computer sia acceso.",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","noopener,noreferrer");a.opener=null;a.focus()}}function PushToStorage(b,c,a){var d=null;7E3";else xxAlarms=null,b+="

    Nessun allarme di sveglia registrato.

    ";d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Rimuovi tutti gli allarmi","RemoveAllAlarms()")+AddButton("Inserisci", "showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"Rimuovi tutti gli allarmi di riattivazione",3,RemoveAllAlarmsEx,"Conferma la rimozione di tutti gli allarmi di riattivazione?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"Rimuovi tutti gli allarmi di riattivazione",3,RemoveAllAlarmsEx,"Conferma la rimozione di tutti gli allarmi di riattivazione?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"Aggiungi nuova sveglia",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 Verifica che l'allarme sia per un momento futuro.",d)):0!=c.Body.ReturnValue?messagebox("Aggiungi allarme",format("Impossibile aggiungere la sveglia {0}.
    Verifica che la sveglia sia per un momento futuro.", -c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Modifica sveglia",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Aggiungi allarme",format("Impossibile aggiungere l'allarme. Stato: {0}.
    Verifica che l'allarme sia per un momento futuro.",d)):0!=c.Body.ReturnValue?messagebox("Aggiungi allarme",format("Impossibile aggiungere la sveglia {0}.
    Verifica che la sveglia sia per un momento futuro.", +c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Modifica sveglia",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("Nome",c.ElementName)+addHtmlValue("Tempo di sveglia",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("Interno",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Dopo la veglia",1==c.DeleteOnCompletion?"Elimina allarme":"Mantieni allarme")+"
    ";messagebox(format("Allarme {0}",c.ElementName),a);setDialogMode(11,"Allarme"+ -c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"ok",401:"Errore di autenticazione",408:"Errore di timeout",601:"Errore di analisi WSMAN",602:"Impossibile analizzare l'intestazione della risposta HTTP",603:"Risposta enum HTTP inattesa",604:"Risposta pull HTTP inaspettata",997:"Digest Realm non valido"}; +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"ok",401:"Errore di autenticazione",408:"Errore di timeout",601:"Errore di analisi WSMAN",602:"Impossibile analizzare l'intestazione della risposta HTTP",603:"Risposta enum HTTP inattesa",604:"Risposta pull HTTP inaspettata",997:"Digest Realm non valido"}; 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("Errore # {0}",b)),401==b&&QH(5,'Errore di autenticazione

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Errore di chiamata",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Errore di chiamata",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""} function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"\u7121\u52b9\u306a\u30c7\u30fc\u30bf";if(0==b)return D[c[1]];if(3==b){if(170== -c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}", +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"\u7121\u52b9\u306a\u30c7\u30fc\u30bf";if(0==b)return E[c[1]];if(3==b){if(170== +c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}", c[2]);if(170==c[0]&&64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters"; if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18==a&&170==c[0])return"\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... \u306b\u5909\u308f\u3063\u305f"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"\u30b1\u30fc\u30b9\u4fb5\u5165";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"\u30ea\u30e2\u30fc\u30c8\u30b7\u30ea\u30a2\u30eb\u30aa\u30fc\u30d0\u30fcLAN\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u78ba\u7acb\u3055\u308c\u307e\u3057\u305f\u3002"; if(1==c[2])return"\u30ea\u30e2\u30fc\u30c8\u30b7\u30ea\u30a2\u30eb\u30aa\u30fc\u30d0\u30fcLAN\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002\u30e6\u30fc\u30b6\u30fc\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u304c\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002";if(2==c[2])return"\u30ea\u30e2\u30fc\u30c8IDE\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u78ba\u7acb\u3055\u308c\u307e\u3057\u305f\u3002";if(3==c[2])return"\u30ea\u30e2\u30fc\u30c8IDE\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002\u30e6\u30fc\u30b6\u30fc\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u304c\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002"}if(36== @@ -98,23 +97,23 @@ a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="\u6709 2==c[2]?"\u547c\u3073\u51fa\u3055\u308c\u305f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30dd\u30ea\u30b7\u30fc\u3002\u4e00\u90e8\u307e\u305f\u306f\u3059\u3079\u3066\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\uff08RX\uff09\u304c\u505c\u6b62\u3057\u307e\u3057\u305f\u3002":"\u547c\u3073\u51fa\u3055\u308c\u305f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30dd\u30ea\u30b7\u30fc\u3002";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"\u30ea\u30e2\u30fc\u30c8\u63a5\u7d9a\u306e\u30e6\u30fc\u30b6\u30fc\u8981\u6c42\u3002"; if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC\u30a8\u30e9\u30fc\uff1aIntel AMT\u306eNAC\u304c\u7121\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u30dd\u30b9\u30c1\u30e3\u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002";if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA\u30a8\u30e9\u30fc\uff1a\u4e00\u822c\u7684\u306a\u30a8\u30e9\u30fc"}return 6==a?"\u8a8d\u8a3c\u306b\u5931\u6557\u3057\u307e\u3057\u305f"+(c[1]+(c[2]<<8))+" \u56de\u3002\u30b7\u30b9\u30c6\u30e0\u304c\u653b\u6483\u3092\u53d7\u3051\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002": 30==a?"\u30d6\u30fc\u30bf\u30d6\u30eb\u30e1\u30c7\u30a3\u30a2\u306a\u3057":32==a?"\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306e\u30ed\u30c3\u30af\u30a2\u30c3\u30d7\u307e\u305f\u306f\u96fb\u6e90\u306e\u4e2d\u65ad":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"\u30b7\u30b9\u30c6\u30e0\u306e\u8d77\u52d5\u5931\u6557":37==a?"\u30b7\u30b9\u30c6\u30e0\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u304c\u8d77\u52d5\u3057\u307e\u3057\u305f\uff08\u5c11\u306a\u304f\u3068\u30821\u3064\u306eCPU\u304c\u6b63\u3057\u304f\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u3059\uff09\u3002": -"\u4e0d\u660e\u306a\u30bb\u30f3\u30b5\u30fc\u30bf\u30a4\u30d7\uff03"+a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0\u5730\u5143",h=5);3==b.InitiatorType&&(b.Initiator="KVM\u30c7\u30d5\u30a9\u30eb\u30c8\u30dd\u30fc\u30c8",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++); -r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0; -e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)}, -0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a), -b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0; +e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)}, +0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a), +b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -124,8 +123,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -146,8 +145,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -157,12 +156,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="Unspecified\u3002;\u30b7\u30b9\u30c6\u30e0\u306b\u30b7\u30b9\u30c6\u30e0\u30e1\u30e2\u30ea\u304c\u7269\u7406\u7684\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002;\u4f7f\u7528\u53ef\u80fd\u306a\u30b7\u30b9\u30c6\u30e0\u30e1\u30e2\u30ea\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30e1\u30e2\u30ea\u306b\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002;\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30cf\u30fc\u30c9\u30c7\u30a3\u30b9\u30af/ ATAPI / IDE\u30c7\u30d0\u30a4\u30b9\u306e\u30a8\u30e9\u30fc\u3002;\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9\u306e\u30a8\u30e9\u30fc\u3002;\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30c7\u30a3\u30b9\u30b1\u30c3\u30c8\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0\u969c\u5bb3\u3002;\u56de\u5fa9\u4e0d\u80fd\u306a\u30cf\u30fc\u30c9\u30c7\u30a3\u30b9\u30af\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u969c\u5bb3\u3002;\u56de\u5fa9\u4e0d\u80fd\u306aPS / 2\u307e\u305f\u306fUSB\u30ad\u30fc\u30dc\u30fc\u30c9\u969c\u5bb3\u3002;\u30ea\u30e0\u30fc\u30d0\u30d6\u30eb\u30d6\u30fc\u30c8\u30e1\u30c7\u30a3\u30a2\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002;\u56de\u5fa9\u4e0d\u80fd\u306a\u30d3\u30c7\u30aa\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u969c\u5bb3\u3002;\u30d3\u30c7\u30aa\u30c7\u30d0\u30a4\u30b9\u304c\u691c\u51fa\u3055\u308c\u307e\u305b\u3093\u3002;\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\uff08BIOS\uff09ROM\u7834\u640d\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002; CPU\u96fb\u5727\u306e\u4e0d\u4e00\u81f4\uff08\u540c\u3058\u96fb\u6e90\u3092\u5171\u6709\u3059\u308b\u30d7\u30ed\u30bb\u30c3\u30b5\u30fc\u306e\u96fb\u5727\u8981\u4ef6\u304c\u4e00\u81f4\u3057\u3066\u3044\u307e\u305b\u3093\uff09; CPU\u901f\u5ea6\u306e\u4e00\u81f4\u306e\u5931\u6557".split(";"), +[a,b,[]])};var E="Unspecified\u3002;\u30b7\u30b9\u30c6\u30e0\u306b\u30b7\u30b9\u30c6\u30e0\u30e1\u30e2\u30ea\u304c\u7269\u7406\u7684\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002;\u4f7f\u7528\u53ef\u80fd\u306a\u30b7\u30b9\u30c6\u30e0\u30e1\u30e2\u30ea\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30e1\u30e2\u30ea\u306b\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002;\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30cf\u30fc\u30c9\u30c7\u30a3\u30b9\u30af/ ATAPI / IDE\u30c7\u30d0\u30a4\u30b9\u306e\u30a8\u30e9\u30fc\u3002;\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9\u306e\u30a8\u30e9\u30fc\u3002;\u56de\u5fa9\u4e0d\u53ef\u80fd\u306a\u30c7\u30a3\u30b9\u30b1\u30c3\u30c8\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0\u969c\u5bb3\u3002;\u56de\u5fa9\u4e0d\u80fd\u306a\u30cf\u30fc\u30c9\u30c7\u30a3\u30b9\u30af\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u969c\u5bb3\u3002;\u56de\u5fa9\u4e0d\u80fd\u306aPS / 2\u307e\u305f\u306fUSB\u30ad\u30fc\u30dc\u30fc\u30c9\u969c\u5bb3\u3002;\u30ea\u30e0\u30fc\u30d0\u30d6\u30eb\u30d6\u30fc\u30c8\u30e1\u30c7\u30a3\u30a2\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002;\u56de\u5fa9\u4e0d\u80fd\u306a\u30d3\u30c7\u30aa\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u969c\u5bb3\u3002;\u30d3\u30c7\u30aa\u30c7\u30d0\u30a4\u30b9\u304c\u691c\u51fa\u3055\u308c\u307e\u305b\u3093\u3002;\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\uff08BIOS\uff09ROM\u7834\u640d\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002; CPU\u96fb\u5727\u306e\u4e0d\u4e00\u81f4\uff08\u540c\u3058\u96fb\u6e90\u3092\u5171\u6709\u3059\u308b\u30d7\u30ed\u30bb\u30c3\u30b5\u30fc\u306e\u96fb\u5727\u8981\u4ef6\u304c\u4e00\u81f4\u3057\u3066\u3044\u307e\u305b\u3093\uff09; CPU\u901f\u5ea6\u306e\u4e00\u81f4\u306e\u5931\u6557".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="\u672a\u6307\u5b9a;\u305d\u306e\u4ed6;\u4e0d\u660e;\u30d7\u30ed\u30bb\u30c3\u30b5;\u30c7\u30a3\u30b9\u30af;\u5468\u8fba\u6a5f\u5668;\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u30e2\u30b8\u30e5\u30fc\u30eb;\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9;\u30e1\u30e2\u30ea\u30e2\u30b8\u30e5\u30fc\u30eb;\u30d7\u30ed\u30bb\u30c3\u30b5\u30e2\u30b8\u30e5\u30fc\u30eb;\u96fb\u6e90\u88c5\u7f6e;\u30ab\u30fc\u30c9\u306b\u8ffd\u52a0;\u30d5\u30ed\u30f3\u30c8\u30d1\u30cd\u30eb\u30dc\u30fc\u30c9;\u30d0\u30c3\u30af\u30d1\u30cd\u30eb\u30dc\u30fc\u30c9;\u96fb\u6e90\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9;\u30c9\u30e9\u30a4\u30d6\u30d0\u30c3\u30af\u30d7\u30ec\u30fc\u30f3;\u30b7\u30b9\u30c6\u30e0\u5185\u90e8\u62e1\u5f35\u30dc\u30fc\u30c9;\u305d\u306e\u4ed6\u306e\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9;\u30d7\u30ed\u30bb\u30c3\u30b5\u30dc\u30fc\u30c9;\u96fb\u6e90\u30e6\u30cb\u30c3\u30c8;\u96fb\u6e90\u30e2\u30b8\u30e5\u30fc\u30eb;\u96fb\u6e90\u7ba1\u7406\u30dc\u30fc\u30c9;\u30b7\u30e3\u30fc\u30b7\u30d0\u30c3\u30af\u30d1\u30cd\u30eb\u30dc\u30fc\u30c9;\u30b7\u30b9\u30c6\u30e0\u30b7\u30e3\u30fc\u30b7;\u30b5\u30d6\u30b7\u30e3\u30fc\u30b7;\u305d\u306e\u4ed6\u306e\u30b7\u30e3\u30fc\u30b7\u30dc\u30fc\u30c9;\u30c7\u30a3\u30b9\u30af\u30d9\u30a4;\u5468\u8fba\u6a5f\u5668\u30d9\u30a4;\u30c7\u30d0\u30a4\u30b9\u30d9\u30a4;\u30d5\u30a1\u30f3\u51b7\u5374;\u51b7\u5374\u30e6\u30cb\u30c3\u30c8;\u30b1\u30fc\u30d6\u30eb\u76f8\u4e92\u63a5\u7d9a;\u30e1\u30e2\u30ea\u30c7\u30d0\u30a4\u30b9;\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2; BIOS ; Intel\uff08r\uff09ME ;\u30b7\u30b9\u30c6\u30e0\u30d0\u30b9;\u30b0\u30eb\u30fc\u30d7; Intel\uff08r\uff09ME ;\u5916\u90e8\u74b0\u5883;\u30d0\u30c3\u30c6\u30ea\u30fc;\u51e6\u7406\u30d6\u30ec\u30fc\u30c9;\u63a5\u7d9a\u30b9\u30a4\u30c3\u30c1;\u30d7\u30ed\u30bb\u30c3\u30b5/\u30e1\u30e2\u30ea\u30e2\u30b8\u30e5\u30fc\u30eb; I / O\u30e2\u30b8\u30e5\u30fc\u30eb;\u30d7\u30ed\u30bb\u30c3\u30b5I / O\u30e2\u30b8\u30e5\u30fc\u30eb;\u7ba1\u7406\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2; IPMI\u30c1\u30e3\u30cd\u30eb; PCI\u30d0\u30b9; PCI\u30a8\u30af\u30b9\u30d7\u30ec\u30b9\u30d0\u30b9; SCSI\u30d0\u30b9; SATA / SAS\u30d0\u30b9;\u30d7\u30ed\u30bb\u30c3\u30b5\u30d5\u200b\u200b\u30ed\u30f3\u30c8\u30b5\u30a4\u30c9\u30d0\u30b9".split(";"); +l="\u672a\u6307\u5b9a;\u305d\u306e\u4ed6;\u4e0d\u660e;\u30d7\u30ed\u30bb\u30c3\u30b5;\u30c7\u30a3\u30b9\u30af;\u5468\u8fba\u6a5f\u5668;\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u30e2\u30b8\u30e5\u30fc\u30eb;\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9;\u30e1\u30e2\u30ea\u30e2\u30b8\u30e5\u30fc\u30eb;\u30d7\u30ed\u30bb\u30c3\u30b5\u30e2\u30b8\u30e5\u30fc\u30eb;\u96fb\u6e90\u88c5\u7f6e;\u30ab\u30fc\u30c9\u306b\u8ffd\u52a0;\u30d5\u30ed\u30f3\u30c8\u30d1\u30cd\u30eb\u30dc\u30fc\u30c9;\u30d0\u30c3\u30af\u30d1\u30cd\u30eb\u30dc\u30fc\u30c9;\u96fb\u6e90\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9;\u30c9\u30e9\u30a4\u30d6\u30d0\u30c3\u30af\u30d7\u30ec\u30fc\u30f3;\u30b7\u30b9\u30c6\u30e0\u5185\u90e8\u62e1\u5f35\u30dc\u30fc\u30c9;\u305d\u306e\u4ed6\u306e\u30b7\u30b9\u30c6\u30e0\u30dc\u30fc\u30c9;\u30d7\u30ed\u30bb\u30c3\u30b5\u30dc\u30fc\u30c9;\u96fb\u6e90\u30e6\u30cb\u30c3\u30c8;\u96fb\u6e90\u30e2\u30b8\u30e5\u30fc\u30eb;\u96fb\u6e90\u7ba1\u7406\u30dc\u30fc\u30c9;\u30b7\u30e3\u30fc\u30b7\u30d0\u30c3\u30af\u30d1\u30cd\u30eb\u30dc\u30fc\u30c9;\u30b7\u30b9\u30c6\u30e0\u30b7\u30e3\u30fc\u30b7;\u30b5\u30d6\u30b7\u30e3\u30fc\u30b7;\u305d\u306e\u4ed6\u306e\u30b7\u30e3\u30fc\u30b7\u30dc\u30fc\u30c9;\u30c7\u30a3\u30b9\u30af\u30d9\u30a4;\u5468\u8fba\u6a5f\u5668\u30d9\u30a4;\u30c7\u30d0\u30a4\u30b9\u30d9\u30a4;\u30d5\u30a1\u30f3\u51b7\u5374;\u51b7\u5374\u30e6\u30cb\u30c3\u30c8;\u30b1\u30fc\u30d6\u30eb\u76f8\u4e92\u63a5\u7d9a;\u30e1\u30e2\u30ea\u30c7\u30d0\u30a4\u30b9;\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2; BIOS ; Intel\uff08r\uff09ME ;\u30b7\u30b9\u30c6\u30e0\u30d0\u30b9;\u30b0\u30eb\u30fc\u30d7; Intel\uff08r\uff09ME ;\u5916\u90e8\u74b0\u5883;\u30d0\u30c3\u30c6\u30ea\u30fc;\u51e6\u7406\u30d6\u30ec\u30fc\u30c9;\u63a5\u7d9a\u30b9\u30a4\u30c3\u30c1;\u30d7\u30ed\u30bb\u30c3\u30b5/\u30e1\u30e2\u30ea\u30e2\u30b8\u30e5\u30fc\u30eb; I / O\u30e2\u30b8\u30e5\u30fc\u30eb;\u30d7\u30ed\u30bb\u30c3\u30b5I / O\u30e2\u30b8\u30e5\u30fc\u30eb;\u7ba1\u7406\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2; IPMI\u30c1\u30e3\u30cd\u30eb; PCI\u30d0\u30b9; PCI\u30a8\u30af\u30b9\u30d7\u30ec\u30b9\u30d0\u30b9; SCSI\u30d0\u30b9; SATA / SAS\u30d0\u30b9;\u30d7\u30ed\u30bb\u30c3\u30b5\u30d5\u200b\u200b\u30ed\u30f3\u30c8\u30b5\u30a4\u30c9\u30d0\u30b9".split(";"); e.RealmNames=";;\u30ea\u30c0\u30a4\u30ec\u30af\u30c8;;\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u30a2\u30bb\u30c3\u30c8;\u30ea\u30e2\u30fc\u30c8\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb;\u30b9\u30c8\u30ec\u30fc\u30b8;\u30a4\u30d9\u30f3\u30c8\u30de\u30cd\u30fc\u30b8\u30e3;\u30b9\u30c8\u30ec\u30fc\u30b8\u7ba1\u7406;\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30d7\u30ec\u30bc\u30f3\u30b9\u30ed\u30fc\u30ab\u30eb;\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30d7\u30ec\u30bc\u30f3\u30b9\u30ea\u30e2\u30fc\u30c8;\u56de\u8def\u906e\u65ad\u5668;\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u6642\u9593;\u4e00\u822c\u60c5\u5831;\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u306e\u66f4\u65b0; EIT ; LocalUN ;\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb;\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u7ba1\u7406;\u30a4\u30d9\u30f3\u30c8\u30ed\u30b0\u30ea\u30fc\u30c0\u30fc;\u76e3\u67fb\u30ed\u30b0; ACL\u30ec\u30eb\u30e0;;;\u30ed\u30fc\u30ab\u30eb\u30b7\u30b9\u30c6\u30e0".split(";"); e.WatchdogCurrentStates={1:"\u59cb\u307e\u3063\u3066\u3044\u306a\u3044",2:"\u505c\u6b62",4:"\u30e9\u30f3\u30cb\u30f3\u30b0",8:"\u671f\u9650\u5207\u308c",16:"\u4e00\u6642\u505c\u6b62"};var h="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(";"),r=";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(";"), -K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7ba1\u7406\u8005",17:"RCO",18:"\u30ea\u30c0\u30a4\u30ec\u30af\u30b7\u30e7\u30f3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc",19:"\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u66f4\u65b0\u30de\u30cd\u30fc\u30b8\u30e3\u30fc",20:"\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u76e3\u67fb\u30ed\u30b0",21:"\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u6642\u9593",22:"\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7ba1\u7406",23:"\u30b9\u30c8\u30ec\u30fc\u30b8\u7ba1\u7406", +O={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7ba1\u7406\u8005",17:"RCO",18:"\u30ea\u30c0\u30a4\u30ec\u30af\u30b7\u30e7\u30f3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc",19:"\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u66f4\u65b0\u30de\u30cd\u30fc\u30b8\u30e3\u30fc",20:"\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u76e3\u67fb\u30ed\u30b0",21:"\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u6642\u9593",22:"\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7ba1\u7406",23:"\u30b9\u30c8\u30ec\u30fc\u30b8\u7ba1\u7406", 24:"\u30a4\u30d9\u30f3\u30c8\u30de\u30cd\u30fc\u30b8\u30e3",25:"\u30b5\u30fc\u30ad\u30c3\u30c8\u30d6\u30ec\u30fc\u30ab\u30fc\u30de\u30cd\u30fc\u30b8\u30e3\u30fc",26:"\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30d7\u30ec\u30bc\u30f3\u30b9\u30de\u30cd\u30fc\u30b8\u30e3\u30fc",27:"\u30ef\u30a4\u30e4\u30ec\u30b9\u69cb\u6210",28:"EAC",29:"KVM",30:"\u30e6\u30fc\u30b6\u30fc\u306e\u30aa\u30d7\u30c8\u30a4\u30f3\u30a4\u30d9\u30f3\u30c8",32:"\u753b\u9762\u306e\u30d6\u30e9\u30f3\u30ad\u30f3\u30b0",33:"\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0\u30a4\u30d9\u30f3\u30c8", 1600:"\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u304c\u958b\u59cb\u3055\u308c\u307e\u3057\u305f",1601:"\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f",1602:"\u8ffd\u52a0\u3055\u308c\u305fACL\u30a8\u30f3\u30c8\u30ea",1603:"ACL\u30a8\u30f3\u30c8\u30ea\u304c\u5909\u66f4\u3055\u308c\u307e\u3057\u305f",1604:"\u524a\u9664\u3055\u308c\u305fACL\u30a8\u30f3\u30c8\u30ea",1605:"\u7121\u52b9\u306a\u8a8d\u8a3c\u60c5\u5831\u306b\u3088\u308bACL\u30a2\u30af\u30bb\u30b9", 1606:"ACL\u30a8\u30f3\u30c8\u30ea\u306e\u72b6\u614b",1607:"TLS\u72b6\u614b\u304c\u5909\u66f4\u3055\u308c\u307e\u3057\u305f",1608:"TLS\u30b5\u30fc\u30d0\u30fc\u8a3c\u660e\u66f8\u30bb\u30c3\u30c8",1609:"TLS\u30b5\u30fc\u30d0\u30fc\u8a3c\u660e\u66f8\u306e\u524a\u9664",1610:"TLS\u4fe1\u983c\u3055\u308c\u305f\u30eb\u30fc\u30c8\u8a3c\u660e\u66f8\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f",1611:"TLS\u4fe1\u983c\u3055\u308c\u305f\u30eb\u30fc\u30c8\u8a3c\u660e\u66f8\u304c\u524a\u9664\u3055\u308c\u307e\u3057\u305f", @@ -180,18 +179,18 @@ K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"\u30bb\u30ad\u30e5\u30ea\u30c6 3E3:"\u30aa\u30d7\u30c8\u30a4\u30f3\u30dd\u30ea\u30b7\u30fc\u306e\u5909\u66f4",3001:"\u540c\u610f\u30b3\u30fc\u30c9\u30a4\u30d9\u30f3\u30c8\u306e\u9001\u4fe1",3002:"\u30aa\u30d7\u30c8\u30a4\u30f3\u30d6\u30ed\u30c3\u30af\u30a4\u30d9\u30f3\u30c8\u306e\u958b\u59cb",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.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["\u7121\u52b9\u306aME\u30a2\u30af\u30bb\u30b9","\u7121\u52b9\u306aMEBx\u30a2\u30af\u30bb\u30b9"][b.charCodeAt(0)];if(1606==a){var c=["\u7121\u52b9","\u6709\u52b9"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+="\u3001"+b.substring(3));return c}return 1607==a?"\u30ea\u30e2\u30fc\u30c8"+["NoAuth","ServerAuth","\u76f8\u4e92\u8a8d\u8a3c"][b.charCodeAt(0)]+"\u3001 \u5730\u5143"+["NoAuth","ServerAuth","\u76f8\u4e92\u8a8d\u8a3c"][b.charCodeAt(1)]: 1617==a?e.RealmNames[ReadInt(b,0)]+"\u3001"+["NoAuth","Auth","\u7121\u52b9"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","\u30ed\u30fc\u30ab\u30ebMEI","\u30ed\u30fc\u30ab\u30ebWSMAN","\u30ea\u30e2\u30fc\u30c8WSAMN"][b.charCodeAt(0)]:1900==a?"\u304b\u3089"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" \u306b"+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?"\u304b\u3089"+["\u7121\u3057","KVM","\u3059\u3079\u3066"][b.charCodeAt(0)]+" \u306b"+["\u7121\u3057","KVM","\u3059\u3079\u3066"][b.charCodeAt(1)]:3001==a?["\u6210\u529f","3\u56de\u5931\u6557"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};return e}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))} +3E3==a?"\u304b\u3089"+["\u7121\u3057","KVM","\u3059\u3079\u3066"][b.charCodeAt(0)]+" \u306b"+["\u7121\u3057","KVM","\u3059\u3079\u3066"][b.charCodeAt(1)]:3001==a?["\u6210\u529f","3\u56de\u5931\u6557"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__namespace,d=a?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",d,e,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|e>>4),isNaN(e)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",d,e,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|e>>4),isNaN(e)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -260,27 +259,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -905,43 +903,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    \u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -957,7 +955,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -975,31 +973,31 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"\u30af\u30ed\u30c3\u30af\u3092\u540c\u671f",3,syncClockEx,"\u30a4\u30f3\u30c6\u30ebAMT\u30af\u30ed\u30c3\u30af\u3092\u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u3068\u540c\u671f\u3057\u307e\u3059\u304b\uff1f")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","\u6642\u9593\u306e\u8a2d\u5b9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3001\u30b9\u30c6\u30fc\u30bf\u30b9="+d):0!=a.Body.ReturnValue?messagebox("","\u6642\u9593\u306e\u8a2d\u5b9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3001\u30a8\u30e9\u30fc\uff1a"+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0, b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}var DMTFPowerStates=" \u96fb\u6e90\u30aa\u30f3 \u6d45\u3044\u7720\u308a \u6df1\u3044\u7720\u308a \u30d1\u30ef\u30fc\u30b5\u30a4\u30af\u30eb\uff08\u30bd\u30d5\u30c8\u30aa\u30d5\uff09 \u30aa\u30d5-\u30cf\u30fc\u30c9 \u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\uff08\u30aa\u30d5\u30bd\u30d5\u30c8\uff09 \u30bd\u30d5\u30c8\u30aa\u30d5 \u30d1\u30ef\u30fc\u30b5\u30a4\u30af\u30eb\uff08\u30aa\u30d5\u30cf\u30fc\u30c9\uff09 \u30e1\u30a4\u30f3\u30d0\u30b9\u30ea\u30bb\u30c3\u30c8 \u8a3a\u65ad\u5272\u308a\u8fbc\u307f\uff08NMI\uff09 \u9069\u7528\u3067\u304d\u307e\u305b\u3093 \u30aa\u30d5-\u512a\u96c5\u306a\u30bd\u30d5\u30c8 \u30aa\u30d5-\u512a\u96c5\u306a\u30cf\u30fc\u30c9 \u30de\u30b9\u30bf\u30fc\u30d0\u30b9\u306e\u30ea\u30bb\u30c3\u30c8 \u30d1\u30ef\u30fc\u30b5\u30a4\u30af\u30eb\uff08\u30aa\u30d5-\u30bd\u30d5\u30c8\u30b0\u30ec\u30fc\u30b9\u30d5\u30eb\uff09 \u30d1\u30ef\u30fc\u30b5\u30a4\u30af\u30eb\uff08\u30aa\u30d5-\u512a\u96c5\u306a\u30cf\u30fc\u30c9\uff09 \u8a3a\u65ad\u5272\u308a\u8fbc\u307f\uff08INIT\uff09".split(" "); -function updateSystemStatus(){if(amtsysstate&&!(99\u308f\u304b\u3089\u306a\u3044";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0\u7121\u3057":EscapeHtml(c);d+=TableEntry("\u540d\u524d\u3068\u30c9\u30e1\u30a4\u30f3", -addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+=TableEntry("\u30b7\u30b9\u30c6\u30e0ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("\u30b7\u30b9\u30c6\u30e0ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5\u308f\u304b\u3089\u306a\u3044";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0\u7121\u3057":EscapeHtml(c);d+=TableEntry("\u540d\u524d\u3068\u30c9\u30e1\u30a4\u30f3", +addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+=TableEntry("\u30b7\u30b9\u30c6\u30e0ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("\u30b7\u30b9\u30c6\u30e0ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["\u30d7\u30e9\u30a4\u30de\u30ea\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4","\u30bb\u30ab\u30f3\u30c0\u30ea\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4", "\u7b2c3\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+="\u3001\u30dd\u30fc\u30c85900\u304c\u6709\u52b9"),1==n.OptInPolicy&&(g+="\u3001"+n.OptInPolicyTimeout+" "+(0
    "); -QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u3053\u306e\u30da\u30fc\u30b8\u304c\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002");d=d+"

    \u4e00\u822c\u8a2d\u5b9a

    "+TableStart();g="";"\u7121\u3057"!=c&&(1==v.SharedFQDN&& -(g="\u3001OS\u3068\u5171\u6709"),0==v.SharedFQDN&&(g="\u3001OS\u3068\u306f\u7570\u306a\u308a\u307e\u3059"));d+=TableEntry("\u540d\u524d\u3068\u30c9\u30e1\u30a4\u30f3",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="\u7121\u52b9";1==v.DDNSUpdateEnabled?c="\u305d\u308c\u305e\u308c\u6709\u52b9"+v.DDNSPeriodicUpdateInterval+" \u5206\u3001TTL\u306f"+v.DDNSTTL+" \u5206":1==v.DDNSUpdateByDHCPServerEnabled&&(c="DHCP\u30b5\u30fc\u30d0\u30fc\u306b\u3088\u308b\u66f4\u65b0");d+=TableEntry("\u30c0\u30a4\u30ca\u30df\u30c3\u30afDNS", +QH(15,d);d="
    "+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u3053\u306e\u30da\u30fc\u30b8\u304c\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002");d=d+"

    \u4e00\u822c\u8a2d\u5b9a

    "+TableStart();g="";"\u7121\u3057"!=c&&(1==u.SharedFQDN&& +(g="\u3001OS\u3068\u5171\u6709"),0==u.SharedFQDN&&(g="\u3001OS\u3068\u306f\u7570\u306a\u308a\u307e\u3059"));d+=TableEntry("\u540d\u524d\u3068\u30c9\u30e1\u30a4\u30f3",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="\u7121\u52b9";1==u.DDNSUpdateEnabled?c="\u305d\u308c\u305e\u308c\u6709\u52b9"+u.DDNSPeriodicUpdateInterval+" \u5206\u3001TTL\u306f"+u.DDNSTTL+" \u5206":1==u.DDNSUpdateByDHCPServerEnabled&&(c="DHCP\u30b5\u30fc\u30d0\u30fc\u306b\u3088\u308b\u66f4\u65b0");d+=TableEntry("\u30c0\u30a4\u30ca\u30df\u30c3\u30afDNS", 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+="

    "+(amtwirelessif==a?"\u7121\u7dda\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9":"\u6709\u7dda\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9")+"

    ";d+=TableStart();d+=TableEntry("\u30ea\u30f3\u30af\u72b6\u614b", -1==c.LinkIsUp?"\u30ea\u30f3\u30af\u306f\u30a2\u30c3\u30d7\u3057\u3066\u3044\u307e\u3059":"\u30ea\u30f3\u30af\u304c\u30c0\u30a6\u30f3\u3057\u3066\u3044\u307e\u3059");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("\u30ea\u30f3\u30af\u30dd\u30ea\u30b7\u30fc",addLinkConditional(0== +1==c.LinkIsUp?"\u30ea\u30f3\u30af\u306f\u30a2\u30c3\u30d7\u3057\u3066\u3044\u307e\u3059":"\u30ea\u30f3\u30af\u304c\u30c0\u30a6\u30f3\u3057\u3066\u3044\u307e\u3059");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("\u30ea\u30f3\u30af\u30dd\u30ea\u30b7\u30fc",addLinkConditional(0== g.length?"\u5229\u7528\u4e0d\u53ef":"\u3067\u5229\u7528\u53ef\u80fd\uff1a"+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Mac\u30a2\u30c9\u30ec\u30b9",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("\u72b6\u614b",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID, d+=TableEntry("\u30e9\u30b8\u30aa\u5dde",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+"\u3001SSID\uff1a"+(s?s:"\u7121\u3057")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled? "\u6709\u52b9":"\u7121\u52b9","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"\u6709\u52b9":"\u7121\u52b9", -"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("ping\u306b\u5fdc\u7b54\u3059\u308b",addLinkConditional(["\u7121\u52b9","ICMP\u5fdc\u7b54","RMCP\u5fdc\u7b54","ICMP\u304a\u3088\u3073RMCP\u5fdc\u7b54"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"DHCP\u30b5\u30fc\u30d0\u30fc\u3092\u4f7f\u7528\u3057\u3066\u81ea\u52d5":"\u9759\u7684IP\u30a2\u30c9\u30ec\u30b9", +"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("ping\u306b\u5fdc\u7b54\u3059\u308b",addLinkConditional(["\u7121\u52b9","ICMP\u5fdc\u7b54","RMCP\u5fdc\u7b54","ICMP\u304a\u3088\u3073RMCP\u5fdc\u7b54"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"DHCP\u30b5\u30fc\u30d0\u30fc\u3092\u4f7f\u7528\u3057\u3066\u81ea\u52d5":"\u9759\u7684IP\u30a2\u30c9\u30ec\u30b9", 1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("IPv4\u72b6\u614b",addLinkConditional(g,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4\u30a2\u30c9\u30ec\u30b9",isIpAddress(c.IPAddress,"\u7121\u3057"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("IPv4\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4/\u30de\u30b9\u30af",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"\u7121\u3057")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("IPv4\u30c9\u30e1\u30a4\u30f3\u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u30fc", -g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="

      EventTime\u30bd\u30fc\u30b9\u8aac\u660e";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTime\u30bd\u30fc\u30b9\u8aac\u660e";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"\u30a4\u30d9\u30f3\u30c8\u30ed\u30b0\u3092\u6d88\u53bb\u3057\u307e\u3059\u304b\uff1f"),setDialogMode(1,"\u30a4\u30d9\u30f3\u30c8\u30ed\u30b0",3,ClearLogEx))} function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("\u30a4\u30d9\u30f3\u30c8\u30ed\u30b0","\u30af\u30ea\u30a2\u3067\u304d\u307e\u305b\u3093\u3001\u30a8\u30e9\u30fc\uff1a "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("\u6642\u9593",c.Time.toLocaleString());a+=addHtmlValue("\u30bd\u30fc\u30b9",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("\u8aac\u660e",c.Desc);a+=MoreStart();a+=addHtmlValue("\u30c7\u30d0\u30a4\u30b9\u30a2\u30c9\u30ec\u30b9",c.DeviceAddress);a+=addHtmlValue("\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3",c.Entity);a+=addHtmlValue("\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9", @@ -1049,8 +1047,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"\u7121\u52b9":"\u6709\u52b9",c&2&&(b+="\u3001\u30ed\u30c3\u30af"),c&4&&(b+="\u3001 \u307b\u307c\u3044\u3063\u3071\u3044"),c&8&&(b+="\u3001\u30d5\u30eb"),c&16&&(b+="\u3001NoKey"),c="

    \u76e3\u67fb\u30ed\u30b0\u8a2d\u5b9a

    "+TableStart(),c+=TableEntry("\u72b6\u614b",b),c+=TableEntry("\u30b9\u30c8\u30ec\u30fc\u30b8",a[0].CurrentNumberOfRecords+" \u8a18\u9332\uff09\u3001"+a[0].PercentageFree+"\uff05 \u81ea\u7531"), c+=TableEntry("\u4e0a\u66f8\u304d\u30dd\u30ea\u30b7\u30fc",2==a[0].OverwritePolicy?"\u3044\u3063\u3071\u3044\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u30e9\u30c3\u30d7":"\u4e0a\u66f8\u304d\u3057\u306a\u3044"),c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("\u30bb\u30fc\u30d6...","SaveAuditLog()")+AddButton("\u30ed\u30b0\u3092\u30af\u30ea\u30a2","ClearAuditLog()"))+"
    ");if(0==c.length)d="\u76e3\u67fb\u30ed\u30b0\u30a4\u30d9\u30f3\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"; -else{var g=0;d+="

      \u6642\u9593\u30a4\u30cb\u30b7\u30a8\u30fc\u30bfAction";for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,d)} +else{var g=0;d+="

      \u6642\u9593\u30a4\u30cb\u30b7\u30a8\u30fc\u30bfAction";for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0  '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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\u76e3\u67fb\u30ed\u30b0",auditLog)}function ClearAuditLog(b){QH(60,"\u76e3\u67fb\u30ed\u30b0\u3092\u6d88\u53bb\u3057\u307e\u3059\u304b\uff1f");setDialogMode(1,"\u76e3\u67fb\u30ed\u30b0",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("\u76e3\u67fb\u30ed\u30b0","\u30a8\u30e9\u30fc\uff1a"+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("\u6642\u9593",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("\u30a4\u30cb\u30b7\u30a8\u30fc\u30bf",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("\u4f4f\u6240",a.NetAddress));d+=addHtmlValue("\u5fdc\u7528",a.AuditApp);d+=addHtmlValue("\u30a4\u30d9\u30f3\u30c8",a.Event);if(null!=a.ExStr)d+=addHtmlValue("\u62e1\u5f35\u30c7\u30fc\u30bf",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
    \u8a3c\u66f8

    \u30a4\u30f3\u30c6\u30eb®AMT\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30d7\u30ec\u30bc\u30f3\u30b9\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    "; if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30d7\u30ec\u30bc\u30f3\u30b9\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+ -"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" \uff1a\u30ed\u30b0\u306b\u8a18\u9332\u3059\u308b\u30a4\u30d9\u30f3\u30c8")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0\u3092\u8ffd\u52a0...","AddWatchdog()")); +"";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" \uff1a\u30ed\u30b0\u306b\u8a18\u9332\u3059\u308b\u30a4\u30d9\u30f3\u30c8")}""!=d&&(b+="
    "+d+"
    ");b+=""}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0\u3092\u8ffd\u52a0...","AddWatchdog()")); b+="
    ";QH(54,b)}}function getWatchdogTransitionStr(b){if(31==b)return"\u3059\u3079\u3066\u306e\u5dde";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("\u8aac\u660e",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("\u76e3\u8996\u5bfe\u8c61\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("\u73fe\u5728\u306e\u72b6\u614b",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("\u6709\u52b9\u306a\u72b6\u614b", watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("\u8d77\u52d5\u9593\u9694",b.StartupInterval+" \u79d2");c+=addHtmlValue("\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u9593\u9694",b.TimeoutInterval+" \u79d2");setDialogMode(11,format("\u30a6\u30a9\u30c3\u30c1\u30c9\u30c3\u30b0{0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1132,12 +1130,12 @@ if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
    "+EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    \u30a4\u30f3\u30c6\u30eb®AMT\u30b7\u30b9\u30c6\u30e0\u9632\u5fa1\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    \u30b7\u30b9\u30c6\u30e0\u9632\u5fa1\u30d5\u30a3\u30eb\u30bf\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002

    "; else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="\u3059\u3079\u3066\u306e\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30d7\u30ed\u30c8\u30b3\u30eb"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" \u3067"+a.FilterProfileData+" \u30d1\u30b1\u30c3\u30c8/\u79d2"),1==a.ActionEventOnMatch&&(d+="\u3001\u8a66\u5408\u306e\u30a4\u30d9\u30f3\u30c8"), b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="\u3059\u3079\u3066\u306e\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30d7\u30ed\u30c8\u30b3\u30eb"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2== -a.FilterProfile&&(d+=" \u3067"+a.FilterProfileData+" \u30d1\u30b1\u30c3\u30c8/\u79d2");1==a.ActionEventOnMatch&&(d+="\u3001\u8a66\u5408\u306e\u30a4\u30d9\u30f3\u30c8");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+ +a.FilterProfile&&(d+=" \u3067"+a.FilterProfileData+" \u30d1\u30b1\u30c3\u30c8/\u79d2");1==a.ActionEventOnMatch&&(d+="\u3001\u8a66\u5408\u306e\u30a4\u30d9\u30f3\u30c8");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+ AddButton("\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u8ffd\u52a0...","AddDefenseFilter()")+AddButton("\u30dd\u30ea\u30b7\u30fc\u3092\u8ffd\u52a0...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30dd\u30ea\u30b7\u30fc
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1150,12 +1148,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="HDR"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="HDR"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("\u30b7\u30b9\u30c6\u30e0\u9632\u5fa1\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u8ffd\u52a0","\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3001\u30a8\u30e9\u30fc\uff03"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30c8\u30e9\u30d5\u30a3\u30c3\u30af",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="\u3059\u3079\u3066\u306e\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30d7\u30ed\u30c8\u30b3\u30eb"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="IP\u30c8\u30e9\u30d5\u30a3\u30c3\u30af",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])|| -(a="\u3059\u3079\u3066\u306eIP\u30d7\u30ed\u30c8\u30b3\u30eb"+d.HdrIPVersion));var n;n=""+addHtmlValue("\u540d\u524d",EscapeHtml(d.Name));n+=addHtmlValue("\u30bf\u30a4\u30d7",g);n+=addHtmlValue("\u4e00\u81f4\u3059\u308b\u30c8\u30e9\u30d5\u30a3\u30c3\u30af",a);n+=addHtmlValue("\u65b9\u5411",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+ -g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("\u30d5\u30a3\u30eb\u30bf"+a,g));n+=addHtmlValue("\u8a66\u5408\u306e\u30a4\u30d9\u30f3\u30c8",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\uff03"+d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)} +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30c8\u30e9\u30d5\u30a3\u30c3\u30af",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="\u3059\u3079\u3066\u306e\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30d7\u30ed\u30c8\u30b3\u30eb"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="IP\u30c8\u30e9\u30d5\u30a3\u30c3\u30af",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])|| +(a="\u3059\u3079\u3066\u306eIP\u30d7\u30ed\u30c8\u30b3\u30eb"+d.HdrIPVersion));var n;n=""+addHtmlValue("\u540d\u524d",EscapeHtml(d.Name));n+=addHtmlValue("\u30bf\u30a4\u30d7",g);n+=addHtmlValue("\u4e00\u81f4\u3059\u308b\u30c8\u30e9\u30d5\u30a3\u30c3\u30af",a);n+=addHtmlValue("\u65b9\u5411",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+ +g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("\u30d5\u30a3\u30eb\u30bf"+a,g));n+=addHtmlValue("\u8a66\u5408\u306e\u30a4\u30d9\u30f3\u30c8",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\uff03"+d.InstanceID,5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)} function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u524a\u9664","\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002\u4f7f\u7528\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002"):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    \u540d\u524d
    \u30c7\u30d5\u30a9\u30eb\u30c8\u306eTX / RX
    ';b+= "
    ";if(0
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("\u30bb\u30fc\u30d6...","SaveHardwareLog()")+" \u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u60c5\u5831\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u306e\u30d6\u30fc\u30c8\u6642\u306b\u53ce\u96c6\u3055\u308c\u307e\u3059\u3002");c=a.CIM_Chassis.response;d=a.CIM_Card.response; -var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    \u30d7\u30e9\u30c3\u30c8\u30db\u30fc\u30e0

    "+FullTable({"\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30e2\u30c7\u30eb":c.Model,"\u30e1\u30fc\u30ab\u30fc":c.Manufacturer,"\u30d0\u30fc\u30b8\u30e7\u30f3":c.Version,"\u30b7\u30ea\u30a2\u30eb\u30ca\u30f3\u30d0\u30fc":c.SerialNumber,"\u30b7\u30b9\u30c6\u30e0ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    \u30d9\u30fc\u30b9\u30dc\u30fc\u30c9

    "; -b+=FullTable({"\u30e1\u30fc\u30ab\u30fc":d.Manufacturer,"\u5546\u54c1\u540d":d.Model,"\u30d0\u30fc\u30b8\u30e7\u30f3":d.Version,"\u30b7\u30ea\u30a2\u30eb\u30ca\u30f3\u30d0\u30fc":d.SerialNumber,"\u30a2\u30bb\u30c3\u30c8\u30bf\u30b0":d.Tag,"\u4ea4\u63db\u53ef\u80fd\u3067\u3059\u304b\uff1f":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({"\u30d9\u30f3\u30c0\u30fc":a.CIM_BIOSElement.response.Manufacturer,"\u30d0\u30fc\u30b8\u30e7\u30f3":v,"\u767a\u58f2\u65e5":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", +var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    \u30d7\u30e9\u30c3\u30c8\u30db\u30fc\u30e0

    "+FullTable({"\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30e2\u30c7\u30eb":c.Model,"\u30e1\u30fc\u30ab\u30fc":c.Manufacturer,"\u30d0\u30fc\u30b8\u30e7\u30f3":c.Version,"\u30b7\u30ea\u30a2\u30eb\u30ca\u30f3\u30d0\u30fc":c.SerialNumber,"\u30b7\u30b9\u30c6\u30e0ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    \u30d9\u30fc\u30b9\u30dc\u30fc\u30c9

    "; +b+=FullTable({"\u30e1\u30fc\u30ab\u30fc":d.Manufacturer,"\u5546\u54c1\u540d":d.Model,"\u30d0\u30fc\u30b8\u30e7\u30f3":d.Version,"\u30b7\u30ea\u30a2\u30eb\u30ca\u30f3\u30d0\u30fc":d.SerialNumber,"\u30a2\u30bb\u30c3\u30c8\u30bf\u30b0":d.Tag,"\u4ea4\u63db\u53ef\u80fd\u3067\u3059\u304b\uff1f":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({"\u30d9\u30f3\u30c0\u30fc":a.CIM_BIOSElement.response.Manufacturer,"\u30d0\u30fc\u30b8\u30e7\u30f3":u,"\u767a\u58f2\u65e5":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", {timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    \u30d7\u30ed\u30bb\u30c3\u30b5\u30fc "+(parseInt(g)+1)+"

    ",b+=FullTable({"\u30e1\u30fc\u30ab\u30fc":trademarks(d.Manufacturer),"\u5bb6\u65cf":DMTFProcFamilly[c.Family],"\u30d0\u30fc\u30b8\u30e7\u30f3":trademarks(d.Version),"\u6700\u5927\u30bd\u30b1\u30c3\u30c8\u901f\u5ea6":c.MaxClockSpeed+" MHz","\u72b6\u614b":DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c= a.CIM_PhysicalMemory.responses[g],b+="

    \u30e1\u30e2\u30ea\u30e2\u30b8\u30e5\u30fc\u30eb "+(+g+1)+"

    ",b+=FullTable({"\u9280\u884c\u30e9\u30d9\u30eb":c.BankLabel,"\u30e1\u30fc\u30ab\u30fc":c.Manufacturer,"\u30b7\u30ea\u30a2\u30eb\u30ca\u30f3\u30d0\u30fc":c.SerialNumber,"\u30b5\u30a4\u30ba":parseInt(c.Capacity/1048576)+" MB","\u30d5\u30a9\u30fc\u30e0\u30d5\u30a1\u30af\u30bf":DMTFMemFormFactor[c.FormFactor],"\u30bf\u30a4\u30d7":DMTFMemType[c.MemoryType],"\u30a2\u30bb\u30c3\u30c8\u30bf\u30b0":c.Tag, "\u54c1\u756a":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

    \u8a18\u61b6\u5a92\u4f53 "+(parseInt(g)+1)+"

    ",b+=FullTable({"\u578b\u756a":d.Model,"\u30b7\u30ea\u30a2\u30eb\u30ca\u30f3\u30d0\u30fc":""==d.SerialNumber?"Unknown":d.SerialNumber,"\u30b5\u30a4\u30ba":parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11== @@ -1207,19 +1205,19 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

    \u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30a4\u30f3\u30c6\u30eb®AMT\u30e6\u30fc\u30b6\u30fc\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&& -"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==v&&(n+="\u7121\u52b9\u3001");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a["\u30ec\u30eb\u30e0"][c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="\u76e3\u67fb\u5f79");n=0<=a.Realms.indexOf(3)?n+"\u7ba1\u7406\u8005":1==l?n+"1\u30ec\u30eb\u30e0":n+(l+" \u9818\u57df")}else n+="\u7ba1\u7406\u8005",a.Handle=-1;b+="
    "; -0'+d+"
    "+n+"
    "}}c='

    \u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30a4\u30f3\u30c6\u30eb®AMT\u30e6\u30fc\u30b6\u30fc\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&& +"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==u&&(n+="\u7121\u52b9\u3001");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a["\u30ec\u30eb\u30e0"][c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="\u76e3\u67fb\u5f79");n=0<=a.Realms.indexOf(3)?n+"\u7ba1\u7406\u8005":1==k?n+"1\u30ec\u30eb\u30e0":n+(k+" \u9818\u57df")}else n+="\u7ba1\u7406\u8005",a.Handle=-1;b+="
    "; +0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("\u65b0\u3057\u3044\u30a2\u30ab\u30a6\u30f3\u30c8","newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u7de8\u96c6",-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,"\u65b0\u3057\u3044\u30a2\u30ab\u30a6\u30f3\u30c8",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("\u30a2\u30ab\u30a6\u30f3\u30c8\u30a8\u30e9\u30fc","\u7121\u52b9\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]|| -3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("\u30a2\u30ab\u30a6\u30f3\u30c8\u30a8\u30e9\u30fc","\u7121\u52b9\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]|| +3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("\u540d\u524d",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("\u72b6\u614b",1==xxAccountEnabledInfo[b].Enabled?"\u6709\u52b9":"\u7121\u52b9"));if(g==xxAccountAdminName)a+=addHtmlValue("\u8a31\u53ef","\u7ba1\u7406\u8005");else{var a=a+addHtmlValue("\u8a31\u53ef",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v= -"\u7ba1\u7406\u8005",0<=c.Realms.indexOf(20)&&(v+="\u3001\u76e3\u67fb\u5f79");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("\u30a2\u30ab\u30a6\u30f3\u30c8"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("\u540d\u524d",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("\u72b6\u614b",1==xxAccountEnabledInfo[b].Enabled?"\u6709\u52b9":"\u7121\u52b9"));if(g==xxAccountAdminName)a+=addHtmlValue("\u8a31\u53ef","\u7ba1\u7406\u8005");else{var a=a+addHtmlValue("\u8a31\u53ef",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u= +"\u7ba1\u7406\u8005",0<=c.Realms.indexOf(20)&&(u+="\u3001\u76e3\u67fb\u5f79");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("\u30a2\u30ab\u30a6\u30f3\u30c8"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    \uff08\u7a7a\u306e\uff09":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    \u30a8\u30e9\u30fc\uff03"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1269,10 +1267,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"\u30b5\u30fc\u30d0":"")+"IDE-R\u30bb\u30c3\u30b7\u30e7\u30f3\u3001\u63a5\u7d9a\u6e08\u307f\u3001"+ider.m.bytesFromAmt+" \u306b\u3001"+ider.m.bytesToAmt+" \u30a2\u30a6\u30c8\u3002")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM \u3001\u30d6\u30ed\u30c3\u30af\u306f{0}\u30d0\u30a4\u30c8\u3067\u3059\u3002",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("\u30d5\u30ed\u30c3\u30d4\u30fc\u3001\u30d6\u30ed\u30c3\u30af\u306f{0}\u30d0\u30a4\u30c8\u3067\u3059\u3002", -512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height=6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b CDROM \u3001\u30d6\u30ed\u30c3\u30af\u306f{0}\u30d0\u30a4\u30c8\u3067\u3059\u3002",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("\u30d5\u30ed\u30c3\u30d4\u30fc\u3001\u30d6\u30ed\u30c3\u30af\u306f{0}\u30d0\u30a4\u30c8\u3067\u3059\u3002", +512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height=6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b\u7121\u3057";if(0\u7121\u3057";if(0v&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("\u5b9a\u671f\u7684\u306a\u63a5\u7d9a",addLinkConditional(c,'editMpsPolicy("Periodic")', +(c+=", "),c+=xxPolicies.Periodic[d].AccessInfo,1==xxPolicies.Periodic[d].MpsType&&(c+=" (CILA)");var g=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName","\u5b9a\u671f\u7684");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format("\u3001{0}\u79d2\u3054\u3068",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("\u5b9a\u671f\u7684\u306a\u63a5\u7d9a",addLinkConditional(c,'editMpsPolicy("Periodic")', xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    \u30a4\u30f3\u30c6\u30eb®AMT\u30ea\u30e2\u30fc\u30c8\u7ba1\u7406\u30b5\u30fc\u30d0\u30fc\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ";if(0==xxCiraServers.length)b+="

    \u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002

    ";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&& (c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    \u7ba1\u7406\u63a5\u7d9a\u306b\u4f7f\u7528\u3055\u308c\u308bHTTP\u30d7\u30ed\u30ad\u30b7\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="

    \u30d7\u30ed\u30ad\u30b7\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002

    "; else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("\u30b5\u30fc\u30d0\u30fc\u3092\u8ffd\u52a0...","AddRemoteAccessServer()"),a&&(d+=AddButton("\u30d7\u30ed\u30ad\u30b7\u3092\u8ffd\u52a0...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(52, @@ -1333,9 +1331,9 @@ format("{0}\u63a5\u7d9a",b),3,editMpsPolicyOk,c);editMpsPolicyUpdate()} function editMpsPolicyUpdate(){var b=11=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||23a||59http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server2").value].Name+"");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),v&&(0==Q("d2server2cira").value?d.push(v):n.push(v))):g&&(d.push(g),v&&d.push(v));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp; +function editMpsPolicyOk2(b,c,a,d){b=11http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server2").value].Name+"");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),u&&(0==Q("d2server2cira").value?d.push(u):n.push(u))):g&&(d.push(g),u&&d.push(u));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp; function editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="\u6700\u59275\u3064\u306e\u30a4\u30f3\u30c8\u30e9\u30cd\u30c3\u30c8\u30c9\u30e1\u30a4\u30f3\u30b5\u30d5\u30a3\u30c3\u30af\u30b9\u3092\u5165\u529b\u3057\u307e\u3059\u3002\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u304c\u3053\u308c\u3089\u306e\u30c9\u30e1\u30a4\u30f3\u306e\u5916\u306b\u3042\u308b\u5834\u5408\u3001\u30a4\u30f3\u30c6\u30eb®AMT\u30ed\u30fc\u30ab\u30eb\u30dd\u30fc\u30c8\u306f\u9589\u3058\u3089\u308c\u3001\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u63a5\u7d9a\u304c\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u306a\u308a\u307e\u3059\u3002

    "); 0==editEnvironmentDetectionTmp.length&&(c+="\u30a4\u30f3\u30c8\u30e9\u30cd\u30c3\u30c8\u30c9\u30e1\u30a4\u30f3\u306a\u3057\u3001\u74b0\u5883\u691c\u51fa\u304c\u7121\u52b9\u3002
    ");for(var a in editEnvironmentDetectionTmp)c+="
    "+AddButton2("\u524a\u9664\u3059\u308b","editEnvironmentDetectionRemove("+a+")")+'
    '+editEnvironmentDetectionTmp[a]+ "
    ";xxAccountAdminName&&5>editEnvironmentDetectionTmp.length&&(c+="
    ");1==b?QH(63,c):setDialogMode(11,"\u74b0\u5883\u691c\u51fa",xxAccountAdminName?3:1,editEnvironmentDetectionDlg,c);edInputChg()} @@ -1409,7 +1407,7 @@ function powerActionDlgRPE(b){var c;c="Confirm execution of Intel® Remote Pl d&33554432&&a.push("");d&67108864&&a.push("");d&-2147483648&&a.push("");1Select the actions to take:

    {0}

    ", a.join("
    ")));c+="";setDialogMode(11,"\u30d1\u30ef\u30fc\u30a2\u30af\u30b7\u30e7\u30f3",3,powerActionDlgRPEEx,c,b);QE("c54",!1)} function powerActionDlgRPEValidate(){var b=0,c=amtPowerBootCapabilities.PlatformErase,a=[2,6,25,26,31],d;for(d in a)c&1<b&&2amtversion&&(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; @@ -1446,12 +1444,12 @@ function powerActionResponse4(b,c,a,d){200==d&&(QH(60,"\u96fb\u6e90\u64cd\u4f5c\ 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",2c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(D){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    \u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30a4\u30f3\u30c6\u30eb®AMT\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++; -var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+"\u30eb\u30fc\u30c8";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" \u30d0\u30a4\u30c8
    "); -d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    \u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002

    "); -v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9...","UploadToStorage()"):""));QH(55,a)}else QH(55,"\u30b9\u30c8\u30ec\u30fc\u30b8\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3081\u307e\u305b\u3093...
    "+AddButton("\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("\u30d9\u30f3\u30c0\u30fc",b));""!=c&&(g+=addHtmlValue("\u5fdc\u7528",c));g+=addHtmlValue("\u540d\u524d",a);g+=addHtmlValue("\u30b5\u30a4\u30ba",v.size+" bytes");v.link&&(g+=addHtmlValue("\u30ea\u30f3\u30af",v.link));setDialogMode(11,"\u30b9\u30c8\u30ec\u30fc\u30b8\u30a2\u30a4\u30c6\u30e0",5,showStorageDetailsEx,g,d)}} +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    \u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30a4\u30f3\u30c6\u30eb®AMT\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++; +var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+"\u30eb\u30fc\u30c8";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" \u30d0\u30a4\u30c8
    "); +d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==v&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    \u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002

    "); +u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(u?AddButton("\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9...","UploadToStorage()"):""));QH(55,a)}else QH(55,"\u30b9\u30c8\u30ec\u30fc\u30b8\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3081\u307e\u305b\u3093...
    "+AddButton("\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5","PullStorage()"))} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("\u30d9\u30f3\u30c0\u30fc",b));""!=c&&(g+=addHtmlValue("\u5fdc\u7528",c));g+=addHtmlValue("\u540d\u524d",a);g+=addHtmlValue("\u30b5\u30a4\u30ba",u.size+" bytes");u.link&&(g+=addHtmlValue("\u30ea\u30f3\u30af",u.link));setDialogMode(11,"\u30b9\u30c8\u30ec\u30fc\u30b8\u30a2\u30a4\u30c6\u30e0",5,showStorageDetailsEx,g,d)}} function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} function storageDeleteResponse(b,c){200!=c?messagebox("\u30b9\u30c8\u30ec\u30fc\u30b8",format("\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\uff08ERR {0}\uff09\u3002\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u96fb\u6e90\u304c\u30aa\u30f3\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",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","noopener,noreferrer");a.opener=null;a.focus()}} @@ -1464,37 +1462,37 @@ a+="";for(var d in xxStorageVendors)a+='

    \u30a6\u30a7\u30a4\u30af\u30a2\u30e9\u30fc\u30e0\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002

    ";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,g){if(200==g){QV("go23",!0);if(0"+d[c].ElementName+", \u76ee\u899a\u3081\u308b "+(new Date(d[c].StartTime.Datetime)).toLocaleString().replace(", "," \u3067"),void 0!=d[c].Interval&&(a+=" \u305d\u3057\u3066\u305d\u308c\u305e\u308c"+ _fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&&(a+="\u3001\u5b8c\u4e86\u3057\u305f\u3089\u524a\u9664"),b+="
    ",xxAccountAdminName&&(b+=" "+AddButton2("\u7de8\u96c6...",'showAddAlarm(" + i + ")')),b+="
    "+a+"
    ";else xxAlarms=null,b+="

    \u30a6\u30a7\u30a4\u30af\u30a2\u30e9\u30fc\u30e0\u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002

    "; d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("\u3059\u3079\u3066\u306e\u30a2\u30e9\u30fc\u30e0\u3092\u524a\u9664","RemoveAllAlarms()")+AddButton("\u8ffd\u52a0","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ g+""}function RemoveAllAlarms(){setDialogMode(1,"\u3059\u3079\u3066\u306e\u30a6\u30a7\u30a4\u30af\u30a2\u30e9\u30fc\u30e0\u3092\u524a\u9664\u3059\u308b",3,RemoveAllAlarmsEx,"\u3059\u3079\u3066\u306e\u30a6\u30a7\u30a4\u30af\u30a2\u30e9\u30fc\u30e0\u306e\u524a\u9664\u3092\u78ba\u8a8d\u3057\u307e\u3059\u304b\uff1f")} -function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"\u65b0\u3057\u3044\u30a2\u30e9\u30fc\u30e0\u3092\u8ffd\u52a0",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}} function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0\u30a2\u30e9\u30fc\u30e0\u304c\u5c06\u6765\u306e\u4e88\u5b9a\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002", +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("\u30a2\u30e9\u30fc\u30e0\u3092\u8ffd\u52a0",format("\u30a2\u30e9\u30fc\u30e0\u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30b9\u30c6\u30fc\u30bf\u30b9\uff1a{0}\u3002
    \u30a2\u30e9\u30fc\u30e0\u304c\u5c06\u6765\u306e\u4e88\u5b9a\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002", d)):0!=c.Body.ReturnValue?messagebox("\u30a2\u30e9\u30fc\u30e0\u3092\u8ffd\u52a0",format("\u30a2\u30e9\u30fc\u30e0{0}\u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
    \u30a2\u30e9\u30fc\u30e0\u304c\u5c06\u6765\u306e\u4e88\u5b9a\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"", -a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("\u30a2\u30e9\u30fc\u30e0\u3092\u7de8\u96c6",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("\u30a2\u30e9\u30fc\u30e0\u3092\u7de8\u96c6",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("\u540d\u524d",c.ElementName)+addHtmlValue("\u30a6\u30a7\u30a4\u30af\u30bf\u30a4\u30e0",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("\u5185\u90e8",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("\u8d77\u304d\u305f\u5f8c",1==c.DeleteOnCompletion?"\u30a2\u30e9\u30fc\u30e0\u3092\u524a\u9664":"\u30a2\u30e9\u30fc\u30e0\u3092\u4fdd\u6301")+ -"
    ";messagebox(format("\u30a2\u30e9\u30fc\u30e0{0}",c.ElementName),a);setDialogMode(11,"\u8b66\u5831"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +"";messagebox(format("\u30a2\u30e9\u30fc\u30e0{0}",c.ElementName),a);setDialogMode(11,"\u8b66\u5831"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")} +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")} var httpErrorTable={200:"OK",401:"\u8a8d\u8a3c\u30a8\u30e9\u30fc",408:"\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u30a8\u30e9\u30fc",601:"WSMAN\u89e3\u6790\u30a8\u30e9\u30fc",602:"HTTP\u5fdc\u7b54\u30d8\u30c3\u30c0\u30fc\u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093",603:"\u4e88\u671f\u3057\u306a\u3044HTTP\u5217\u6319\u5fdc\u7b54",604:"\u4e88\u671f\u3057\u306a\u3044HTTP\u30d7\u30eb\u5fdc\u7b54",997:"\u7121\u52b9\u306a\u30c0\u30a4\u30b8\u30a7\u30b9\u30c8\u30ec\u30eb\u30e0"}; 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("\u30a8\u30e9\u30fc\uff03{0}",b)),401==b&&QH(5,'\u8a8d\u8a3c\u30a8\u30e9\u30fc

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("\u901a\u8a71\u30a8\u30e9\u30fc",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("\u901a\u8a71\u30a8\u30e9\u30fc",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1} function TableStart(){return"

    "}function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""}function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"} function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"\uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \ub370\uc774\ud130";if(0==b)return D[c[1]]; -if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}", +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"\uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \ub370\uc774\ud130";if(0==b)return E[c[1]]; +if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}", c[2]);if(170==c[0]&&64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters"; if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18==a&&170==c[0])return"\uc6cc\uce58 \ub3c5 \uc694\uc6d0"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... \ub85c \ubcc0\uacbd"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"\ucf00\uc774\uc2a4 \uce68\uc785";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"\uc6d0\uaca9 LAN\uc744 \ud1b5\ud55c \uc9c1\ub82c \uc5f0\uacb0 \uc138\uc158\uc774 \uc124\uc815\ub418\uc5c8\uc2b5\ub2c8\ub2e4."; if(1==c[2])return"LAN\uc744 \ud1b5\ud55c \uc6d0\uaca9 \uc9c1\ub82c \uc138\uc158\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790 \ucee8\ud2b8\ub864\uc774 \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4.";if(2==c[2])return"\uc6d0\uaca9 IDE \ub9ac\ub514\ub809\uc158 \uc138\uc158\uc774 \uc124\uc815\ub418\uc5c8\uc2b5\ub2c8\ub2e4.";if(3==c[2])return"\uc6d0\uaca9 IDE \ub9ac\ub514\ub809\uc158 \uc138\uc158\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790 \ucee8\ud2b8\ub864\uc774 \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}if(36== @@ -97,23 +96,23 @@ a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="\uc5f4 "\ud544\ud130"+a+" \uc5d0 \uc77c\uce58\ud588\ub2e4"+b+" \uc0c1\ud638 \uc791\uc6a9.";if(192==a)return 0==c[2]?"\ubcf4\uc548 \uc815\ucc45\uc774 \ud638\ucd9c\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uc77c\ubd80 \ub610\ub294 \ubaa8\ub4e0 \ub124\ud2b8\uc6cc\ud06c \ud2b8\ub798\ud53d (TX)\uc774 \uc911\uc9c0\ub418\uc5c8\uc2b5\ub2c8\ub2e4.":2==c[2]?"\ubcf4\uc548 \uc815\ucc45\uc774 \ud638\ucd9c\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uc77c\ubd80 \ub610\ub294 \ubaa8\ub4e0 \ub124\ud2b8\uc6cc\ud06c \ud2b8\ub798\ud53d (RX)\uc774 \uc911\uc9c0\ub418\uc5c8\uc2b5\ub2c8\ub2e4.": "\ubcf4\uc548 \uc815\ucc45\uc774 \ud638\ucd9c\ub418\uc5c8\uc2b5\ub2c8\ub2e4.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"\uc6d0\uaca9 \uc5f0\uacb0\uc5d0 \ub300\ud55c \uc0ac\uc6a9\uc790 \uc694\uccad.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC \uc624\ub958 : Intel AMT\uc758 NAC\uac00 \ube44\ud65c\uc131\ud654\ub418\uc5b4\uc788\ub294 \ub3d9\uc548 \uc790\uc138\ub97c \uc5bb\uc73c\uc2ed\uc2dc\uc624.";if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA \uc624\ub958 : \uc77c\ubc18 \uc624\ub958"}return 6== a?"\uc778\uc99d \uc2e4\ud328"+(c[1]+(c[2]<<8))+" \ud0c0\uc784\uc2a4. \uc2dc\uc2a4\ud15c\uc774 \uacf5\uaca9\uc744 \ubc1b\uace0\uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.":30==a?"\ubd80\ud305 \uac00\ub2a5\ud55c \ubbf8\ub514\uc5b4\uac00 \uc5c6\uc2b5\ub2c8\ub2e4":32==a?"\uc6b4\uc601 \uccb4\uc81c \uc7a0\uae08 \ub610\ub294 \uc804\uc6d0 \uc911\ub2e8":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"\uc2dc\uc2a4\ud15c \ubd80\ud305 \uc2e4\ud328":37==a?"\uc2dc\uc2a4\ud15c \ud38c\uc6e8\uc5b4\uac00 \uc2dc\uc791\ub418\uc5c8\uc2b5\ub2c8\ub2e4 (\uc801\uc5b4\ub3c4 \ud558\ub098 \uc774\uc0c1\uc758 CPU\uac00 \uc62c\ubc14\ub974\uac8c \uc2e4\ud589 \uc911\uc784).": -"\uc54c \uc218\uc5c6\ub294 \uc13c\uc11c \uc720\ud615 #"+a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0\ud604\uc9c0",h=5);3==b.InitiatorType&&(b.Initiator="KVM \uae30\ubcf8 \ud3ec\ud2b8",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress= -a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount= -1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a), -function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y), -A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount= +1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a), +function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A), +z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -123,8 +122,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -145,8 +144,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -156,12 +155,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="\uc9c0\uc815\ub418\uc9c0 \uc54a\uc74c. ; \uc2dc\uc2a4\ud15c\uc5d0 \uc2dc\uc2a4\ud15c \uba54\ubaa8\ub9ac\uac00 \uc2e4\uc81c\ub85c \uc124\uce58\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. ; \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc2dc\uc2a4\ud15c \uba54\ubaa8\ub9ac\uac00\uc5c6\uace0 \uc124\uce58\ub41c \ubaa8\ub4e0 \uba54\ubaa8\ub9ac\uc5d0 \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ud558\ub4dc \ub514\uc2a4\ud06c / ATAPI / IDE \uc7a5\uce58 \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \uc2dc\uc2a4\ud15c \ubcf4\ub4dc \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ub514\uc2a4\ucf13 \ud558\uc704 \uc2dc\uc2a4\ud15c \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ud558\ub4dc \ub514\uc2a4\ud06c \ucee8\ud2b8\ub864\ub7ec \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 PS / 2 \ub610\ub294 USB \ud0a4\ubcf4\ub4dc \uc624\ub958. ; \uc774\ub3d9\uc2dd \ubd80\ud305 \ubbf8\ub514\uc5b4\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ube44\ub514\uc624 \ucee8\ud2b8\ub864\ub7ec \uc624\ub958. ; \ube44\ub514\uc624 \uc7a5\uce58\uac00 \uac10\uc9c0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. ; \ud38c\uc6e8\uc5b4 (BIOS) ROM \uc190\uc0c1\uc774 \uac10\uc9c0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. ; CPU \uc804\uc555 \ubd88\uc77c\uce58 (\ub3d9\uc77c\ud55c \uc804\uc6d0\uc744 \uacf5\uc720\ud558\ub294 \ud504\ub85c\uc138\uc11c\uc758 \uc804\uc555 \uc694\uad6c \uc0ac\ud56d\uc774 \uc77c\uce58\ud558\uc9c0 \uc54a\uc74c) ; CPU \uc18d\ub3c4 \uc77c\uce58 \uc2e4\ud328".split(";"), +[a,b,[]])};var E="\uc9c0\uc815\ub418\uc9c0 \uc54a\uc74c. ; \uc2dc\uc2a4\ud15c\uc5d0 \uc2dc\uc2a4\ud15c \uba54\ubaa8\ub9ac\uac00 \uc2e4\uc81c\ub85c \uc124\uce58\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. ; \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc2dc\uc2a4\ud15c \uba54\ubaa8\ub9ac\uac00\uc5c6\uace0 \uc124\uce58\ub41c \ubaa8\ub4e0 \uba54\ubaa8\ub9ac\uc5d0 \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ud558\ub4dc \ub514\uc2a4\ud06c / ATAPI / IDE \uc7a5\uce58 \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \uc2dc\uc2a4\ud15c \ubcf4\ub4dc \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ub514\uc2a4\ucf13 \ud558\uc704 \uc2dc\uc2a4\ud15c \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ud558\ub4dc \ub514\uc2a4\ud06c \ucee8\ud2b8\ub864\ub7ec \uc624\ub958. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 PS / 2 \ub610\ub294 USB \ud0a4\ubcf4\ub4dc \uc624\ub958. ; \uc774\ub3d9\uc2dd \ubd80\ud305 \ubbf8\ub514\uc5b4\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. ; \ubcf5\uad6c \ud560 \uc218\uc5c6\ub294 \ube44\ub514\uc624 \ucee8\ud2b8\ub864\ub7ec \uc624\ub958. ; \ube44\ub514\uc624 \uc7a5\uce58\uac00 \uac10\uc9c0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. ; \ud38c\uc6e8\uc5b4 (BIOS) ROM \uc190\uc0c1\uc774 \uac10\uc9c0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. ; CPU \uc804\uc555 \ubd88\uc77c\uce58 (\ub3d9\uc77c\ud55c \uc804\uc6d0\uc744 \uacf5\uc720\ud558\ub294 \ud504\ub85c\uc138\uc11c\uc758 \uc804\uc555 \uc694\uad6c \uc0ac\ud56d\uc774 \uc77c\uce58\ud558\uc9c0 \uc54a\uc74c) ; CPU \uc18d\ub3c4 \uc77c\uce58 \uc2e4\ud328".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="\uc9c0\uc815\ub418\uc9c0 \uc54a\uc74c ; \uae30\ud0c0 ; \uc54c \uc218 \uc5c6\uc74c ; \ud504\ub85c\uc138\uc11c ; \ub514\uc2a4\ud06c ; \uc8fc\ubcc0 \uc7a5\uce58 ; \uc2dc\uc2a4\ud15c \uad00\ub9ac \ubaa8\ub4c8 ; \uc2dc\uc2a4\ud15c \ubcf4\ub4dc ; \uba54\ubaa8\ub9ac \ubaa8\ub4c8 ; \ud504\ub85c\uc138\uc11c \ubaa8\ub4c8 ; \uc804\uc6d0 \uacf5\uae09 \uc7a5\uce58 ; \uce74\ub4dc\uc5d0 \ucd94\uac00 ; \uc804\uba74 \ud328\ub110 \ubcf4\ub4dc ; \ud6c4\uba74 \ud328\ub110 \ubcf4\ub4dc ; \uc804\uc6d0 \uc2dc\uc2a4\ud15c \ubcf4\ub4dc ; \ub4dc\ub77c\uc774\ube0c \ud6c4\uba74 \ud310 ; \uc2dc\uc2a4\ud15c \ub0b4\ubd80 \ud655\uc7a5 \ubcf4\ub4dc ; \ub2e4\ub978 \uc2dc\uc2a4\ud15c \ubcf4\ub4dc ; \ud504\ub85c\uc138\uc11c \ubcf4\ub4dc ; \uc804\uc6d0 \uc7a5\uce58 ; \uc804\uc6d0 \ubaa8\ub4c8 ; \uc804\uc6d0 \uad00\ub9ac \ubcf4\ub4dc ; \uc100\uc2dc \ud6c4\uba74 \ud328\ub110 \ubcf4\ub4dc ; \uc2dc\uc2a4\ud15c \uc100\uc2dc ; \uc11c\ube0c \uc100\uc2dc ; \uae30\ud0c0 \uc100\uc2dc \ubcf4\ub4dc ; \ub514\uc2a4\ud06c \ub4dc\ub77c\uc774\ube0c \ubca0\uc774 ; \uc8fc\ubcc0 \ubca0\uc774 ; \ub514\ubc14\uc774\uc2a4 \ubca0\uc774 ; \ud32c \ub0c9\uac01 ; \ub0c9\uac01 \uc7a5\uce58 ; \ucf00\uc774\ube14 \uc778\ud130\ucee4\ub125\ud2b8 ; \uba54\ubaa8\ub9ac \uc7a5\uce58 ; \uc2dc\uc2a4\ud15c \uad00\ub9ac \uc18c\ud504\ud2b8\uc6e8\uc5b4 ; BIOS ; \uc778\ud154 (r) ME ; \uc2dc\uc2a4\ud15c \ubc84\uc2a4 ; \uadf8\ub8f9 ; \uc778\ud154 (r) ME ; \uc678\ubd80 \ud658\uacbd ; \ubc30\ud130\ub9ac ; \ud504\ub85c\uc138\uc2f1 \ube14\ub808\uc774\ub4dc ; \uc5f0\uacb0 \uc2a4\uc704\uce58 ; \ud504\ub85c\uc138\uc11c / \uba54\ubaa8\ub9ac \ubaa8\ub4c8 ; I / O \ubaa8\ub4c8 ; \ud504\ub85c\uc138\uc11c I / O \ubaa8\ub4c8 ; \uad00\ub9ac \ucee8\ud2b8\ub864\ub7ec \ud38c\uc6e8\uc5b4 ; IPMI \ucc44\ub110 ; PCI \ubc84\uc2a4 ; PCI \uace0\uc18d \ubc84\uc2a4 ; SCSI \ubc84\uc2a4 ; SATA / SAS \ubc84\uc2a4 ; \ud504\ub85c\uc138\uc11c \uc804\uba74 \ubc84\uc2a4".split(";"); +l="\uc9c0\uc815\ub418\uc9c0 \uc54a\uc74c ; \uae30\ud0c0 ; \uc54c \uc218 \uc5c6\uc74c ; \ud504\ub85c\uc138\uc11c ; \ub514\uc2a4\ud06c ; \uc8fc\ubcc0 \uc7a5\uce58 ; \uc2dc\uc2a4\ud15c \uad00\ub9ac \ubaa8\ub4c8 ; \uc2dc\uc2a4\ud15c \ubcf4\ub4dc ; \uba54\ubaa8\ub9ac \ubaa8\ub4c8 ; \ud504\ub85c\uc138\uc11c \ubaa8\ub4c8 ; \uc804\uc6d0 \uacf5\uae09 \uc7a5\uce58 ; \uce74\ub4dc\uc5d0 \ucd94\uac00 ; \uc804\uba74 \ud328\ub110 \ubcf4\ub4dc ; \ud6c4\uba74 \ud328\ub110 \ubcf4\ub4dc ; \uc804\uc6d0 \uc2dc\uc2a4\ud15c \ubcf4\ub4dc ; \ub4dc\ub77c\uc774\ube0c \ud6c4\uba74 \ud310 ; \uc2dc\uc2a4\ud15c \ub0b4\ubd80 \ud655\uc7a5 \ubcf4\ub4dc ; \ub2e4\ub978 \uc2dc\uc2a4\ud15c \ubcf4\ub4dc ; \ud504\ub85c\uc138\uc11c \ubcf4\ub4dc ; \uc804\uc6d0 \uc7a5\uce58 ; \uc804\uc6d0 \ubaa8\ub4c8 ; \uc804\uc6d0 \uad00\ub9ac \ubcf4\ub4dc ; \uc100\uc2dc \ud6c4\uba74 \ud328\ub110 \ubcf4\ub4dc ; \uc2dc\uc2a4\ud15c \uc100\uc2dc ; \uc11c\ube0c \uc100\uc2dc ; \uae30\ud0c0 \uc100\uc2dc \ubcf4\ub4dc ; \ub514\uc2a4\ud06c \ub4dc\ub77c\uc774\ube0c \ubca0\uc774 ; \uc8fc\ubcc0 \ubca0\uc774 ; \ub514\ubc14\uc774\uc2a4 \ubca0\uc774 ; \ud32c \ub0c9\uac01 ; \ub0c9\uac01 \uc7a5\uce58 ; \ucf00\uc774\ube14 \uc778\ud130\ucee4\ub125\ud2b8 ; \uba54\ubaa8\ub9ac \uc7a5\uce58 ; \uc2dc\uc2a4\ud15c \uad00\ub9ac \uc18c\ud504\ud2b8\uc6e8\uc5b4 ; BIOS ; \uc778\ud154 (r) ME ; \uc2dc\uc2a4\ud15c \ubc84\uc2a4 ; \uadf8\ub8f9 ; \uc778\ud154 (r) ME ; \uc678\ubd80 \ud658\uacbd ; \ubc30\ud130\ub9ac ; \ud504\ub85c\uc138\uc2f1 \ube14\ub808\uc774\ub4dc ; \uc5f0\uacb0 \uc2a4\uc704\uce58 ; \ud504\ub85c\uc138\uc11c / \uba54\ubaa8\ub9ac \ubaa8\ub4c8 ; I / O \ubaa8\ub4c8 ; \ud504\ub85c\uc138\uc11c I / O \ubaa8\ub4c8 ; \uad00\ub9ac \ucee8\ud2b8\ub864\ub7ec \ud38c\uc6e8\uc5b4 ; IPMI \ucc44\ub110 ; PCI \ubc84\uc2a4 ; PCI \uace0\uc18d \ubc84\uc2a4 ; SCSI \ubc84\uc2a4 ; SATA / SAS \ubc84\uc2a4 ; \ud504\ub85c\uc138\uc11c \uc804\uba74 \ubc84\uc2a4".split(";"); e.RealmNames=";; \ub9ac\ub514\ub809\uc158 ;; \ud558\ub4dc\uc6e8\uc5b4 \uc790\uc0b0 ; \uc6d0\uaca9 \uc81c\uc5b4 ; \uc2a4\ud1a0\ub9ac\uc9c0 ; \uc774\ubca4\ud2b8 \uad00\ub9ac\uc790 ; \uc2a4\ud1a0\ub9ac\uc9c0 \uad00\ub9ac\uc790 ; \uc5d0\uc774\uc804\ud2b8 \ud504\ub808\uc98c\uc2a4 \ub85c\uceec ; \uc5d0\uc774\uc804\ud2b8 \ud504\ub808\uc98c\uc2a4 \uc6d0\uaca9 ; \ud68c\ub85c \ucc28\ub2e8\uae30 ; \ub124\ud2b8\uc6cc\ud06c \uc2dc\uac04 ; \uc77c\ubc18 \uc815\ubcf4 ; \ud38c\uc6e8\uc5b4 \uc5c5\ub370\uc774\ud2b8 ; EIT ; LocalUN ; \uc5d4\ub4dc \ud3ec\uc778\ud2b8 \uc561\uc138\uc2a4 \uc81c\uc5b4 ; \uc5d4\ub4dc \ud3ec\uc778\ud2b8 \uc561\uc138\uc2a4 \uc81c\uc5b4 \uad00\ub9ac\uc790 ; \uc774\ubca4\ud2b8 \ub85c\uadf8 \ub9ac\ub354 ; \uac10\uc0ac \ub85c\uadf8 ; ACL \uc601\uc5ed ;;; \ub85c\uceec \uc2dc\uc2a4\ud15c".split(";"); e.WatchdogCurrentStates={1:"\uc2dc\uc791\ub418\uc9c0 \uc54a\uc74c",2:"\uc911\uc9c0",4:"\ub2ec\ub9ac\ub294",8:"\ub9cc\ub8cc",16:"\ub9e4\ub2ec\ub9b0"};var h="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(";"),r=";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(";"), -K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"\ubcf4\uc548 \uad00\ub9ac\uc790",17:"RCO",18:"\ub9ac\ub514\ub809\uc158 \uad00\ub9ac\uc790",19:"\ud38c\uc6e8\uc5b4 \uc5c5\ub370\uc774\ud2b8 \uad00\ub9ac\uc790",20:"\ubcf4\uc548 \uac10\uc0ac \ub85c\uadf8",21:"\ub124\ud2b8\uc6cc\ud06c \uc2dc\uac04",22:"\ub124\ud2b8\uc6cc\ud06c \uad00\ub9ac",23:"\uc2a4\ud1a0\ub9ac\uc9c0 \uad00\ub9ac",24:"\uc774\ubca4\ud2b8 \uad00\ub9ac\uc790",25:"\ud68c\ub85c \ucc28\ub2e8\uae30 \uad00\ub9ac\uc790",26:"\uc0c1\ub2f4\uc6d0 \ud604\uc7ac \uc0c1\ud0dc \uad00\ub9ac\uc790", +O={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"\ubcf4\uc548 \uad00\ub9ac\uc790",17:"RCO",18:"\ub9ac\ub514\ub809\uc158 \uad00\ub9ac\uc790",19:"\ud38c\uc6e8\uc5b4 \uc5c5\ub370\uc774\ud2b8 \uad00\ub9ac\uc790",20:"\ubcf4\uc548 \uac10\uc0ac \ub85c\uadf8",21:"\ub124\ud2b8\uc6cc\ud06c \uc2dc\uac04",22:"\ub124\ud2b8\uc6cc\ud06c \uad00\ub9ac",23:"\uc2a4\ud1a0\ub9ac\uc9c0 \uad00\ub9ac",24:"\uc774\ubca4\ud2b8 \uad00\ub9ac\uc790",25:"\ud68c\ub85c \ucc28\ub2e8\uae30 \uad00\ub9ac\uc790",26:"\uc0c1\ub2f4\uc6d0 \ud604\uc7ac \uc0c1\ud0dc \uad00\ub9ac\uc790", 27:"\ubb34\uc120 \uad6c\uc131",28:"EAC",29:"KVM",30:"\uc0ac\uc6a9\uc790 \uc635\ud2b8 \uc778 \uc774\ubca4\ud2b8",32:"\uc2a4\ud06c\ub9b0 \ube14\ub7ad\ud0b9",33:"\uc6cc\uce58 \ub3c5 \uc774\ubca4\ud2b8",1600:"\ud504\ub85c\ube44\uc800\ub2dd \uc2dc\uc791",1601:"\ud504\ub85c\ube44\uc800\ub2dd \uc644\ub8cc",1602:"ACL \ud56d\ubaa9 \ucd94\uac00",1603:"ACL \ud56d\ubaa9 \uc218\uc815",1604:"ACL \ud56d\ubaa9 \uc81c\uac70",1605:"\uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc740 ACL \uc561\uc138\uc2a4", 1606:"ACL \ud56d\ubaa9 \uc0c1\ud0dc",1607:"TLS \uc0c1\ud0dc \ubcc0\uacbd",1608:"TLS \uc11c\ubc84 \uc778\uc99d\uc11c \uc138\ud2b8",1609:"TLS \uc11c\ubc84 \uc778\uc99d\uc11c \uc81c\uac70",1610:"TLS \uc2e0\ub8b0\ud560 \uc218\uc788\ub294 \ub8e8\ud2b8 \uc778\uc99d\uc11c \ucd94\uac00",1611:"TLS \uc2e0\ub8b0\ud560 \uc218\uc788\ub294 \ub8e8\ud2b8 \uc778\uc99d\uc11c \uc81c\uac70",1612:"TLS \uc0ac\uc804 \uacf5\uc720 \ud0a4 \uc138\ud2b8",1613:"Kerberos \uc124\uc815 \uc218\uc815",1614:"Kerberos \uae30\ubcf8 \ud0a4 \uc218\uc815", 1615:"\ud50c\ub798\uc2dc \ub9c8\ubaa8 \uce74\uc6b4\ud130 \ub9ac\uc14b",1616:"\ud30c\uc6cc \ud328\ud0a4\uc9c0 \uc218\uc815",1617:"\uc601\uc5ed \uc778\uc99d \ubaa8\ub4dc \uc124\uc815",1618:"\ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \uad00\ub9ac\uc790 \uc81c\uc5b4 \ubaa8\ub4dc\ub85c \uc5c5\uadf8\ub808\uc774\ub4dc",1619:"\ud504\ub85c\ube44\uc800\ub2dd \ud574\uc81c \uc2dc\uc791",1700:"\uc218\ud589 \ub41c \uc804\uc6d0 \ucf1c\uae30",1701:"\uc218\ud589 \ub41c \uc804\uc6d0 \ucc28\ub2e8",1702:"\uc218\ud589 \ub41c \uc804\uc6d0\uc8fc\uae30", @@ -174,18 +173,18 @@ K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"\ubcf4\uc548 \uad00\ub9ac\uc79 2901:"KVM \uc635\ud2b8 \uc778 \ube44\ud65c\uc131\ud654",2902:"KVM \ube44\ubc00\ubc88\ud638 \ubcc0\uacbd",2903:"KVM \ub3d9\uc758 \uc131\uacf5",2904:"KVM \ub3d9\uc758 \uc2e4\ud328",3E3:"\uc635\ud2b8 \uc778 \uc815\ucc45 \ubcc0\uacbd",3001:"\ub3d9\uc758 \ucf54\ub4dc \uc774\ubca4\ud2b8 \ubcf4\ub0b4\uae30",3002:"\uc218\uc2e0 \uac70\ubd80 \uc774\ubca4\ud2b8 \uc2dc\uc791",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"}; e.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["\uc798\ubabb\ub41c ME \uc561\uc138\uc2a4","\uc798\ubabb\ub41c MEBx \uc561\uc138\uc2a4"][b.charCodeAt(0)];if(1606==a){var c=["\ube44\ud65c\uc131\ud654","\uac00\ub2a5"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"\uba3c"+["NoAuth","ServerAuth","\uc0c1\ud638 \uc778\uc99d"][b.charCodeAt(0)]+ ", \ud604\uc9c0"+["NoAuth","ServerAuth","\uc0c1\ud638 \uc778\uc99d"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["NoAuth","\uc778\uc99d","\ube44\ud65c\uc131\ud654"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","\ud604\uc9c0 MEI","\ub85c\uceec WSMAN","\uc6d0\uaca9 WSAMN"][b.charCodeAt(0)]:1900==a?"\uc5d0\uc11c"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" \uc5d0"+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?"\uc5d0\uc11c"+["\uc5c6\uc74c","KVM","\ubaa8\ub450"][b.charCodeAt(0)]+" \uc5d0"+["\uc5c6\uc74c","KVM","\ubaa8\ub450"][b.charCodeAt(1)]:3001==a?["\uc131\uacf5","3 \ud68c \uc2e4\ud328"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};return e}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))} +ReadInt(b,0)+6E4*(new Date).getTimezoneOffset()),c.toLocaleString()):3E3==a?"\uc5d0\uc11c"+["\uc5c6\uc74c","KVM","\ubaa8\ub450"][b.charCodeAt(0)]+" \uc5d0"+["\uc5c6\uc74c","KVM","\ubaa8\ub450"][b.charCodeAt(1)]:3001==a?["\uc131\uacf5","3 \ud68c \uc2e4\ud328"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__namespace,d=a?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",d,e,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|e>>4),isNaN(e)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",d,e,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|e>>4),isNaN(e)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -254,27 +253,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -899,43 +897,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    \ubd88\ub7ec\uc624\ub294 \uc911 ...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -951,7 +949,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -969,30 +967,30 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"\uc2dc\uacc4 \ub3d9\uae30\ud654",3,syncClockEx,"\uc774 \ucef4\ud4e8\ud130\uc640 Intel AMT \uc2dc\uacc4\ub97c \ub3d9\uae30\ud654 \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","\uc2dc\uac04\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc ="+d):0!=a.Body.ReturnValue?messagebox("","\uc2dc\uac04\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc624\ub958 : "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})} var DMTFPowerStates=";;\uc804\uc6d0 \ucf1c\uc9d0;\uac00\ubcbc\uc6b4 \uc218\uba74;\uae4a\uc740 \uc7a0;\uc804\uc6d0 \uc0ac\uc774\ud074 (\uc18c\ud504\ud2b8 \uc624\ud504);\uaebc\uc9d0-\ud558\ub4dc;\ucd5c\ub300 \uc808\uc804 \ubaa8\ub4dc;\uc18c\ud504\ud2b8 \uc624\ud504;\uc804\uc6d0\uc744 \uaed0\ub2e4 \ucf1c\uc2ed\uc2dc\uc624 (\uaebc\uc9d0);\uba54\uc778 \ubc84\uc2a4 \ub9ac\uc14b;\uc9c4\ub2e8 \uc778\ud130\ub7fd\ud2b8 (NMI);\ud574\ub2f9 \uc0ac\ud56d \uc5c6\uc74c;\uaebc\uc9d0-\ubd80\ub4dc\ub7fd\uace0 \uc6b0\uc544\ud55c;\ub044\uae30-\ub2e8\ub2e8\ud568;\uc6b0\uc544\ud55c \ub9c8\uc2a4\ud130 \ubc84\uc2a4 \ub9ac\uc14b;\uc804\uc6d0\uc8fc\uae30 (\uaebc\uc9d0-\uc18c\ud504\ud2b8 \uc6b0\uc544\ud568);\uc804\uc6d0\uc744 \uaed0\ub2e4 \ucf1c\uc2ed\uc2dc\uc624 (\uaebc\uc9d0-\uc815\uc0c1 \uc791\ub3d9);\uc9c4\ub2e8 \uc778\ud130\ub7fd\ud2b8 (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99\uc54c \uc218 \uc5c6\ub294";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0\uc5c6\uc74c":EscapeHtml(c);d+=TableEntry("\uc774\ub984 \ubc0f \ub3c4\uba54\uc778", -addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+=TableEntry("\uc2dc\uc2a4\ud15c ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("\uc2dc\uc2a4\ud15c ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5\uc54c \uc218 \uc5c6\ub294";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0\uc5c6\uc74c":EscapeHtml(c);d+=TableEntry("\uc774\ub984 \ubc0f \ub3c4\uba54\uc778", +addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+=TableEntry("\uc2dc\uc2a4\ud15c ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("\uc2dc\uc2a4\ud15c ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["\uae30\ubcf8 \ub514\uc2a4\ud50c\ub808\uc774","\ubcf4\uc870 \ub514\uc2a4\ud50c\ub808\uc774","\uc138\ubc88\uc9f8 \ub514\uc2a4\ud50c\ub808\uc774"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+="\ud3ec\ud2b8 5900 \uc0ac\uc6a9"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    ");QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" \ub124\ud2b8\uc6cc\ud06c \uc124\uc815\uc744 \ubcc0\uacbd\ud558\uba74\uc774 \ud398\uc774\uc9c0\ub97c \uc0ac\uc6a9\ud558\uc9c0 \ubabb\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."); -d=d+"

    \uc77c\ubc18 \uc124\uc815

    "+TableStart();g="";"\uc5c6\uc74c"!=c&&(1==v.SharedFQDN&&(g=", OS\uc640 \uacf5\uc720"),0==v.SharedFQDN&&(g="OS\uc640 \ub2e4\ub978"));d+=TableEntry("\uc774\ub984 \ubc0f \ub3c4\uba54\uc778",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="\ube44\ud65c\uc131\ud654";1==v.DDNSUpdateEnabled?c="\uac01\uac01 \ud65c\uc131\ud654"+v.DDNSPeriodicUpdateInterval+" \ubd84, TTL\uc740"+v.DDNSTTL+" \uc758\uc0ac\ub85d":1==v.DDNSUpdateByDHCPServerEnabled&& +d=d+"

    \uc77c\ubc18 \uc124\uc815

    "+TableStart();g="";"\uc5c6\uc74c"!=c&&(1==u.SharedFQDN&&(g=", OS\uc640 \uacf5\uc720"),0==u.SharedFQDN&&(g="OS\uc640 \ub2e4\ub978"));d+=TableEntry("\uc774\ub984 \ubc0f \ub3c4\uba54\uc778",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName));c="\ube44\ud65c\uc131\ud654";1==u.DDNSUpdateEnabled?c="\uac01\uac01 \ud65c\uc131\ud654"+u.DDNSPeriodicUpdateInterval+" \ubd84, TTL\uc740"+u.DDNSTTL+" \uc758\uc0ac\ub85d":1==u.DDNSUpdateByDHCPServerEnabled&& (c="DHCP \uc11c\ubc84\ub85c \uc5c5\ub370\uc774\ud2b8");d+=TableEntry("\ub3d9\uc801 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+="

    "+(amtwirelessif==a?"\ubb34\uc120 \uc778\ud130\ud398\uc774\uc2a4":"\uc720\uc120 \uc778\ud130\ud398\uc774\uc2a4")+ -"

    ";d+=TableStart();d+=TableEntry("\uc5f0\uacb0 \uc0c1\ud0dc",1==c.LinkIsUp?"\uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4":"\ub9c1\ud06c\uac00 \ub2e4\uc6b4\ub418\uc5c8\uc2b5\ub2c8\ub2e4");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("\ub9c1\ud06c \uc815\ucc45",addLinkConditional(0== +"";d+=TableStart();d+=TableEntry("\uc5f0\uacb0 \uc0c1\ud0dc",1==c.LinkIsUp?"\uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4":"\ub9c1\ud06c\uac00 \ub2e4\uc6b4\ub418\uc5c8\uc2b5\ub2c8\ub2e4");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("\ub9c1\ud06c \uc815\ucc45",addLinkConditional(0== g.length?"\uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4":"\uac00\ub2a5: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC \uc8fc\uc18c",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("\uc0c1\ud0dc",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("\ub77c\ub514\uc624 \uc0c1\ud0dc", xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"\uc5c6\uc74c")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?"\uac00\ub2a5":"\ube44\ud65c\uc131\ud654", "showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"\uac00\ub2a5":"\ube44\ud65c\uc131\ud654","showUefiWifiCoExDlg()", -xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("\ud551\uc5d0 \uc751\ub2f5",addLinkConditional(["\ube44\ud65c\uc131\ud654","ICMP \uc751\ub2f5","RMCP \uc751\ub2f5","ICMP \ubc0f RMCP \uc751\ub2f5"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"DHCP \uc11c\ubc84\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc790\ub3d9":"\uace0\uc815 IP \uc8fc\uc18c",1==c.IpSyncEnabled&&(g+=", IP sync with OS"), +xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("\ud551\uc5d0 \uc751\ub2f5",addLinkConditional(["\ube44\ud65c\uc131\ud654","ICMP \uc751\ub2f5","RMCP \uc751\ub2f5","ICMP \ubc0f RMCP \uc751\ub2f5"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"DHCP \uc11c\ubc84\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc790\ub3d9":"\uace0\uc815 IP \uc8fc\uc18c",1==c.IpSyncEnabled&&(g+=", IP sync with OS"), d+=TableEntry("IPv4 \uc0c1\ud0dc",addLinkConditional(g,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4 \uc8fc\uc18c",isIpAddress(c.IPAddress,"\uc5c6\uc74c"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("IPv4 \uac8c\uc774\ud2b8\uc6e8\uc774 / \ub9c8\uc2a4\ud06c",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"\uc5c6\uc74c")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("IPv4 \ub3c4\uba54\uc778 \uc774\ub984 \uc11c\ubc84",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&& -5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="

      EventTime\ucd9c\ucc98\uae30\uc220";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTime\ucd9c\ucc98\uae30\uc220";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"\uc774\ubca4\ud2b8 \ub85c\uadf8\ub97c \uc9c0\uc6b0\uc2dc\uaca0\uc2b5\ub2c8\uae4c?"),setDialogMode(1,"\uc774\ubca4\ud2b8 \ub85c\uadf8",3,ClearLogEx))} function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("\uc774\ubca4\ud2b8 \ub85c\uadf8","\uc9c0\uc6b8 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc624\ub958 : "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("\uc2dc\uac01",c.Time.toLocaleString());a+=addHtmlValue("\ucd9c\ucc98",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("\uae30\uc220",c.Desc);a+=MoreStart();a+=addHtmlValue("\uc7a5\uce58 \uc8fc\uc18c",c.DeviceAddress);a+=addHtmlValue("\uc2e4\uc7ac",c.Entity);a+=addHtmlValue("\uc5d4\ud130\ud2f0 \uc778\uc2a4\ud134\uc2a4",c.EntityInstance);var d="",g;for(g in c.EventData)0 
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("\uc800\uc7a5...","SaveAuditLog()")+AddButton("\ub85c\uadf8 \uc9c0\uc6b0\uae30","ClearAuditLog()"))+"
    ");if(0==c.length)d="\uac10\uc0ac \ub85c\uadf8 \uc774\ubca4\ud2b8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."; -else{var g=0;d+="

      \uc2dc\uac01\ucc3d\uc2dc\uc790Action";for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,d)} +else{var g=0;d+="

      \uc2dc\uac01\ucc3d\uc2dc\uc790Action";for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0  '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","\uc778\ud154 AMT \uac10\uc0ac \ub85c\uadf8",auditLog)} function ClearAuditLog(b){QH(60,"\uac10\uc0ac \ub85c\uadf8\ub97c \uc9c0\uc6b0\uc2dc\uaca0\uc2b5\ub2c8\uae4c?");setDialogMode(1,"\uac10\uc0ac \ub85c\uadf8",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("\uac10\uc0ac \ub85c\uadf8","\uc624\ub958: "+d)} @@ -1074,9 +1072,9 @@ function issueCertButtonUpdate(){var b=getInputElement("certopen");QE("certopenp 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("\ubc1c\uae09 \uc99d\uba85\uc11c","\uc778\uc99d\uc11c\ub97c \ud574\ub3c5 / \ub514\ucf54\ub529 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.")} 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("\ubc1c\uae09 \uc99d\uba85\uc11c","\ud0a4 \ud398\uc5b4\ub97c \uc0dd\uc131\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc: "+d):0!=a.Body.ReturnValue?messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\ud0a4 \ud398\uc5b4\ub97c \uc0dd\uc131\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4."+a.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,a.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)} -function GenerateKeyPairResponse2(b,c,a,d,g){if(200!=d)messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\ud0a4 \ud398\uc5b4\ub97c \uc0dd\uc131\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc: "+d);else{b=null;for(var v in a)a[v].InstanceID==g&&(b=a[v].DERKey);a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};g={CN:"\uc2e0\ub8b0\ud560 \uc218\uc5c6\ub294 \ub8e8\ud2b8 \uc778\uc99d\uc11c"};if(null!=xxCaPrivateKey&& -xxCaSubjectAttributes)for(v in g={},xxCaSubjectAttributes)g[xxCaSubjectAttributes[v].shortName]=xxCaSubjectAttributes[v].value;v={name:"extKeyUsage"};Q("d11_cu4").checked&&(v.serverAuth=!0);Q("d11_cu5").checked&&(v.clientAuth=!0);Q("d11_cu6").checked&&(v.emailProtection=!0);Q("d11_cu7").checked&&(v.codeSigning=!0);Q("d11_cu8").checked&&(v.timeStamping=!0);v=amtcert_signWithCaKey(b,xxCaPrivateKey,a,g,v);null==v?messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\uc778\uc99d\uc11c\uc5d0 \uc11c\uba85 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."): -(v=forge.pki.certificateToPem(v).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(v.substring(27,v.length-25),GenerateKeyPairResponse4))}}function GenerateKeyPairResponse4(b,c,a,d){200!=d?messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\ud0a4 \ud398\uc5b4\ub97c \uc0dd\uc131\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc: "+d):PullCertificates()} +function GenerateKeyPairResponse2(b,c,a,d,g){if(200!=d)messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\ud0a4 \ud398\uc5b4\ub97c \uc0dd\uc131\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc: "+d);else{b=null;for(var u in a)a[u].InstanceID==g&&(b=a[u].DERKey);a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};g={CN:"\uc2e0\ub8b0\ud560 \uc218\uc5c6\ub294 \ub8e8\ud2b8 \uc778\uc99d\uc11c"};if(null!=xxCaPrivateKey&& +xxCaSubjectAttributes)for(u in g={},xxCaSubjectAttributes)g[xxCaSubjectAttributes[u].shortName]=xxCaSubjectAttributes[u].value;u={name:"extKeyUsage"};Q("d11_cu4").checked&&(u.serverAuth=!0);Q("d11_cu5").checked&&(u.clientAuth=!0);Q("d11_cu6").checked&&(u.emailProtection=!0);Q("d11_cu7").checked&&(u.codeSigning=!0);Q("d11_cu8").checked&&(u.timeStamping=!0);u=amtcert_signWithCaKey(b,xxCaPrivateKey,a,g,u);null==u?messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\uc778\uc99d\uc11c\uc5d0 \uc11c\uba85 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."): +(u=forge.pki.certificateToPem(u).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(u.substring(27,u.length-25),GenerateKeyPairResponse4))}}function GenerateKeyPairResponse4(b,c,a,d){200!=d?messagebox("\ubc1c\uae09 \uc99d\uba85\uc11c","\ud0a4 \ud398\uc5b4\ub97c \uc0dd\uc131\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc: "+d):PullCertificates()} function certificateAdded(b,c,a,d){200!=d||0!=a.Body.ReturnValue?messagebox("\uc778\uc99d\uc11c \ucd94\uac00","\uc778\uc99d\uc11c\ub97c \ucd94\uac00 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc624\ub958"+(200!=d?d:a.Body.ReturnValueStr)):PullCertificates()}function certificateRemoved(b,c,a,d){200!=d?messagebox("\uc778\uc99d\uc11c \uc81c\uac70","\uc778\uc99d\uc11c\ub97c \uc81c\uac70 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc624\ub958"+d):PullCertificates()} function getInputElement(b){var c=document.getElementsByTagName("input");for(t=0;t"+xxCertificates[c].XSubject.CN+"");b+="
    \uc99d\uba85\uc11c

    \uc778\ud154 ® AMT \uc5d0\uc774\uc804\ud2b8 \uc874\uc7ac \uac10\uc2dc \uae30\ub2a5\uc744 \uad00\ub9ac\ud558\uc2ed\uc2dc\uc624.

    "; if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    \uc0c1\ub2f4\uc6d0 \uc874\uc7ac \uac10\uc2dc\uae30\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+ -" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : \uae30\ub85d \ud560 \uc774\ubca4\ud2b8")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("\uc6cc\uce58 \ub3c5 \ucd94\uac00 ...","AddWatchdog()"));b+="
    ";QH(54,b)}} +b+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+ +" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : \uae30\ub85d \ud560 \uc774\ubca4\ud2b8")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("\uc6cc\uce58 \ub3c5 \ucd94\uac00 ...","AddWatchdog()"));b+="
    ";QH(54,b)}} function getWatchdogTransitionStr(b){if(31==b)return"\uc5b4\ub5a4 \uc8fc";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("\uae30\uc220",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("\ubaa8\ub2c8\ud130\ub9c1 \ub300\uc0c1",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("\ud604\uc7ac \uc0c1\ud0dc",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("\ud65c\uc131\ud654 \ub41c \uc0c1\ud0dc",watchdogEnabledStates[b.EnabledState]); c+=addHtmlValue("\uc2dc\uc791 \uac04\uaca9",b.StartupInterval+" \ucd08");c+=addHtmlValue("\ud0c0\uc784 \uc544\uc6c3 \uac04\uaca9",b.TimeoutInterval+" \ucd08");setDialogMode(11,format("\uc6cc\uce58 \ub3c5 {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1123,11 +1121,11 @@ if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
    "+EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    \uc778\ud154 ® AMT \uc2dc\uc2a4\ud15c \ubc29\uc5b4 \ud544\ud130\ub97c \uad00\ub9ac\ud569\ub2c8\ub2e4.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    \uc2dc\uc2a4\ud15c \ubc29\uc5b4 \ud544\ud130\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.

    ";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a= xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="\ubaa8\ub4e0 \uc774\ub354\ub137 \ud504\ub85c\ud1a0\ucf5c"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" ...\uc5d0\uc11c"+a.FilterProfileData+" \ud328\ud0b7 / \ucd08"),1==a.ActionEventOnMatch&&(d+=", \uacbd\uae30 \uc911 \uc774\ubca4\ud2b8"),b+="
    "+(0==a.FilterDirection? "← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="\ubaa8\ub4e0 \uc774\ub354\ub137 \ud504\ub85c\ud1a0\ucf5c"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" ...\uc5d0\uc11c"+a.FilterProfileData+" \ud328\ud0b7 / \ucd08");1==a.ActionEventOnMatch&&(d+=", \uacbd\uae30 \uc911 \uc774\ubca4\ud2b8"); -var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("\ud544\ud130 \ucd94\uac00 ...","AddDefenseFilter()")+AddButton("\uc815\ucc45 \ucd94\uac00 ...","AddDefensePolicy()"));QH(53,b); +var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("\ud544\ud130 \ucd94\uac00 ...","AddDefenseFilter()")+AddButton("\uc815\ucc45 \ucd94\uac00 ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    \uae30\ubcf8 \uc815\ucc45
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1140,12 +1138,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="HDR"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="HDR"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("\uc2dc\uc2a4\ud15c \ubc29\uc5b4 \ud544\ud130 \ucd94\uac00","\ud544\ud130\ub97c \ucd94\uac00 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc624\ub958 #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="\uc774\ub354\ub137 \ud2b8\ub798\ud53d",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="\ubaa8\ub4e0 \uc774\ub354\ub137 \ud504\ub85c\ud1a0\ucf5c"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="IP \ud2b8\ub798\ud53d",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="\ubaa8\ub4e0 IP \ud504\ub85c\ud1a0\ucf5c"+d.HdrIPVersion)); -var n;n=""+addHtmlValue("\uc774\ub984",EscapeHtml(d.Name));n+=addHtmlValue("\uc720\ud615",g);n+=addHtmlValue("\uc77c\uce58\ud558\ub294 \ud2b8\ub798\ud53d",a);n+=addHtmlValue("\ubc29\ud5a5",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("\ud544\ud130"+ -a,g));n+=addHtmlValue("\uacbd\uae30 \uc911 \uc774\ubca4\ud2b8",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"\uc774\ub354\ub137 \ud544\ud130 #"+d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)} +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="\uc774\ub354\ub137 \ud2b8\ub798\ud53d",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="\ubaa8\ub4e0 \uc774\ub354\ub137 \ud504\ub85c\ud1a0\ucf5c"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="IP \ud2b8\ub798\ud53d",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="\ubaa8\ub4e0 IP \ud504\ub85c\ud1a0\ucf5c"+d.HdrIPVersion)); +var n;n=""+addHtmlValue("\uc774\ub984",EscapeHtml(d.Name));n+=addHtmlValue("\uc720\ud615",g);n+=addHtmlValue("\uc77c\uce58\ud558\ub294 \ud2b8\ub798\ud53d",a);n+=addHtmlValue("\ubc29\ud5a5",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("\ud544\ud130"+ +a,g));n+=addHtmlValue("\uacbd\uae30 \uc911 \uc774\ubca4\ud2b8",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"\uc774\ub354\ub137 \ud544\ud130 #"+d.InstanceID,5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)} function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("\ud544\ud130 \uc81c\uac70","\ud544\ud130\ub97c \uc81c\uac70 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9 \uc911\uc774 \uc544\ub2cc\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    \uc774\ub984
    \uae30\ubcf8 TX / RX
    ';b+= "
    ";if(0
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("\uc800\uc7a5...","SaveHardwareLog()")+" \ud558\ub4dc\uc6e8\uc5b4 \uc815\ubcf4\ub294 \uc2dc\uc2a4\ud15c \ubd80\ud305\uc2dc \uc218\uc9d1\ub429\ub2c8\ub2e4.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+ +function processHardware(b,c,a,d){if(200==d){var g;b="
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("\uc800\uc7a5...","SaveHardwareLog()")+" \ud558\ub4dc\uc6e8\uc5b4 \uc815\ubcf4\ub294 \uc2dc\uc2a4\ud15c \ubd80\ud305\uc2dc \uc218\uc9d1\ub429\ub2c8\ub2e4.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+ "

    \ud50c\ub7ab\ud3fc

    "+FullTable({"\ucef4\ud4e8\ud130 \ubaa8\ub378":c.Model,"\uc81c\uc870\uc0ac":c.Manufacturer,"\ubc84\uc804":c.Version,"\uc77c\ub828 \ubc88\ud638":c.SerialNumber,"\uc2dc\uc2a4\ud15c ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    \ubca0\uc774\uc2a4 \ubcf4\ub4dc

    ";b+=FullTable({"\uc81c\uc870\uc0ac":d.Manufacturer,"\uc0c1\ud488\uba85":d.Model,"\ubc84\uc804":d.Version,"\uc77c\ub828 \ubc88\ud638":d.SerialNumber,"\uc790\uc0b0 \ud0dc\uadf8":d.Tag, -"\uad50\uccb4 \uac00\ub2a5?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({"\uacf5\uae09 \uc5c5\uccb4":a.CIM_BIOSElement.response.Manufacturer,"\ubc84\uc804":v,"\ucd9c\uc2dc\uc77c":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    \ud504\ub85c\uc138\uc11c "+(parseInt(g)+1)+"

    ",b+=FullTable({"\uc81c\uc870\uc0ac":trademarks(d.Manufacturer), +"\uad50\uccb4 \uac00\ub2a5?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({"\uacf5\uae09 \uc5c5\uccb4":a.CIM_BIOSElement.response.Manufacturer,"\ubc84\uc804":u,"\ucd9c\uc2dc\uc77c":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    \ud504\ub85c\uc138\uc11c "+(parseInt(g)+1)+"

    ",b+=FullTable({"\uc81c\uc870\uc0ac":trademarks(d.Manufacturer), "\uac00\uc871":DMTFProcFamilly[c.Family],"\ubc84\uc804":trademarks(d.Version),"\ucd5c\ub300 \uc18c\ucf13 \uc18d\ub3c4":c.MaxClockSpeed+" MHz","\uc0c1\ud0dc":DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

    \uba54\ubaa8\ub9ac \ubaa8\ub4c8 "+(+g+1)+"

    ",b+=FullTable({"\uc740\ud589 \ub77c\ubca8":c.BankLabel,"\uc81c\uc870\uc0ac":c.Manufacturer,"\uc77c\ub828 \ubc88\ud638":c.SerialNumber,"\ud06c\uae30":parseInt(c.Capacity/1048576)+ " MB","\ud3fc \ud329\ud130":DMTFMemFormFactor[c.FormFactor],"\uc720\ud615":DMTFMemType[c.MemoryType],"\uc790\uc0b0 \ud0dc\uadf8":c.Tag,"\ubd80\ud488 \ubc88\ud638":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

    \uc800\uc7a5 \ub9e4\uccb4 "+(parseInt(g)+1)+"

    ",b+=FullTable({"\ubaa8\ub378":d.Model,"\uc77c\ub828 \ubc88\ud638":""==d.SerialNumber?"Unknown":d.SerialNumber,"\ud06c\uae30":parseInt(Math.round(1E3* c.MaxMediaSize/1048576))+" MB"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+="

    Battery

    ",g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,"\uc81c\uc870\uc0ac":c.Manufacturer,"Manufacture date":g,"\uc77c\ub828 \ubc88\ud638":c.SerialNumber,"\uc720\ud615":"\ub2e4\ub978;\uc54c \uc218 \uc5c6\ub294;Lead Acid;Nickel Cadmium;Nickel Metal Hydride;Lithium-ion;Zinc air;Lithium Polymer".split(";")[a.CIM_Battery.response.Chemistry], @@ -1195,19 +1193,19 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

    \uc774 \ucef4\ud4e8\ud130\uc758 \uc778\ud154 ® AMT \uc0ac\uc6a9\uc790 \uacc4\uc815\uc744 \uad00\ub9ac\ud558\uc2ed\uc2dc\uc624.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled? -1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==v&&(n+="\uc7a5\uc560\uc778,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a["\uc601\uc5ed"][c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="\uac10\uc0ac,");n=0<=a.Realms.indexOf(3)?n+"\uad00\ub9ac\uc790":1==l?n+"1 \uac1c \uc601\uc5ed":n+(l+" \uc601\uc5ed")}else n+="\uad00\ub9ac\uc790",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='

    \uc774 \ucef4\ud4e8\ud130\uc758 \uc778\ud154 ® AMT \uc0ac\uc6a9\uc790 \uacc4\uc815\uc744 \uad00\ub9ac\ud558\uc2ed\uc2dc\uc624.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled? +1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==u&&(n+="\uc7a5\uc560\uc778,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a["\uc601\uc5ed"][c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="\uac10\uc0ac,");n=0<=a.Realms.indexOf(3)?n+"\uad00\ub9ac\uc790":1==k?n+"1 \uac1c \uc601\uc5ed":n+(k+" \uc601\uc5ed")}else n+="\uad00\ub9ac\uc790",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("\uc0c8 \uacc4\uc815","newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"\uacc4\uc815 \ud3b8\uc9d1",-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,"\uc0c8 \uacc4\uc815",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("\uacc4\uc815 \uc624\ub958","\uc798\ubabb\ub41c \ub9e4\uac1c \ubcc0\uc218");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&& -a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("\uacc4\uc815 \uc624\ub958","\uc798\ubabb\ub41c \ub9e4\uac1c \ubcc0\uc218");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&& +a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("\uc774\ub984",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("\uc0c1\ud0dc",1==xxAccountEnabledInfo[b].Enabled?"\uac00\ub2a5":"\ube44\ud65c\uc131\ud654"));if(g==xxAccountAdminName)a+=addHtmlValue("\ud5c8\uac00","\uad00\ub9ac\uc790");else{var a=a+addHtmlValue("\ud5c8\uac00",xxUserPermissions[c.AccessPermission]),v= -"";if(0<=c.Realms.indexOf(3))v="\uad00\ub9ac\uc790",0<=c.Realms.indexOf(20)&&(v+="\uac10\uc0ac");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("\uacc4\uc815"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("\uc774\ub984",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("\uc0c1\ud0dc",1==xxAccountEnabledInfo[b].Enabled?"\uac00\ub2a5":"\ube44\ud65c\uc131\ud654"));if(g==xxAccountAdminName)a+=addHtmlValue("\ud5c8\uac00","\uad00\ub9ac\uc790");else{var a=a+addHtmlValue("\ud5c8\uac00",xxUserPermissions[c.AccessPermission]),u= +"";if(0<=c.Realms.indexOf(3))u="\uad00\ub9ac\uc790",0<=c.Realms.indexOf(20)&&(u+="\uac10\uc0ac");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("\uacc4\uc815"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (\ube48)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    \uc624\ub958 #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1256,10 +1254,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+ -EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+ +EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"\uc12c\uae30\ub294 \uc0ac\ub78c":"")+"IDE-R \uc138\uc158 , \uc5f0\uacb0\ub428,"+ider.m.bytesFromAmt+" \uc5d0,"+ider.m.bytesToAmt+" \ubc16.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM \uc5d0\uc11c \ube14\ub85d\uc740 {0} \ubc14\uc774\ud2b8\uc785\ub2c8\ub2e4.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" \ud50c\ub85c\ud53c , \ube14\ub85d\uc740 {0} \ubc14\uc774\ud2b8\uc785\ub2c8\ub2e4.", -512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height=6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b CDROM \uc5d0\uc11c \ube14\ub85d\uc740 {0} \ubc14\uc774\ud2b8\uc785\ub2c8\ub2e4.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" \ud50c\ub85c\ud53c , \ube14\ub85d\uc740 {0} \ubc14\uc774\ud2b8\uc785\ub2c8\ub2e4.", +512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height=6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("\uc8fc\uae30\uc801 \uc5f0\uacb0",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    \uc778\ud154 ® AMT \uc6d0\uaca9 \uad00\ub9ac \uc11c\ubc84\ub97c \uad00\ub9ac\ud569\ub2c8\ub2e4.

    "; +var g=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName","\uc8fc\uae30\uc801");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format("{0} \ucd08\ub9c8\ub2e4",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("\uc8fc\uae30\uc801 \uc5f0\uacb0",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    \uc778\ud154 ® AMT \uc6d0\uaca9 \uad00\ub9ac \uc11c\ubc84\ub97c \uad00\ub9ac\ud569\ub2c8\ub2e4.

    "; if(0==xxCiraServers.length)b+="

    \uc6d0\uaca9 \uc11c\ubc84\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.

    ";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    \uc5f0\uacb0 \uad00\ub9ac\uc5d0 \uc0ac\uc6a9\ub418\ub294 HTTP \ud504\ub85d\uc2dc\ub97c \uad00\ub9ac\ud569\ub2c8\ub2e4.

    ", c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="

    \ud504\ub85d\uc2dc\uac00 \uad6c\uc131\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4.

    ";else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("\uc11c\ubc84 \ucd94\uac00...","AddRemoteAccessServer()"), a&&(d+=AddButton("\ud504\ub85d\uc2dc \ucd94\uac00 ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(52,b)}}var xxEditMpsPolicyType; @@ -1317,9 +1315,9 @@ c+="

    \uc774 \ucef4\ud4e8\ud130\uc758 \uc778\ud154 ® AMT \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \uad00\ub9ac\ud569\ub2c8\ub2e4.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v|| -p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+"\ubfcc\ub9ac";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("\ub2e4\uc6b4\ub85c\ub4dc","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" \ubc14\uc774\ud2b8
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c); --1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    \ud30c\uc77c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+= -"
    "+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("\uc5c5\ub85c\ub4dc ...","UploadToStorage()"):""));QH(55,a)}else QH(55,"\uc2a4\ud1a0\ub9ac\uc9c0 \ub370\uc774\ud130\ub97c\ub85c\ub4dc \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4 ...
    "+AddButton("\uc0c8\ub86d\uac8c \ud558\ub2e4","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("\uacf5\uae09 \uc5c5\uccb4",b));""!=c&&(g+=addHtmlValue("\uc2e0\uccad",c));g+=addHtmlValue("\uc774\ub984",a);g+=addHtmlValue("\ud06c\uae30",v.size+" bytes");v.link&&(g+=addHtmlValue("\ub9c1\ud06c",v.link));setDialogMode(11,"\ubcf4\uad00 \uc544\uc774\ud15c",5,showStorageDetailsEx,g,d)}} +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    \uc774 \ucef4\ud4e8\ud130\uc758 \uc778\ud154 ® AMT \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \uad00\ub9ac\ud569\ub2c8\ub2e4.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u|| +p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+"\ubfcc\ub9ac";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("\ub2e4\uc6b4\ub85c\ub4dc","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" \ubc14\uc774\ud2b8
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c); +-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==v&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    \ud30c\uc77c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+= +"
    "+TableEnd(AddRefreshButton("PullStorage()")+(u?AddButton("\uc5c5\ub85c\ub4dc ...","UploadToStorage()"):""));QH(55,a)}else QH(55,"\uc2a4\ud1a0\ub9ac\uc9c0 \ub370\uc774\ud130\ub97c\ub85c\ub4dc \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4 ...
    "+AddButton("\uc0c8\ub86d\uac8c \ud558\ub2e4","PullStorage()"))} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("\uacf5\uae09 \uc5c5\uccb4",b));""!=c&&(g+=addHtmlValue("\uc2e0\uccad",c));g+=addHtmlValue("\uc774\ub984",a);g+=addHtmlValue("\ud06c\uae30",u.size+" bytes");u.link&&(g+=addHtmlValue("\ub9c1\ud06c",u.link));setDialogMode(11,"\ubcf4\uad00 \uc544\uc774\ud15c",5,showStorageDetailsEx,g,d)}} function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("\uc800\uc7a5",format("\ud30c\uc77c (ERR {0})\uc744 \uc0ad\uc81c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ucef4\ud4e8\ud130 \uc804\uc6d0\uc774 \ucf1c\uc838 \uc788\ub294\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.",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","noopener,noreferrer");a.opener=null;a.focus()}} function PushToStorage(b,c,a){var d=null;7E3";else xxAlarms=null,b+="

    \ub4f1\ub85d \ub41c \uae68\uc6b0\uae30 \uacbd\ubcf4\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.

    "; d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("\ubaa8\ub4e0 \uc54c\ub78c \uc81c\uac70","RemoveAllAlarms()")+AddButton("\ub354\ud558\ub2e4","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"\ubaa8\ub4e0 \uc54c\ub78c \ud574\uc81c",3,RemoveAllAlarmsEx,"\ubaa8\ub4e0 \uc54c\ub78c \ud574\uc81c\ub97c \ud655\uc778 \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"\ubaa8\ub4e0 \uc54c\ub78c \ud574\uc81c",3,RemoveAllAlarmsEx,"\ubaa8\ub4e0 \uc54c\ub78c \ud574\uc81c\ub97c \ud655\uc778 \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"\uc0c8 \uc54c\ub78c \ucd94\uac00",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 \uc54c\ub78c\uc774 \ubbf8\ub798\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.",d)):0!=c.Body.ReturnValue?messagebox("\uc54c\ub78c \ucd94\uac00", -format("\uc54c\ub78c {0}\uc744 (\ub97c) \ucd94\uac00\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.
    \ud5a5\ud6c4 \uc54c\ub78c\uc744 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.",c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a, +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("\uc54c\ub78c \ucd94\uac00",format("\uc54c\ub78c\uc744 \ucd94\uac00\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4. \uc0c1\ud0dc : {0}.
    \uc54c\ub78c\uc774 \ubbf8\ub798\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.",d)):0!=c.Body.ReturnValue?messagebox("\uc54c\ub78c \ucd94\uac00", +format("\uc54c\ub78c {0}\uc744 (\ub97c) \ucd94\uac00\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.
    \ud5a5\ud6c4 \uc54c\ub78c\uc744 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.",c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a, b,c,d){200!=d?messagebox("\uc54c\ub78c \ud3b8\uc9d1",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("\uc774\ub984",c.ElementName)+addHtmlValue("\uc6e8\uc774\ud06c \ud0c0\uc784",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("\ub0b4\ubd80\uc758",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("\uae68\uc5b4 \ub09c \ud6c4",1==c.DeleteOnCompletion?"\uc54c\ub78c \uc0ad\uc81c":"\uc54c\ub78c \uc720\uc9c0")+"
    ";messagebox(format("\uc54c\ub78c {0}", -c.ElementName),a);setDialogMode(11,"\uacbd\ubcf4"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +c.ElementName),a);setDialogMode(11,"\uacbd\ubcf4"+c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")} +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")} var httpErrorTable={200:"\ud655\uc778",401:"\uc778\uc99d \uc624\ub958",408:"\ud0c0\uc784 \uc544\uc6c3 \uc5d0\ub7ec",601:"WSMAN \uad6c\ubb38 \ubd84\uc11d \uc624\ub958",602:"HTTP \uc751\ub2f5 \ud5e4\ub354\ub97c \uad6c\ubb38 \ubd84\uc11d \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4",603:"\uc608\uae30\uce58 \uc54a\uc740 HTTP \uc5f4\uac70 \ud615 \uc751\ub2f5",604:"\uc608\uae30\uce58 \uc54a\uc740 HTTP \ud480 \uc751\ub2f5",997:"\uc798\ubabb\ub41c \ub2e4\uc774\uc81c\uc2a4\ud2b8 \uc601\uc5ed"}; 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("\uc624\ub958 # {0}",b)),401==b&&QH(5,'\uc778\uc99d \uc624\ub958

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("\ud1b5\ud654 \uc624\ub958",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("\ud1b5\ud654 \uc624\ub958",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1} function TableStart(){return"

    "}function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""}function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"} function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Onjuiste data";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", -r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Onjuiste data";if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", +r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& 64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18== a&&170==c[0])return"Agent waakhond"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... veranderd in"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Case inbraak";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"Er is een externe Serial Over LAN-sessie tot stand gebracht.";if(1==c[2])return"Remote Serial Over LAN-sessie be\u00ebindigd. Gebruikerscontrole is hersteld.";if(2==c[2])return"Er is een externe IDE-omleidingssessie opgezet.";if(3== c[2])return"Remote IDE-Redirection-sessie voltooid. Gebruikerscontrole is hersteld."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="bedrade"),4294967293==a?"Alle ontvangen pakketfilter is gematcht"+b+" koppel.":4294967292==a?"Alle uitgaande pakketfilters zijn gematcht"+b+" koppel.":4294967290==a?"Er werd op een vervalst pakketfilter gezocht"+b+" koppel.":"Filter"+a+" werd gematcht op"+b+" koppel.";if(192==a)return 0==c[2]?"Beveiligingsbeleid ingeroepen. Een deel van of al het netwerkverkeer (TX) is gestopt.": 2==c[2]?"Beveiligingsbeleid ingeroepen. Sommige of al het netwerkverkeer (RX) werd gestopt.":"Beveiligingsbeleid ingeroepen.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Gebruikersverzoek voor externe verbinding.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC-fout: probeer houding te krijgen terwijl NAC in Intel\ufffd AMT is uitgeschakeld.";if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA-fout: algemene fout"}return 6==a?"Verificatie mislukt"+(c[1]+(c[2]<<8))+" keer. Het systeem wordt mogelijk aangevallen.": -30==a?"Geen opstartbare media":32==a?"Vergrendeling van besturingssysteem of stroomonderbreking":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"Systeem opstartfout":37==a?"Systeemfirmware is gestart (ten minste \u00e9\u00e9n CPU wordt correct uitgevoerd).":"Onbekend sensortype #"+a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0Lokaal",h=5);3==b.InitiatorType&&(b.Initiator="KVM-standaardpoort",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a), -b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)}, -0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountLokaal",h=5);3==b.InitiatorType&&(b.Initiator="KVM-standaardpoort",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a), +b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)}, +0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -121,8 +120,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -143,8 +142,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -154,11 +153,11 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="Niet gespecificeerd. ; Er is geen fysiek systeemgeheugen ge\u00efnstalleerd in het systeem. ; Geen bruikbaar systeemgeheugen, al het ge\u00efnstalleerde geheugen heeft een onherstelbare fout ervaren. ; Onherstelbare storing op de harde schijf / ATAPI / IDE-apparaat. ; Onherstelbare systeemkaartfout. ; Onherstelbare diskette subsysteemfout. ; Onherstelbare storing van harde schijfcontroller. ; Onherstelbare PS / 2- of USB-toetsenbordfout. ; Verwijderbare opstartmedia niet gevonden. ; Onherstelbare videocontrollerfout. ; Geen videoapparaat gedetecteerd. ; Firmware (BIOS) ROM-corruptie gedetecteerd. ; CPU-spanning komt niet overeen (processoren die dezelfde voeding delen hebben niet-overeenkomende spanningsvereisten) ; Fout bij het matchen van de CPU-snelheid".split(";"), +[a,b,[]])};var E="Niet gespecificeerd. ; Er is geen fysiek systeemgeheugen ge\u00efnstalleerd in het systeem. ; Geen bruikbaar systeemgeheugen, al het ge\u00efnstalleerde geheugen heeft een onherstelbare fout ervaren. ; Onherstelbare storing op de harde schijf / ATAPI / IDE-apparaat. ; Onherstelbare systeemkaartfout. ; Onherstelbare diskette subsysteemfout. ; Onherstelbare storing van harde schijfcontroller. ; Onherstelbare PS / 2- of USB-toetsenbordfout. ; Verwijderbare opstartmedia niet gevonden. ; Onherstelbare videocontrollerfout. ; Geen videoapparaat gedetecteerd. ; Firmware (BIOS) ROM-corruptie gedetecteerd. ; CPU-spanning komt niet overeen (processoren die dezelfde voeding delen hebben niet-overeenkomende spanningsvereisten) ; Fout bij het matchen van de CPU-snelheid".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="Niet gespecificeerd ; Overige ; Onbekend ; Processor ; Schijf ; Randapparatuur ; Systeembeheermodule ; Moederbord ; Geheugenmodule ; Processormodule ; Voeding ; Insteekkaart ; Voorpaneelbord ; Achterpaneelbord ; Voedingssysteembord ; Schijfbackplane ; Interne systeemuitbreiding kaart ; Andere moederbord ; Processor board ; Power unit ; Power module ; Power management board ; Chassis achterpaneel board ; Systeem chassis ; Sub chassis ; Andere chassis board ; Disk drive bay ; Perifere bay ; Device bay ; Ventilator koeling ; Koeleenheid ; Kabelverbinding ; Geheugenapparaat ; Systeembeheersoftware ; BIOS ; Intel (r) ME ; Systeembus ; Groep ; Intel (r) ME ; Externe omgeving ; Batterij ; Verwerkingsblad ; Connectiviteitsschakelaar ; Processor / geheugenmodule ; I / O-module ; Processor I / O-module ; Beheercontrollerfirmware ; IPMI-kanaal ; PCI-bus ; PCI-expressbus ; SCSI-bus ; SATA / SAS-bus ; Processor voorkant bus".split(";"); +l="Niet gespecificeerd ; Overige ; Onbekend ; Processor ; Schijf ; Randapparatuur ; Systeembeheermodule ; Moederbord ; Geheugenmodule ; Processormodule ; Voeding ; Insteekkaart ; Voorpaneelbord ; Achterpaneelbord ; Voedingssysteembord ; Schijfbackplane ; Interne systeemuitbreiding kaart ; Andere moederbord ; Processor board ; Power unit ; Power module ; Power management board ; Chassis achterpaneel board ; Systeem chassis ; Sub chassis ; Andere chassis board ; Disk drive bay ; Perifere bay ; Device bay ; Ventilator koeling ; Koeleenheid ; Kabelverbinding ; Geheugenapparaat ; Systeembeheersoftware ; BIOS ; Intel (r) ME ; Systeembus ; Groep ; Intel (r) ME ; Externe omgeving ; Batterij ; Verwerkingsblad ; Connectiviteitsschakelaar ; Processor / geheugenmodule ; I / O-module ; Processor I / O-module ; Beheercontrollerfirmware ; IPMI-kanaal ; PCI-bus ; PCI-expressbus ; SCSI-bus ; SATA / SAS-bus ; Processor voorkant bus".split(";"); e.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 Beheerder ; Gebeurtenislogboeklezer ; Auditlogboek ; ACL-domein ;;; Lokaal systeem".split(";");e.WatchdogCurrentStates={1:"Niet begonnen",2:"Gestopt",4:"Rennen",8:"Niet meer geldig",16:"Geschorst"};var h="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(";"), -r=";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(";"),K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Beveiligingsbeheerder",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",20:"Beveiligingsauditlogboek",21:"Netwerktijd",22:"Netwerk administratie",23:"Opslagbeheer",24:"Event Manager",25:"Circuit Breaker Manager", +r=";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(";"),O={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"Beveiligingsbeheerder",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",20:"Beveiligingsauditlogboek",21:"Netwerktijd",22:"Netwerk administratie",23:"Opslagbeheer",24:"Event Manager",25:"Circuit Breaker Manager", 26:"Agent Presence Manager",27:"Draadloze configuratie",28:"EAC",29:"KVM",30:"Gebruikersaanmeldingsgebeurtenissen",32:"Scherm leegmaken",33:"Watchdog-evenementen",1600:"Bevoorrading gestart",1601:"Provisioning voltooid",1602:"ACL-vermelding toegevoegd",1603:"ACL-vermelding gewijzigd",1604:"ACL-vermelding verwijderd",1605:"ACL-toegang met ongeldige referenties",1606:"ACL-status van binnenkomst",1607:"TLS-status gewijzigd",1608:"TLS-servercertificaatset",1609:"TLS-servercertificaat verwijderen",1610:"TLS Trusted Root Certificate toegevoegd", 1611:"TLS Trusted Root Certificate verwijderd",1612:"TLS vooraf gedeelde sleutelset",1613:"Kerberos-instellingen gewijzigd",1614:"Kerberos hoofdsleutel gewijzigd",1615:"Flash Versleten tellers Reset",1616:"Power Package gewijzigd",1617:"Stel Realm Authentication Mode in",1618:"Upgrade Client naar Admin Control Mode",1619:"Unprovisioning Begonnen",1700:"Power Up uitgevoerd",1701:"Uitschakelen uitgevoerd",1702:"Power Cycle uitgevoerd",1703:"Reset uitgevoerd",1704:"Stel opstartopties in",1705:"Remote graceful power down initiated", 1706:"Remote graceful reset initiated",1707:"Remote Standby initiated",1708:"Remote Hiberate initiated",1709:"Remote NMI initiated",1800:"IDER-sessie geopend",1801:"IDER-sessie gesloten",1802:"IDER ingeschakeld",1803:"IDER uitgeschakeld",1804:"SoL-sessie geopend",1805:"SoL-sessie gesloten",1806:"SoL ingeschakeld",1807:"SoL uitgeschakeld",1808:"KVM-sessie gestart",1809:"KVM-sessie be\u00ebindigd",1810:"KVM ingeschakeld",1811:"KVM uitgeschakeld",1812:"VNC-wachtwoord 3 keer mislukt",1900:"Firmware bijgewerkt", @@ -168,17 +167,17 @@ r=";No network connection available;Name resolution of URI failed;Connect to URI 2903:"KVM-toestemming geslaagd",2904:"KVM-toestemming mislukt",3E3:"Opt-in beleidswijziging",3001:"Toestemmingscode-gebeurtenis verzenden",3002:"Start opt-in geblokkeerde gebeurtenis",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.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["Ongeldige ME-toegang","Ongeldige MEBx-toegang"][b.charCodeAt(0)];if(1606==a){var c=["Gehandicapt","Ingeschakeld"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"Afgelegen"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Lokaal"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["NoAuth","Auth","Gehandicapt"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","Lokale MEI","Lokale WSMAN", "Externe WSAMN"][b.charCodeAt(0)]:1900==a?"Van"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" naar"+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?"Van"+["Geen","KVM","Allemaal"][b.charCodeAt(0)]+" naar"+["Geen","KVM","Allemaal"][b.charCodeAt(1)]:3001==a?["Succes","3 keer mislukt"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1, -q,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +v,[a,[]])};return e}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?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -247,27 +246,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -892,43 +890,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    Bezig met laden...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -944,7 +942,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -961,28 +959,28 @@ c.push("*CIM_BootService");amtstack.BatchEnum("",c,processSystemStatus,!0);1==b& 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 g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Synchroniseer klok",3,syncClockEx,"Intel AMT-klok synchroniseren met deze computer?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Kan tijd niet instellen, status ="+d):0!=a.Body.ReturnValue?messagebox("","Kan tijd niet instellen, fout: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}var DMTFPowerStates=";;Zet aan;Lichte slaap;Diepe slaap;Power cycle (Soft uit);Uit - Moeilijk;Slaapstand (zacht);Zacht uit;Power cycle (Off-hard);Reset hoofdbus;Diagnostische onderbreking (NMI);Niet toepasbaar;Uit - Zacht sierlijk;Uit - Hard sierlijk;Hoofdbus reset sierlijk;Power cycle (Off - Soft gracieus);Power cycle (Off - Hard gracieus);Diagnostische onderbreking (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99Onbekend";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Geen":EscapeHtml(c);d+=TableEntry("Naam & domein",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+= -TableEntry("Systeem-ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("Systeem-ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5Onbekend";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Geen":EscapeHtml(c);d+=TableEntry("Naam & domein",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+= +TableEntry("Systeem-ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("Systeem-ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["Primair beeldscherm","Secundair beeldscherm", +v=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),n=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),e=amtfeatures[3]=void 0;5n.DefaultScreen&&(g=["Primair beeldscherm","Secundair beeldscherm", "3e scherm"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+=", Poort 5900 ingeschakeld"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    "); -QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" Het wijzigen van netwerkinstellingen kan ertoe leiden dat deze pagina niet meer beschikbaar is.");d=d+"

    Algemene instellingen

    "+TableStart();g="";"Geen"!=c&&(1==v.SharedFQDN&&(g=", gedeeld met OS"),0==v.SharedFQDN&&(g=", verschillend van OS"));d+=TableEntry("Naam & domein",addLinkConditional(c+g,"showEditNameDlg(1)", -xxAccountAdminName));c="Gehandicapt";1==v.DDNSUpdateEnabled?c="Elk ingeschakeld"+v.DDNSPeriodicUpdateInterval+" minuten, TTL is"+v.DDNSTTL+" minuten":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Update door DHCP-server");d+=TableEntry("Dynamische 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+="

    "+(amtwirelessif==a?"Draadloze interface":"Bekabelde interface")+"

    ";d+=TableStart();d+=TableEntry("Linkstatus",1==c.LinkIsUp?"Link is up":"Link is verbroken");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Linkbeleid", +QH(15,d);d="
    "+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" Het wijzigen van netwerkinstellingen kan ertoe leiden dat deze pagina niet meer beschikbaar is.");d=d+"

    Algemene instellingen

    "+TableStart();g="";"Geen"!=c&&(1==u.SharedFQDN&&(g=", gedeeld met OS"),0==u.SharedFQDN&&(g=", verschillend van OS"));d+=TableEntry("Naam & domein",addLinkConditional(c+g,"showEditNameDlg(1)", +xxAccountAdminName));c="Gehandicapt";1==u.DDNSUpdateEnabled?c="Elk ingeschakeld"+u.DDNSPeriodicUpdateInterval+" minuten, TTL is"+u.DDNSTTL+" minuten":1==u.DDNSUpdateByDHCPServerEnabled&&(c="Update door DHCP-server");d+=TableEntry("Dynamische 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+="

    "+(amtwirelessif==a?"Draadloze interface":"Bekabelde interface")+"

    ";d+=TableStart();d+=TableEntry("Linkstatus",1==c.LinkIsUp?"Link is up":"Link is verbroken");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("Linkbeleid", addLinkConditional(0==g.length?"Niet beschikbaar":"Beschikbaar in: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Mac adres",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Staat",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:"Geen")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?"Ingeschakeld":"Gehandicapt","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&& 1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"Ingeschakeld":"Gehandicapt","showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Reageer op ping", -addLinkConditional(["Gehandicapt","ICMP-reactie","RMCP-reactie","ICMP & RMCP-reactie"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Automatisch met DHCP-server":"Statisch IP-adres",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("IPv4-status",addLinkConditional(g,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4-adres",isIpAddress(c.IPAddress,"Geen"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("IPv4-gateway / masker", -c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Geen")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("IPv4-domeinnaamserver",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="
    ";a+="
    ";setDialogMode(11,"Linkbeleid",3,showLinkPolicyDlgEx,a,b)}} @@ -1006,8 +1004,8 @@ function showDesktopSettingsDlgOk3(b,c,a,d){200!=d?messagebox("Fout",format("Sch 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="
    ",null!=processMessageLog0responses&&(b=1==processMessageLog0responses[0].IsFrozen?AddButton("Un-freeze Log","FreezeLog(0)"):AddButton("Logboek bevriezen","FreezeLog(1)")),c+=TableEnd('
     
     '+ AddRefreshButton("PullEventLog(1)")+AddButton("Logboek opschonen","ClearLog()")+AddButton("Opslaan...","SaveEventLog()")+b),QH(17,c+"
    "))}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,g;g="

      EventTimeBronOmschrijving";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTimeBronOmschrijving";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"Gebeurtenislogboek wissen?"),setDialogMode(1,"Logboek",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Logboek","Kan niet wissen, fout: "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("Tijd",c.Time.toLocaleString());a+=addHtmlValue("Bron",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Omschrijving",c.Desc);a+=MoreStart();a+=addHtmlValue("Apparaatadres",c.DeviceAddress);a+=addHtmlValue("Entiteit",c.Entity);a+=addHtmlValue("Entiteitsinstantie",c.EntityInstance);var d="",g;for(g in c.EventData)0";messagebox(format("Event # {0} Details",b+1),a)}} @@ -1029,8 +1027,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Gehandicapt":"Ingeschakeld",c&2&&(b+=", Op slot"),c&4&&(b+=", Bijna vol"),c&8&&(b+=", Vol"),c&16&&(b+=", Geen sleutel"),c="

    Instellingen auditlogboek

    "+TableStart(),c+=TableEntry("Staat",b),c+=TableEntry("Opslag",a[0].CurrentNumberOfRecords+" record (s),"+a[0].PercentageFree+"% vrij"),c+=TableEntry("Overschrijf beleid",2==a[0].OverwritePolicy?"Verpakt wanneer vol":"Overschrijft nooit"),c+=TableEnd(),QH(49, c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("Opslaan...","SaveAuditLog()")+AddButton("Logboek opschonen","ClearAuditLog()"))+"
    ");if(0==c.length)d="Geen controlelogboekgebeurtenissen gevonden.";else{var g=0;d+="

      TijdInitiatorAction"; -for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit", -minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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-auditlogboek",auditLog)} +for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0
      '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit", +minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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-auditlogboek",auditLog)} function ClearAuditLog(b){QH(60,"Auditlogboek wissen?");setDialogMode(1,"Auditlogboek",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("Auditlogboek","Fout: "+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("Tijd",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiator",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Adres",a.NetAddress));d+=addHtmlValue("Toepassing",a.AuditApp);d+=addHtmlValue("Evenement",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Uitgebreide gegevens",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
    Certificaat
    Security
    Externe CN\'s
    ';setDialogMode(11,"TLS-instellingen", @@ -1080,7 +1078,7 @@ function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabi "PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Onbekend;Andere;Ingeschakeld;Gehandicapt;Afsluiten;Niet toepasbaar;Ingeschakeld maar offline;In Test;Uitgesteld;Rustig;Beginnend".split(";"),watchdogMonitoredEntity="Onbekend;Andere;Besturingssysteem;Besturingssysteem opstartproces;Besturingssysteem afsluiten;Firmware-opstartproces;BIOS-opstartproces;Toepassing;Serviceprocessor".split(";"); function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Maximale waakhonden",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" waakhonden");b+=TableEntry("Maximaal totaal aantal acties",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" acties");b+=TableEnd()+"
    ";b+=TableStart2();b+="

    Beheer Intel® AMT-agentwaakhonden.

    ";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses|| 0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    Geen waakhond voor aanwezigheid van agenten gevonden.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : Te loggen gebeurtenis")}""!=d&&(b+="
    "+ +c+")>";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : Te loggen gebeurtenis")}""!=d&&(b+="
    "+ d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Watchdog toevoegen ...","AddWatchdog()"));b+="
    ";QH(54,b)}}function getWatchdogTransitionStr(b){if(31==b)return"Elke staat";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("Omschrijving",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Gecontroleerde entiteit",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Huidige toestand",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Ingeschakelde staat",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Opstartinterval", b.StartupInterval+" seconde (n)");c+=addHtmlValue("Time-outinterval",b.TimeoutInterval+" seconde (n)");setDialogMode(11,format("Waakhond {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1102,12 +1100,12 @@ a}b+=TableStart();c="Geen";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemDef "
    Geen systeembeschermingsbeleid gevonden.

    ";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
    "+EscapeHtml(a.PolicyName)+""+d+"
    "; b+="

    Beheer Intel® AMT-systeembeschermingsfilters.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    Geen systeembeschermingsfilters gevonden.

    ";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="Geheel Ethernet-protocol"+ a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" Bij"+a.FilterProfileData+" pakket / sec"),1==a.ActionEventOnMatch&&(d+=", Evenement op wedstrijd"),b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])|| -(d="Geheel Ethernet-protocol"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" Bij"+a.FilterProfileData+" pakket / sec");1==a.ActionEventOnMatch&&(d+=", Evenement op wedstrijd");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+ +(d="Geheel Ethernet-protocol"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" Bij"+a.FilterProfileData+" pakket / sec");1==a.ActionEventOnMatch&&(d+=", Evenement op wedstrijd");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+ TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Filter toevoegen ...","AddDefenseFilter()")+AddButton("Beleid toevoegen ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    Standaardbeleid
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1120,12 +1118,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="Hdr"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Voeg System Defense Filter toe","Kan filter niet toevoegen, fout #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Ethernet-verkeer",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Geheel Ethernet-protocol"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="IP-verkeer",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Alle IP-protocol"+d.HdrIPVersion));var n;n=""+addHtmlValue("Naam",EscapeHtml(d.Name));n+=addHtmlValue("Type",g);n+= -addHtmlValue("Overeenkomend verkeer",a);n+=addHtmlValue("Richting",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filter"+a,g));n+=addHtmlValue("Evenement op wedstrijd",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet-filter #"+ -d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Filter verwijderen","Kan filter niet verwijderen, zorg ervoor dat het niet in gebruik is."):PullSystemDefense()}var xxAddDefensePolicyFilters; +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="Ethernet-verkeer",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="Geheel Ethernet-protocol"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="IP-verkeer",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Alle IP-protocol"+d.HdrIPVersion));var n;n=""+addHtmlValue("Naam",EscapeHtml(d.Name));n+=addHtmlValue("Type",g);n+= +addHtmlValue("Overeenkomend verkeer",a);n+=addHtmlValue("Richting",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filter"+a,g));n+=addHtmlValue("Evenement op wedstrijd",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet-filter #"+ +d.InstanceID,5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Filter verwijderen","Kan filter niet verwijderen, zorg ervoor dat het niet in gebruik is."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    Naam
    Standaard TX / RX
    ';b+= "
    ";if(0
    Filter toevoegen
    "}setDialogMode(11,"Voeg systeembeschermingsbeleid toe",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())} @@ -1156,8 +1154,8 @@ function updateWifiDialog(){var b=!0,c=c25.value,a=c27.value;QV(66,4>c);QV(65,3< c28.value==c29.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 *CIM_Battery".split(" "),processHardware);amtFirstPull|=1} var DMTFCPUStatus="Onbekend;Ingeschakeld;Uitgeschakeld door gebruiker;Uitgeschakeld door BIOS (POST-fout);Inactief;Andere".split(";"),DMTFMemType="Onbekend;Andere;DRAM;Synchrone DRAM;DRAM in cache opslaan;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=";Andere;Onbekend;SIMM;slokje;Chip;DIP;ZIP;Eigen kaart;DIMM;TSOP;Rij van 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 mobiele processor",196:"Intel® Core ™ 2 Duo mobiele processor",197:"Intel® Core ™ 2 Solo mobiele processor",198:"Intel® Core ™ i7-processor",199:"Dual-core Intel® Celeron®-processor"},HardwareInventory; -function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Opslaan...","SaveHardwareLog()")+" Hardware-informatie wordt verzameld tijdens het opstarten van het systeem.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Platform

    "+FullTable({Computermodel:c.Model, -Fabrikant:c.Manufacturer,Versie:c.Version,Serienummer:c.SerialNumber,"Systeem-ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    Plint

    ";b+=FullTable({Fabrikant:d.Manufacturer,Productnaam:d.Model,Versie:d.Version,Serienummer:d.SerialNumber,Itemtag:d.Tag,"Vervangbaar?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({Verkoper:a.CIM_BIOSElement.response.Manufacturer,Versie:v,"Datum van publicatie":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", +function processHardware(b,c,a,d){if(200==d){var g;b="
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Opslaan...","SaveHardwareLog()")+" Hardware-informatie wordt verzameld tijdens het opstarten van het systeem.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Platform

    "+FullTable({Computermodel:c.Model, +Fabrikant:c.Manufacturer,Versie:c.Version,Serienummer:c.SerialNumber,"Systeem-ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    Plint

    ";b+=FullTable({Fabrikant:d.Manufacturer,Productnaam:d.Model,Versie:d.Version,Serienummer:d.SerialNumber,Itemtag:d.Tag,"Vervangbaar?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({Verkoper:a.CIM_BIOSElement.response.Manufacturer,Versie:u,"Datum van publicatie":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", {timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Processor "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabrikant:trademarks(d.Manufacturer),Familie:DMTFProcFamilly[c.Family],Versie:trademarks(d.Version),"Maximale socketsnelheid":c.MaxClockSpeed+" MHz",Toestand:DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

    Geheugenmodule "+(+g+1)+"

    ",b+= FullTable({"Bank Label":c.BankLabel,Fabrikant:c.Manufacturer,Serienummer:c.SerialNumber,Grootte:parseInt(c.Capacity/1048576)+" MB",Vormfactor:DMTFMemFormFactor[c.FormFactor],Type:DMTFMemType[c.MemoryType],Itemtag:c.Tag,"Onderdeel nummer":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

    Opslag media "+(parseInt(g)+1)+"

    ",b+=FullTable({Model:d.Model,Serienummer:""==d.SerialNumber?"Unknown": d.SerialNumber,Grootte:parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+="

    Battery

    ",g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,Fabrikant:c.Manufacturer,"Manufacture date":g,Serienummer:c.SerialNumber,Type:"Andere;Onbekend;Lead Acid;Nickel Cadmium;Nickel Metal Hydride;Lithium-ion;Zinc air;Lithium Polymer".split(";")[a.CIM_Battery.response.Chemistry], @@ -1168,18 +1166,18 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0

    Beheer de Intel® AMT-gebruikersaccounts voor deze computer.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== -v&&(n+="Gehandicapt,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Rijken[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Accountant,");n=0<=a.Realms.indexOf(3)?n+"Beheerder":1==l?n+"1 rijk":n+(l+" rijken")}else n+="Beheerder",a.Handle=-1;b+="
    ";0

    Beheer de Intel® AMT-gebruikersaccounts voor deze computer.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== +u&&(n+="Gehandicapt,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Rijken[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="Accountant,");n=0<=a.Realms.indexOf(3)?n+"Beheerder":1==k?n+"1 rijk":n+(k+" rijken")}else n+="Beheerder",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("Nieuw account", "newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"Bewerk 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,"Nieuw account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Accountfout","Ongeldige parameters");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, -l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("Accountfout","Ongeldige parameters");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, +k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Naam",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Staat",1==xxAccountEnabledInfo[b].Enabled?"Ingeschakeld":"Gehandicapt"));if(g==xxAccountAdminName)a+=addHtmlValue("Toestemming","Beheerder");else{var a=a+addHtmlValue("Toestemming",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v="Beheerder", -0<=c.Realms.indexOf(20)&&(v+=", Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("Account"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Naam",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Staat",1==xxAccountEnabledInfo[b].Enabled?"Ingeschakeld":"Gehandicapt"));if(g==xxAccountAdminName)a+=addHtmlValue("Toestemming","Beheerder");else{var a=a+addHtmlValue("Toestemming",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u="Beheerder", +0<=c.Realms.indexOf(20)&&(u+=", Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("Account"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (Leeg)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    Fout #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1226,10 +1224,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0, -70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0, +70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"Server":"")+"IDE-R-sessie , verbonden,"+ider.m.bytesFromAmt+" in,"+ider.m.bytesToAmt+" uit.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , blokken zijn {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Floppy , blokken zijn {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height=6*(Math.floor(a/ +function iderSectorStats(b,c,a,d,g){var u=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=u.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , blokken zijn {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Floppy , blokken zijn {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height=6*(Math.floor(a/ (heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Periodieke verbinding",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Beheer Intel® AMT servers voor extern beheer.

    ";if(0==xxCiraServers.length)b+="

    Geen externe servers gevonden.

    "; +"Periodiek");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format(", elke {0} seconden",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("Periodieke verbinding",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Beheer Intel® AMT servers voor extern beheer.

    ";if(0==xxCiraServers.length)b+="

    Geen externe servers gevonden.

    "; else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    Beheer HTTP-proxy's die worden gebruikt voor beheerverbindingen.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="

    Geen proxy's geconfigureerd.

    ";else for(d in c)b+= "
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("Server toevoegen...","AddRemoteAccessServer()"),a&&(d+=AddButton("Proxy toevoegen ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(52,b)}}var xxEditMpsPolicyType; function editMpsPolicy(b){var c="",a=11
    Type trigger=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||23a||59http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server2").value].Name+"");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),v&&(0==Q("d2server2cira").value?d.push(v):n.push(v))):g&&(d.push(g),v&&d.push(v));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp; +function editMpsPolicyOk2(b,c,a,d){b=11http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server2").value].Name+"");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),u&&(0==Q("d2server2cira").value?d.push(u):n.push(u))):g&&(d.push(g),u&&d.push(u));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp; function editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="Voer maximaal 5 domeinachtervoegsels in. Als de computer zich buiten deze domeinen bevindt, worden de lokale Intel® AMT-poorten gesloten en zijn externe serververbindingen actief.

    ");0==editEnvironmentDetectionTmp.length&&(c+="Geen intranetdomeinen, omgevingsdetectie uitgeschakeld.
    "); for(var a in editEnvironmentDetectionTmp)c+="
    "+AddButton2("Verwijderen","editEnvironmentDetectionRemove("+a+")")+'
    '+editEnvironmentDetectionTmp[a]+"
    ";xxAccountAdminName&&5>editEnvironmentDetectionTmp.length&&(c+="
    "); 1==b?QH(63,c):setDialogMode(11,"Omgevingsdetectie",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)}} @@ -1351,7 +1349,7 @@ rsepass=1,setDialogMode(11,"Krachtige acties",3,powerActionDlg,b)):106==b||107== function powerActionDlgRPE(b){var c;c="Confirm execution of Intel® Remote Platform Erase?

    WAARSCHUWING: Hierdoor worden gegevens op het externe systeem gewist.
    ";var a=[],d=amtPowerBootCapabilities.PlatformErase;d&4&&a.push("");d&64&&a.push("");d&33554432&&a.push(""); d&67108864&&a.push("");d&-2147483648&&a.push("");1Select the actions to take:

    {0}

    ",a.join("
    ")));c+="";setDialogMode(11,"Krachtige acties",3,powerActionDlgRPEEx,c,b);QE("c54",!1)}function powerActionDlgRPEValidate(){var b=0,c=amtPowerBootCapabilities.PlatformErase,a=[2,6,25,26,31],d;for(d in a)c&1<b&&2amtversion&&(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("c39").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); @@ -1384,11 +1382,11 @@ targetPowerAction=b;11==b&&(b=10);999>b?(console.log("RequestPowerStateChange("+ function powerActionResponse5(b,c,a,d){}function consentChanged(){QE("c54",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",2c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(D){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Beheer Intel® AMT-opslag voor deze computer.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+ -"Wortel";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Downloaden","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("", -function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Geen bestanden gevonden.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("Uploaden...","UploadToStorage()"): -""));QH(55,a)}else QH(55,"Kan opslaggegevens niet laden ...
    "+AddButton("Vernieuwen","PullStorage()"))}function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Verkoper",b));""!=c&&(g+=addHtmlValue("Toepassing",c));g+=addHtmlValue("Naam",a);g+=addHtmlValue("Grootte",v.size+" bytes");v.link&&(g+=addHtmlValue("Koppeling",v.link));setDialogMode(11,"Opslagitem",5,showStorageDetailsEx,g,d)}} +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Beheer Intel® AMT-opslag voor deze computer.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+ +"Wortel";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Downloaden","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==v&&(wsstack.comm.PerformAjax("", +function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Geen bestanden gevonden.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(u?AddButton("Uploaden...","UploadToStorage()"): +""));QH(55,a)}else QH(55,"Kan opslaggegevens niet laden ...
    "+AddButton("Vernieuwen","PullStorage()"))}function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Verkoper",b));""!=c&&(g+=addHtmlValue("Toepassing",c));g+=addHtmlValue("Naam",a);g+=addHtmlValue("Grootte",u.size+" bytes");u.link&&(g+=addHtmlValue("Koppeling",u.link));setDialogMode(11,"Opslagitem",5,showStorageDetailsEx,g,d)}} function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Opslag",format("Kan bestand (ERR {0}) niet verwijderen, controleer of de computer is ingeschakeld.",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","noopener,noreferrer");a.opener=null;a.focus()}} function PushToStorage(b,c,a){var d=null;7E3";else xxAlarms=null,b+="

    Geen wekkeralarmen geregistreerd.

    ";d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Verwijder alle alarmen","RemoveAllAlarms()")+AddButton("Toevoegen", "showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"Verwijder alle wekalarmen",3,RemoveAllAlarmsEx,"Verwijderen van alle wekalarmen bevestigen?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"Verwijder alle wekalarmen",3,RemoveAllAlarmsEx,"Verwijderen van alle wekalarmen bevestigen?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"Voeg een nieuw alarm toe",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 Controleer of het alarm voor de toekomst is.",d)):0!=c.Body.ReturnValue?messagebox("Alarm toevoegen",format("Kan alarm niet toevoegen {0}.
    Controleer of het alarm voor de toekomst is.",c.Body.ReturnValueStr)): -PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Alarm bewerken",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Alarm toevoegen",format("Alarm toevoegen mislukt. Status: {0}.
    Controleer of het alarm voor de toekomst is.",d)):0!=c.Body.ReturnValue?messagebox("Alarm toevoegen",format("Kan alarm niet toevoegen {0}.
    Controleer of het alarm voor de toekomst is.",c.Body.ReturnValueStr)): +PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Alarm bewerken",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("Naam",c.ElementName)+addHtmlValue("Wakker worden",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("Intern",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Na het ontwaken",1==c.DeleteOnCompletion?"Alarm verwijderen":"Houd alarm")+"
    ";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,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"OK",401:"Authenticatiefout",408:"Time-outfout",601:"WSMAN-parseerfout",602:"Kan HTTP-antwoordkop niet parseren",603:"Onverwachte HTTP-opsomming",604:"Onverwachte HTTP-pull-reactie",997:"Ongeldig verteringsrijk"}; +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"OK",401:"Authenticatiefout",408:"Time-outfout",601:"WSMAN-parseerfout",602:"Kan HTTP-antwoordkop niet parseren",603:"Onverwachte HTTP-opsomming",604:"Onverwachte HTTP-pull-reactie",997:"Ongeldig verteringsrijk"}; 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("Fout # {0}",b)),401==b&&QH(5,'Authenticatiefout

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Oproepfout",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Oproepfout",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""} function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Dados inv\u00e1lidos";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", -r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Dados inv\u00e1lidos";if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}", +r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&& 64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18== a&&170==c[0])return"C\u00e3o de guarda do agente"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... alterado para"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Intrus\u00e3o de caso";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"Uma sess\u00e3o remota Serial Over LAN foi estabelecida.";if(1==c[2])return"Sess\u00e3o Remota Serial Over LAN conclu\u00edda. O controle do usu\u00e1rio foi restaurado.";if(2==c[2])return"Uma sess\u00e3o remota de redirecionamento de IDE foi estabelecida."; if(3==c[2])return"Sess\u00e3o remota de redirecionamento de IDE conclu\u00edda. O controle do usu\u00e1rio foi restaurado."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="com fio"),4294967293==a?"Todos os filtros de pacotes recebidos foram correspondidos em"+b+" interface.":4294967292==a?"Todos os filtros de pacotes de sa\u00edda foram correspondidos em"+b+" interface.":4294967290==a?"O filtro de pacotes falsificados foi correspondido em"+b+" interface.":"Filtro"+ a+" foi combinado em"+b+" interface.";if(192==a)return 0==c[2]?"Pol\u00edtica de seguran\u00e7a invocada. Algum ou todo o tr\u00e1fego de rede (TX) foi interrompido.":2==c[2]?"Pol\u00edtica de seguran\u00e7a invocada. Algum ou todo o tr\u00e1fego de rede (RX) foi interrompido.":"Pol\u00edtica de seguran\u00e7a invocada.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Solicita\u00e7\u00e3o do usu\u00e1rio para conex\u00e3o remota.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"Erro EAC: tentativa de obter postura enquanto o NAC no IntelTM AMT est\u00e1 desativado."; if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Erro HWA: erro geral"}return 6==a?"Falha na autentica\u00e7\u00e3o"+(c[1]+(c[2]<<8))+" vezes. O sistema pode estar sob ataque.":30==a?"Nenhuma m\u00eddia inicializ\u00e1vel":32==a?"Bloqueio do sistema operacional ou interrup\u00e7\u00e3o de energia":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"Falha na inicializa\u00e7\u00e3o do sistema":37==a?"Firmware do sistema iniciado (pelo menos uma CPU est\u00e1 sendo executada corretamente).": -"Tipo de sensor desconhecido #"+a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0Local",h=5);3==b.InitiatorType&&(b.Initiator="Porta padr\u00e3o KVM",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++); -b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0, -w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d, -h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y), -A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0, +w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)},0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d, +h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A), +z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -121,8 +120,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -143,8 +142,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -154,12 +153,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="N\u00e3o especificado. ; Nenhuma mem\u00f3ria do sistema est\u00e1 fisicamente instalada no sistema. ; Nenhuma mem\u00f3ria utiliz\u00e1vel do sistema, toda a mem\u00f3ria instalada sofreu uma falha irrecuper\u00e1vel. ; Falha irrecuper\u00e1vel no disco r\u00edgido / dispositivo ATAPI / IDE. ; Falha irrecuper\u00e1vel na placa do sistema. ; Disquete irrecuper\u00e1vel falha no subsistema. ; Falha irrecuper\u00e1vel no controlador de disco r\u00edgido. ; Falha irrecuper\u00e1vel no teclado PS / 2 ou USB. ; M\u00eddia de inicializa\u00e7\u00e3o remov\u00edvel n\u00e3o encontrada. ; Falha irrecuper\u00e1vel no controlador de v\u00eddeo. ; Nenhum dispositivo de v\u00eddeo detectado. ; Detectada corrup\u00e7\u00e3o de ROM de firmware (BIOS). ; Incompatibilidade de tens\u00e3o da CPU (processadores que compartilham a mesma fonte t\u00eam requisitos de tens\u00e3o incompat\u00edveis) ; Falha na correspond\u00eancia da velocidade da CPU".split(";"), +[a,b,[]])};var E="N\u00e3o especificado. ; Nenhuma mem\u00f3ria do sistema est\u00e1 fisicamente instalada no sistema. ; Nenhuma mem\u00f3ria utiliz\u00e1vel do sistema, toda a mem\u00f3ria instalada sofreu uma falha irrecuper\u00e1vel. ; Falha irrecuper\u00e1vel no disco r\u00edgido / dispositivo ATAPI / IDE. ; Falha irrecuper\u00e1vel na placa do sistema. ; Disquete irrecuper\u00e1vel falha no subsistema. ; Falha irrecuper\u00e1vel no controlador de disco r\u00edgido. ; Falha irrecuper\u00e1vel no teclado PS / 2 ou USB. ; M\u00eddia de inicializa\u00e7\u00e3o remov\u00edvel n\u00e3o encontrada. ; Falha irrecuper\u00e1vel no controlador de v\u00eddeo. ; Nenhum dispositivo de v\u00eddeo detectado. ; Detectada corrup\u00e7\u00e3o de ROM de firmware (BIOS). ; Incompatibilidade de tens\u00e3o da CPU (processadores que compartilham a mesma fonte t\u00eam requisitos de tens\u00e3o incompat\u00edveis) ; Falha na correspond\u00eancia da velocidade da CPU".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="N\u00e3o especificado ; Outros ; Desconhecido ; Processador ; Disco ; Perif\u00e9rico ; M\u00f3dulo de gerenciamento do sistema ; Placa do sistema ; M\u00f3dulo de mem\u00f3ria ; M\u00f3dulo do processador ; Fonte de alimenta\u00e7\u00e3o ; Fonte de alimenta\u00e7\u00e3o ; Adicione um cart\u00e3o ; Placa do painel frontal ; Placa do painel traseiro ; Placa do painel traseiro ; Placa do sistema de energia ; Placa de acionamento ; Painel traseiro da unidade ; Expans\u00e3o interna do sistema placa ; Outra placa de sistema ; Placa processadora ; Unidade de pot\u00eancia ; M\u00f3dulo de pot\u00eancia ; Placa de gerenciamento de energia ; Placa do painel traseiro do chassi ; Chassis do sistema ; Sub-chassi ; Outra placa do chassi ; Compartimento de unidades de disco ; Compartimento de perif\u00e9ricos ; Compartimento de dispositivos ; Compartimento de refrigera\u00e7\u00e3o ; Ventilador ; Unidade de refrigera\u00e7\u00e3o ; Interconex\u00e3o por cabo ; Dispositivo de mem\u00f3ria ; Software de gerenciamento do sistema ; BIOS ; Intel (r) ME ; Barramento do sistema ; Grupo ; Intel (r) ME ; Ambiente externo ; Bateria ; L\u00e2mina de processamento ; Interruptor de conectividade ; Interruptor de conectividade ; Processador / m\u00f3dulo de mem\u00f3ria ; M\u00f3dulo de E / S ; M\u00f3dulo de E / S do processador ; Firmware do controlador de gerenciamento ; Canal IPMI ; Barramento PCI ; Barramento PCI Express ; Barramento SCSI ; Barramento SATA / SAS ; Barramento frontal do processador".split(";"); +l="N\u00e3o especificado ; Outros ; Desconhecido ; Processador ; Disco ; Perif\u00e9rico ; M\u00f3dulo de gerenciamento do sistema ; Placa do sistema ; M\u00f3dulo de mem\u00f3ria ; M\u00f3dulo do processador ; Fonte de alimenta\u00e7\u00e3o ; Fonte de alimenta\u00e7\u00e3o ; Adicione um cart\u00e3o ; Placa do painel frontal ; Placa do painel traseiro ; Placa do painel traseiro ; Placa do sistema de energia ; Placa de acionamento ; Painel traseiro da unidade ; Expans\u00e3o interna do sistema placa ; Outra placa de sistema ; Placa processadora ; Unidade de pot\u00eancia ; M\u00f3dulo de pot\u00eancia ; Placa de gerenciamento de energia ; Placa do painel traseiro do chassi ; Chassis do sistema ; Sub-chassi ; Outra placa do chassi ; Compartimento de unidades de disco ; Compartimento de perif\u00e9ricos ; Compartimento de dispositivos ; Compartimento de refrigera\u00e7\u00e3o ; Ventilador ; Unidade de refrigera\u00e7\u00e3o ; Interconex\u00e3o por cabo ; Dispositivo de mem\u00f3ria ; Software de gerenciamento do sistema ; BIOS ; Intel (r) ME ; Barramento do sistema ; Grupo ; Intel (r) ME ; Ambiente externo ; Bateria ; L\u00e2mina de processamento ; Interruptor de conectividade ; Interruptor de conectividade ; Processador / m\u00f3dulo de mem\u00f3ria ; M\u00f3dulo de E / S ; M\u00f3dulo de E / S do processador ; Firmware do controlador de gerenciamento ; Canal IPMI ; Barramento PCI ; Barramento PCI Express ; Barramento SCSI ; Barramento SATA / SAS ; Barramento frontal do processador".split(";"); e.RealmNames=";; Redirecionamento ;; Ativo de hardware ; Controle remoto ; Armazenamento ; Gerenciador de eventos ; Administrador de armazenamento ; Presen\u00e7a local do agente ; Presen\u00e7a remota do agente ; Disjuntor ; Tempo de rede ; Informa\u00e7\u00f5es gerais ; Atualiza\u00e7\u00e3o de firmware ; EIT ; LocalUN ; Endpoint Access Control ; Endpoint Access Control Admin ; Leitor de log de eventos ; Log de auditoria ; Regi\u00e3o da ACL ;;; Sistema local".split(";");e.WatchdogCurrentStates= {1:"n\u00e3o foi iniciado",2:"Parado",4:"Corrida",8:"Expirado",16:"Suspenso"};var h="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(";"),r=";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(";"), -K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Admin de seguran\u00e7a",17:"RCO",18:"Gerenciador de redirecionamento",19:"Gerenciador de Atualiza\u00e7\u00e3o de Firmware",20:"Log de auditoria de seguran\u00e7a",21:"Hora da rede",22:"Administra\u00e7\u00e3o de rede",23:"Administra\u00e7\u00e3o de armazenamento",24:"Gerente de eventos",25:"Gerente do disjuntor",26:"Gerenciador de presen\u00e7a do agente",27:"Configura\u00e7\u00e3o sem fio",28:"EAC",29:"KVM",30:"Eventos de aceita\u00e7\u00e3o do usu\u00e1rio", +O={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"Admin de seguran\u00e7a",17:"RCO",18:"Gerenciador de redirecionamento",19:"Gerenciador de Atualiza\u00e7\u00e3o de Firmware",20:"Log de auditoria de seguran\u00e7a",21:"Hora da rede",22:"Administra\u00e7\u00e3o de rede",23:"Administra\u00e7\u00e3o de armazenamento",24:"Gerente de eventos",25:"Gerente do disjuntor",26:"Gerenciador de presen\u00e7a do agente",27:"Configura\u00e7\u00e3o sem fio",28:"EAC",29:"KVM",30:"Eventos de aceita\u00e7\u00e3o do usu\u00e1rio", 32:"Tela em branco",33:"Eventos Watchdog",1600:"Aprovisionamento iniciado",1601:"Aprovisionamento conclu\u00eddo",1602:"Entrada ACL adicionada",1603:"Entrada da ACL modificada",1604:"Entrada da ACL removida",1605:"Acesso ACL com credenciais inv\u00e1lidas",1606:"Estado de entrada da ACL",1607:"Estado do TLS alterado",1608:"Conjunto de certificados do servidor TLS",1609:"Remover certificado de servidor TLS",1610:"Adicionado certificado raiz confi\u00e1vel TLS",1611:"Certificado raiz confi\u00e1vel TLS removido", 1612:"Conjunto de chaves pr\u00e9-compartilhadas TLS",1613:"Configura\u00e7\u00f5es do Kerberos modificadas",1614:"Chave principal do Kerberos modificada",1615:"Redefini\u00e7\u00e3o de contadores de desgaste do flash",1616:"Pacote de energia modificado",1617:"Definir modo de autentica\u00e7\u00e3o de regi\u00e3o",1618:"Atualizar cliente para o modo de controle de administrador",1619:"Desprovisionamento iniciado",1700:"Power Up realizado",1701:"Desativa\u00e7\u00e3o realizada",1702:"Ciclo de energia realizado", 1703:"Reset realizado",1704:"Definir op\u00e7\u00f5es de inicializa\u00e7\u00e3o",1705:"Remote graceful power down initiated",1706:"Remote graceful reset initiated",1707:"Remote Standby initiated",1708:"Remote Hiberate initiated",1709:"Remote NMI initiated",1800:"Sess\u00e3o IDER aberta",1801:"Sess\u00e3o IDER encerrada",1802:"IDER ativado",1803:"IDER desativado",1804:"Sess\u00e3o SoL aberta",1805:"Sess\u00e3o SoL Encerrada",1806:"SoL ativado",1807:"SoL desativado",1808:"Sess\u00e3o KVM iniciada", @@ -169,18 +168,18 @@ K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Admin de seguran\u00e7a",17:"R 2703:"An existing profile sync was modified",2704:"An existing profile link preference was changed",2705:"Wireless profile share with UEFI enabled setting was changed",2800:"EAC Posture Signer SET",2801:"EAC ativado",2802:"EAC desativado",2803:"Estado da postura da EAC",2804:"Op\u00e7\u00f5es de conjunto de EAC",2900:"Ativa\u00e7\u00e3o KVM ativada",2901:"Desativa\u00e7\u00e3o da KVM desativada",2902:"Senha KVM alterada",2903:"Consentimento da KVM com \u00eaxito",2904:"Falha no consentimento da KVM", 3E3:"Altera\u00e7\u00e3o da pol\u00edtica de aceita\u00e7\u00e3o",3001:"Enviar evento de c\u00f3digo de consentimento",3002:"Iniciar evento bloqueado de aceita\u00e7\u00e3o",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.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["Acesso ME inv\u00e1lido","Acesso MEBx inv\u00e1lido"][b.charCodeAt(0)];if(1606==a){var c=["Desativado","ativado"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"Controlo remoto"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Local"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["NoAuth","Auth","Desativado"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","MEI local","WSMAN local","WSAMN remoto"][b.charCodeAt(0)]: -1900==a?"De"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" para"+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?"De"+["Nenhum","KVM","Todos"][b.charCodeAt(0)]+" para"+["Nenhum","KVM","Todos"][b.charCodeAt(1)]:3001==a?["Sucesso","Falhou 3 vezes"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])}; +1900==a?"De"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" para"+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?"De"+["Nenhum","KVM","Todos"][b.charCodeAt(0)]+" para"+["Nenhum","KVM","Todos"][b.charCodeAt(1)]:3001==a?["Sucesso","Falhou 3 vezes"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,v,[a,[]])}; return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__namespace,d=a?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -249,27 +248,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -894,43 +892,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    Carregando...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -946,7 +944,7 @@ function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -963,28 +961,28 @@ c.push("*CIM_BootService");amtstack.BatchEnum("",c,processSystemStatus,!0);1==b& 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 g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Sincronizar rel\u00f3gio",3,syncClockEx,"Sincronizar o rel\u00f3gio Intel AMT com este computador?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Falha ao definir a hora, status ="+d):0!=a.Body.ReturnValue?messagebox("","Falha ao definir hora, erro: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}var DMTFPowerStates=";;Ligar;Sono leve;Sono profundo;Ciclo de energia (desligamento suave);Desligado - Dif\u00edcil;Hiberna\u00e7\u00e3o (desativado suave);Soft off;Ciclo de energia (Off-hard);Redefini\u00e7\u00e3o do barramento principal;Interrup\u00e7\u00e3o de diagn\u00f3stico (MNI);N\u00e3o aplic\u00e1vel;Desligado - suave e gracioso;Desligado - Dif\u00edcil gracioso;Redefini\u00e7\u00e3o do barramento mestre graciosa;Ciclo de energia (desligado - suave suave);Ciclo de energia (desligado - com for\u00e7a);Interrup\u00e7\u00e3o de diagn\u00f3stico (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99Desconhecido";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Nenhum":EscapeHtml(c);d+=TableEntry("Nome e dom\u00ednio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? -d+=TableEntry("ID do sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID do sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5Desconhecido";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0Nenhum":EscapeHtml(c);d+=TableEntry("Nome e dom\u00ednio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr? +d+=TableEntry("ID do sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID do sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5n.DefaultScreen&&(g=["Visor principal", +v=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),n=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),e=amtfeatures[3]=void 0;5n.DefaultScreen&&(g=["Visor principal", "Visor secund\u00e1rio","3\u00aa exibi\u00e7\u00e3o"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+="Porta 5900 ativada"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    "); -QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" Alterar as configura\u00e7\u00f5es de rede pode fazer com que esta p\u00e1gina fique indispon\u00edvel.");d=d+"

    Configura\u00e7\u00f5es Gerais

    "+TableStart();g="";"Nenhum"!=c&&(1==v.SharedFQDN&&(g=", compartilhado com o SO"),0==v.SharedFQDN&&(g=", diferente do SO"));d+=TableEntry("Nome e dom\u00ednio",addLinkConditional(c+ -g,"showEditNameDlg(1)",xxAccountAdminName));c="Desativado";1==v.DDNSUpdateEnabled?c="Ativado cada"+v.DDNSPeriodicUpdateInterval+" minutos, TTL \u00e9"+v.DDNSTTL+" minutos":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Atualiza\u00e7\u00e3o pelo servidor DHCP");d+=TableEntry("DNS din\u00e2mico",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+="

    "+(amtwirelessif==a?"Interface sem fio":"Interface com fio")+"

    ";d+=TableStart();d+=TableEntry("Estado do link",1==c.LinkIsUp?"O link est\u00e1 ativo":"Link desativado");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&&g.push("Sx / DC"); +addLinkConditional(n,"showEnableBootServiceDlg()",xxAccountAdminName)));if(null!=AmtSystemPowerSchemes)for(var g=amtsysstate.CIM_ElementSettingData.responses,B=0;B
    "); +QH(15,d);d="
    "+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" Alterar as configura\u00e7\u00f5es de rede pode fazer com que esta p\u00e1gina fique indispon\u00edvel.");d=d+"

    Configura\u00e7\u00f5es Gerais

    "+TableStart();g="";"Nenhum"!=c&&(1==u.SharedFQDN&&(g=", compartilhado com o SO"),0==u.SharedFQDN&&(g=", diferente do SO"));d+=TableEntry("Nome e dom\u00ednio",addLinkConditional(c+ +g,"showEditNameDlg(1)",xxAccountAdminName));c="Desativado";1==u.DDNSUpdateEnabled?c="Ativado cada"+u.DDNSPeriodicUpdateInterval+" minutos, TTL \u00e9"+u.DDNSTTL+" minutos":1==u.DDNSUpdateByDHCPServerEnabled&&(c="Atualiza\u00e7\u00e3o pelo servidor DHCP");d+=TableEntry("DNS din\u00e2mico",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+="

    "+(amtwirelessif==a?"Interface sem fio":"Interface com fio")+"

    ";d+=TableStart();d+=TableEntry("Estado do link",1==c.LinkIsUp?"O link est\u00e1 ativo":"Link desativado");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"),224==c.LinkPolicy[B]&&g.push("Sx / DC"); 0==g.length&&g.push("");d+=TableEntry("Pol\u00edtica de links",addLinkConditional(0==g.length?"N\u00e3o dispon\u00edvel":"Dispon\u00edvel em: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Endere\u00e7o MAC",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Estado",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)), s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Estado da R\u00e1dio",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"Nenhum")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled? "ativado":"Desativado","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"ativado":"Desativado","showUefiWifiCoExDlg()", -xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Responder ao ping",addLinkConditional(["Desativado","Resposta ICMP","Resposta RMCP","Resposta ICMP e RMCP"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Autom\u00e1tico usando servidor DHCP":"Endere\u00e7o IP est\u00e1tico",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Estado IPv4",addLinkConditional(g, +xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Responder ao ping",addLinkConditional(["Desativado","Resposta ICMP","Resposta RMCP","Resposta ICMP e RMCP"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Autom\u00e1tico usando servidor DHCP":"Endere\u00e7o IP est\u00e1tico",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Estado IPv4",addLinkConditional(g, "showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("Endere\u00e7o IPv4",isIpAddress(c.IPAddress,"Nenhum"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("Gateway IPv4 / M\u00e1scara",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Nenhum")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("Servidor de nomes de dom\u00ednio IPv4",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="

      EventTimeFonteDescri\u00e7\u00e3o";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="

      EventTimeFonteDescri\u00e7\u00e3o";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&&(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"
    ");processMessageLog0()} function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"Limpar log de eventos?"),setDialogMode(1,"Registro de Eventos",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Registro de Eventos","N\u00e3o foi poss\u00edvel limpar, Erro: "+d):PullEventLog()})} function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="
    "+addHtmlValue("Tempo",c.Time.toLocaleString());a+=addHtmlValue("Fonte",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Descri\u00e7\u00e3o",c.Desc);a+=MoreStart();a+=addHtmlValue("Endere\u00e7o do dispositivo",c.DeviceAddress);a+=addHtmlValue("Entidade",c.Entity);a+=addHtmlValue("Inst\u00e2ncia da entidade",c.EntityInstance);var d="",g;for(g in c.EventData)0";messagebox(format("Detalhes do evento {{}}",b+1),a)}} @@ -1032,8 +1030,8 @@ function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AM function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Desativado":"ativado",c&2&&(b+="Bloqueado"),c&4&&(b+=", Quase cheio"),c&8&&(b+=", Cheio"),c&16&&(b+=", NoKey"),c="

    Configura\u00e7\u00f5es do log de auditoria

    "+TableStart(),c+=TableEntry("Estado",b),c+=TableEntry("Armazenamento",a[0].CurrentNumberOfRecords+" registro (s),"+a[0].PercentageFree+"% livre"),c+=TableEntry("Pol\u00edtica de substitui\u00e7\u00e3o",2==a[0].OverwritePolicy?"Envolt\u00f3rios quando cheios": "Nunca substitui"),c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("Salve \ue051...","SaveAuditLog()")+AddButton("Log clara","ClearAuditLog()"))+"
    ");if(0==c.length)d="Nenhum evento de log de auditoria encontrado.";else{var g=0;d+="

      TempoIniciadorAction"; -for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit", -minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Registro de auditoria da Intel AMT",auditLog)} +for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0
      '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit", +minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","Registro de auditoria da Intel AMT",auditLog)} function ClearAuditLog(b){QH(60,"Limpar log de auditoria?");setDialogMode(1,"Log de auditoria",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("Log de auditoria","Erro: "+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("Tempo",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Iniciador",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Endere\u00e7o",a.NetAddress));d+=addHtmlValue("Inscri\u00e7\u00e3o",a.AuditApp);d+=addHtmlValue("Evento",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Dados estendidos",a.ExStr);else if(0"+xxCertificates[c].XSubject.CN+"");b+="
    Certificado
    Security
    CN remoto
    ';setDialogMode(11, @@ -1084,8 +1082,8 @@ function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabi "PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Desconhecido;De outros;ativado;Desativado;Desligando;N\u00e3o aplic\u00e1vel;Ativado, mas offline;Em teste;Diferido;Quiesce;Iniciando".split(";"),watchdogMonitoredEntity="Desconhecido;De outros;Sistema operacional;Processo de inicializa\u00e7\u00e3o do sistema operacional;Processo de desligamento do sistema operacional;Processo de inicializa\u00e7\u00e3o do firmware;Processo de inicializa\u00e7\u00e3o do BIOS;Inscri\u00e7\u00e3o;Processador de servi\u00e7o".split(";"); function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("C\u00e3es de guarda m\u00e1ximos",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" assistir cachorros");b+=TableEntry("Total de a\u00e7\u00f5es m\u00e1ximas",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" a\u00e7\u00f5es");b+=TableEnd()+"
    ";b+=TableStart2();b+="

    Gerenciar os c\u00e3es de guarda de presen\u00e7a do agente Intel® AMT.

    "; if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    Nenhum c\u00e3o de guarda de presen\u00e7a do agente encontrado.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+ -" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : Evento a ser registrado")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Adicionar c\u00e3o de guarda ...","AddWatchdog()"));b+="
    ";QH(54,b)}} +b+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+ +" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : Evento a ser registrado")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Adicionar c\u00e3o de guarda ...","AddWatchdog()"));b+="
    ";QH(54,b)}} function getWatchdogTransitionStr(b){if(31==b)return"Qualquer Estado";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("Descri\u00e7\u00e3o",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Entidade monitorada",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Estado atual",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Estado ativado",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Intervalo de inicializa\u00e7\u00e3o", b.StartupInterval+" segundo (s)");c+=addHtmlValue("Intervalo de tempo limite",b.TimeoutInterval+" segundo (s)");setDialogMode(11,format("C\u00e3o de guarda {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)} @@ -1107,12 +1105,12 @@ a}b+=TableStart();c="Nenhum";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemD if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="
    Nenhuma pol\u00edtica de defesa do sistema encontrada.

    ";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
    "+ EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    Gerenciar filtros de defesa do sistema Intel® AMT.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="
    Nenhum filtro de defesa do sistema encontrado.

    ";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+=" \u00e0s"+a.FilterProfileData+" pacote / s"),1==a.ActionEventOnMatch&&(d+=", Evento em jogo"),b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";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+=" \u00e0s"+a.FilterProfileData+" pacote / s");1==a.ActionEventOnMatch&&(d+=", Evento em jogo");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+ +(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="All Ethernet Protocol"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" \u00e0s"+a.FilterProfileData+" pacote / s");1==a.ActionEventOnMatch&&(d+=", Evento em jogo");var u=0;for(g in xxSystemDefenceFilters)a[g]&&u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+ ", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Adicionar filtro ...","AddDefenseFilter()")+AddButton("Adicionar pol\u00edtica ...","AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    Pol\u00edtica padr\u00e3o
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+c+ @@ -1125,12 +1123,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="
    =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 g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]), -parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",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 g=a[d].indexOf("="),u=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[u];n||(u="Hdr"+u,n=xxSystemDefenceFilters[u]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[u]=rstr2hex(String.fromCharCode(parseInt(g[0]), +parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[u]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)} function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Adicionar filtro de defesa do sistema","N\u00e3o foi poss\u00edvel adicionar o filtro, erro #"+d):PullSystemDefense()} -function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Tr\u00e1fego Ethernet",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="Tr\u00e1fego IP",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Todo o protocolo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nome",EscapeHtml(d.Name));n+=addHtmlValue("Tipo", -g);n+=addHtmlValue("Tr\u00e1fego correspondente",a);n+=addHtmlValue("Dire\u00e7\u00e3o",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtro"+a,g));n+=addHtmlValue("Evento em jogo",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11, -"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remover filtro","N\u00e3o foi poss\u00edvel remover o filtro, verifique se ele n\u00e3o est\u00e1 em uso."):PullSystemDefense()}var xxAddDefensePolicyFilters; +function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,u;0==b?(u="AMT_Hdr8021Filter",g="Tr\u00e1fego Ethernet",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol"+d.HdrProtocolID8021)):(u="AMT_IPHeadersFilter",g="Tr\u00e1fego IP",d=xxSystemDefense[u].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Todo o protocolo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nome",EscapeHtml(d.Name));n+=addHtmlValue("Tipo", +g);n+=addHtmlValue("Tr\u00e1fego correspondente",a);n+=addHtmlValue("Dire\u00e7\u00e3o",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,g=d[k],b=xxSystemDefenceFilters[k],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtro"+a,g));n+=addHtmlValue("Evento em jogo",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11, +"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[u,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remover filtro","N\u00e3o foi poss\u00edvel remover o filtro, verifique se ele n\u00e3o est\u00e1 em uso."):PullSystemDefense()}var xxAddDefensePolicyFilters; function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='
    Nome
    TX / RX padr\u00e3o
    ';b+= "
    ";if(0
    Adicionar filtro
    "}setDialogMode(11,"Adicionar diretiva de defesa do sistema",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())} @@ -1163,9 +1161,9 @@ c28.value==c29.value)}function PullHardware(){amtstack.BatchEnum("","*CIM_Comput var DMTFCPUStatus="Desconhecido;ativado;Desativado pelo usu\u00e1rio;Desativado pelo BIOS (erro POST);Ocioso;De outros".split(";"),DMTFMemType="Desconhecido;De outros;DRAM;DRAM s\u00edncrona;DRAM de cache;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Instant\u00e2neo;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";De outros;Desconhecido;SIMM;trago;Lasca;MERGULHO;ZIP;Cart\u00e3o Propriet\u00e1rio;DIMM;TSOP;Linha de chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"), DMTFProcFamilly={191:"Processador Intel® Core ™ 2 Duo",192:"Processador Intel® Core ™ 2 Solo",193:"Processador Intel® Core ™ 2 Extreme",194:"Processador Intel® Core ™ 2 Quad",195:"Processador m\u00f3vel Intel® Core ™ 2 Extreme",196:"Processador m\u00f3vel Intel® Core ™ 2 Duo",197:"Processador m\u00f3vel Intel® Core ™ 2 Solo",198:"Processador Intel® Core ™ i7",199:"Processador Intel® Celeron® de n\u00facleo duplo"}, HardwareInventory; -function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Salve \ue051...","SaveHardwareLog()")+" As informa\u00e7\u00f5es de hardware s\u00e3o coletadas no momento da inicializa\u00e7\u00e3o do sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Plataforma

    "+ +function processHardware(b,c,a,d){if(200==d){var g;b="
    ";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("Salve \ue051...","SaveHardwareLog()")+" As informa\u00e7\u00f5es de hardware s\u00e3o coletadas no momento da inicializa\u00e7\u00e3o do sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    Plataforma

    "+ FullTable({"Modelo de computador":c.Model,Fabricante:c.Manufacturer,"Vers\u00e3o":c.Version,"N\u00famero de s\u00e9rie":c.SerialNumber,"ID do sistema":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    Rodap\u00e9

    ";b+=FullTable({Fabricante:d.Manufacturer,"Nome do Produto":d.Model,"Vers\u00e3o":d.Version,"N\u00famero de s\u00e9rie":d.SerialNumber,"Etiqueta de recurso":d.Tag,"Substitu\u00edvel?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({Fornecedor:a.CIM_BIOSElement.response.Manufacturer, -"Vers\u00e3o":v,"Data de lan\u00e7amento":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Processador "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabricante:trademarks(d.Manufacturer),"Fam\u00edlia":DMTFProcFamilly[c.Family],"Vers\u00e3o":trademarks(d.Version),"Velocidade m\u00e1xima do soquete":c.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[c.CPUStatus]}, +"Vers\u00e3o":u,"Data de lan\u00e7amento":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    Processador "+(parseInt(g)+1)+"

    ",b+=FullTable({Fabricante:trademarks(d.Manufacturer),"Fam\u00edlia":DMTFProcFamilly[c.Family],"Vers\u00e3o":trademarks(d.Version),"Velocidade m\u00e1xima do soquete":c.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[c.CPUStatus]}, "");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

    M\u00f3dulo de mem\u00f3ria "+(+g+1)+"

    ",b+=FullTable({"R\u00f3tulo do banco":c.BankLabel,Fabricante:c.Manufacturer,"N\u00famero de s\u00e9rie":c.SerialNumber,Tamanho:parseInt(c.Capacity/1048576)+" MB","Fator de forma":DMTFMemFormFactor[c.FormFactor],Tipo:DMTFMemType[c.MemoryType],"Etiqueta de recurso":c.Tag,"N\u00famero da pe\u00e7a":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c= a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="

    M\u00eddia de armazenamento "+(parseInt(g)+1)+"

    ",b+=FullTable({Modelo:d.Model,"N\u00famero de s\u00e9rie":""==d.SerialNumber?"Unknown":d.SerialNumber,Tamanho:parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="
    ";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+= "

    Battery

    ",g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,Fabricante:c.Manufacturer,"Manufacture date":g,"N\u00famero de s\u00e9rie":c.SerialNumber,Tipo:"De outros;Desconhecido;Lead Acid;Nickel Cadmium;Nickel Metal Hydride;Lithium-ion;Zinc air;Lithium Polymer".split(";")[a.CIM_Battery.response.Chemistry],"Design capacity":a.CIM_Battery.response.DesignCapacity+" mWatt-hours","Design voltage":a.CIM_Battery.response.DesignVoltage+" mVolts"}, @@ -1175,18 +1173,18 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0
    '; - response += ''; response += ''; - response += ''; + response += ''; } response += '

    Gerencie as contas de usu\u00e1rio Intel® AMT deste computador.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== -v&&(n+="Desativado,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Reinos[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Auditor,");n=0<=a.Realms.indexOf(3)?n+"Administrador":1==l?n+"1 regi\u00e3o":n+(l+" reinos")}else n+="Administrador",a.Handle=-1;b+="
    ";0

    Gerencie as contas de usu\u00e1rio Intel® AMT deste computador.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2== +u&&(n+="Desativado,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Reinos[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="Auditor,");n=0<=a.Realms.indexOf(3)?n+"Administrador":1==k?n+"1 regi\u00e3o":n+(k+" reinos")}else n+="Administrador",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("Nova conta", "newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"Editar conta",-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,"Nova conta",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Erro na conta","Par\u00e2metros inv\u00e1lidos");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, -l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("Erro na conta","Par\u00e2metros inv\u00e1lidos");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d, +k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62,c)}} function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nome",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Estado",1==xxAccountEnabledInfo[b].Enabled?"ativado":"Desativado"));if(g==xxAccountAdminName)a+=addHtmlValue("Permiss\u00e3o","Administrador");else{var a=a+addHtmlValue("Permiss\u00e3o",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v="Administrador", -0<=c.Realms.indexOf(20)&&(v+="Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("Conta"+g,a+"")}} +function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="
    ",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nome",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Estado",1==xxAccountEnabledInfo[b].Enabled?"ativado":"Desativado"));if(g==xxAccountAdminName)a+=addHtmlValue("Permiss\u00e3o","Administrador");else{var a=a+addHtmlValue("Permiss\u00e3o",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u="Administrador", +0<=c.Realms.indexOf(20)&&(u+="Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("Conta"+g,a+"
    ")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (Esvaziar)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    Erro #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1234,10 +1232,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0, -70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0, +70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"Servidor":"")+"Sess\u00e3o IDE-R , conectada,"+ider.m.bytesFromAmt+" no,"+ider.m.bytesToAmt+" Fora.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , os blocos s\u00e3o {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Disquete , os blocos s\u00e3o {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height= +function iderSectorStats(b,c,a,d,g){var u=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=u.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , os blocos s\u00e3o {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" Disquete , os blocos s\u00e3o {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height= 6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Conex\u00e3o peri\u00f3dica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Gerenciar servidores de gerenciamento remoto Intel® AMT.

    ";if(0== +"PolicyRuleName","Peri\u00f3dico");if(g){var u=atob(g.ExtendedData);0==ReadInt(u,0)&&(c+=format(", a cada {0} segundos",ReadInt(u,4)));1==ReadInt(u,0)&&(g=ReadInt(u,4),u=ReadInt(u,8),10>u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("Conex\u00e3o peri\u00f3dica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    Gerenciar servidores de gerenciamento remoto Intel® AMT.

    ";if(0== xxCiraServers.length)b+="

    Nenhum servidor remoto encontrado.

    ";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+="
    Gerenciar proxies HTTP usados \u200b\u200bpara conex\u00f5es de gerenciamento.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses, 0==c.length)b+="

    Nenhum proxy configurado.

    ";else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("Adicionar servidor...","AddRemoteAccessServer()"),a&&(d+=AddButton("Adicionar proxy ...","AddRemoteAccessProxy()")));b+="
    "+TableEnd(AddRefreshButton("PullRemoteAccess()")+ d);QH(52,b)}}var xxEditMpsPolicyType; @@ -1295,9 +1293,9 @@ c+="

    Gerenciar o armazenamento Intel® AMT para este computador.

    ";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+ -" / "+p):g+"Raiz";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Baixar","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("", -function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Nenhum arquivo encontrado.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("Envio...","UploadToStorage()"): +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    Gerenciar o armazenamento Intel® AMT para este computador.

    ";var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+ +" / "+p):g+"Raiz";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("Baixar","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+EscapeHtml(e)+", "+b[c][p][e].size+" bytes
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==v&&(wsstack.comm.PerformAjax("", +function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="

    Nenhum arquivo encontrado.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(u?AddButton("Envio...","UploadToStorage()"): ""));QH(55,a)}else QH(55,"N\u00e3o foi poss\u00edvel carregar os dados de armazenamento ...
    "+AddButton("Atualizar","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Fornecedor",b));""!=c&&(g+=addHtmlValue("Inscri\u00e7\u00e3o",c));g+=addHtmlValue("Nome",a);g+=addHtmlValue("Tamanho",v.size+" bytes");v.link&&(g+=addHtmlValue("Liga\u00e7\u00e3o",v.link));setDialogMode(11,"Item de armazenamento",5,showStorageDetailsEx,g,d)}} +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Fornecedor",b));""!=c&&(g+=addHtmlValue("Inscri\u00e7\u00e3o",c));g+=addHtmlValue("Nome",a);g+=addHtmlValue("Tamanho",u.size+" bytes");u.link&&(g+=addHtmlValue("Liga\u00e7\u00e3o",u.link));setDialogMode(11,"Item de armazenamento",5,showStorageDetailsEx,g,d)}} function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Armazenamento",format("N\u00e3o foi poss\u00edvel excluir o arquivo (ERR {0}), verifique se o computador est\u00e1 ligado.",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","noopener,noreferrer");a.opener=null;a.focus()}} function PushToStorage(b,c,a){var d=null;7E3c[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";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+= -"Content-Encoding: gzip");a+="Content-Type: "+g+"";""!=v&&(a+=""+v+"");a+=""+b.target.result;PushToStorage(c,a)}function _fmtdatetime(b){return b.replace("T"," ").replace("Z","")} +function UploadToStorageEx2(b){var c;c=Q("mstoragevendor").value;var a=Q("mstorageapplication").value,d=Q("mstoragefilename").value;""==d&&(d="Filename");var g=Q("mstoragetype").value;""==g&&(g="application/octet-stream");var u=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="";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+= +"Content-Encoding: gzip");a+="Content-Type: "+g+"";""!=u&&(a+=""+u+"");a+=""+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"," dias").replace("H"," horas").replace("M"," minutos");b=b.replace(" 1 dia"," 1 dia").replace(" 1 hora"," 1 hora").replace(" 1 minuto "," 1 minuto ");return b.substring(0,b.length-1)}function _fmttimepad(b){for(b=""+b;2>b.length;)b="0"+b;return b}var xxAlarms=null; function PullAlarms(){var b=TableStart2()+"

    Gerenciar alarmes de ativa\u00e7\u00e3o.

    ";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,g){if(200==g){QV("go23",!0);if(0"+d[c].ElementName+", acordar em "+(new Date(d[c].StartTime.Datetime)).toLocaleString().replace(", "," \u00e0s"),void 0!=d[c].Interval&&(a+=" e cada"+_fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&&(a+=", exclua quando terminar"), b+="
    ",xxAccountAdminName&&(b+=" "+AddButton2("Editar...",'showAddAlarm(" + i + ")')),b+="
    "+a+"
    ";else xxAlarms=null,b+="

    Nenhum alarme de ativa\u00e7\u00e3o registrado.

    ";d="
     "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Remova todos os alarmes","RemoveAllAlarms()")+ AddButton("Adicionar","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ -g+""}function RemoveAllAlarms(){setDialogMode(1,"Remova todos os alarmes de ativa\u00e7\u00e3o",3,RemoveAllAlarmsEx,"Confirmar a remo\u00e7\u00e3o de todos os alarmes de ativa\u00e7\u00e3o?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +g+""}function RemoveAllAlarms(){setDialogMode(1,"Remova todos os alarmes de ativa\u00e7\u00e3o",3,RemoveAllAlarmsEx,"Confirmar a remo\u00e7\u00e3o de todos os alarmes de ativa\u00e7\u00e3o?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"Adicionar novo alarme",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 Verifique se o alarme \u00e9 para um tempo futuro.",d)):0!=c.Body.ReturnValue?messagebox("Adicionar alarme",format("Falha ao adicionar o alarme {0}.
    Verifique se o alarme \u00e9 para um tempo futuro.", -c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Editar alarme",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}} +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Adicionar alarme",format("Falha ao adicionar alarme. Status: {0}.
    Verifique se o alarme \u00e9 para um tempo futuro.",d)):0!=c.Body.ReturnValue?messagebox("Adicionar alarme",format("Falha ao adicionar o alarme {0}.
    Verifique se o alarme \u00e9 para um tempo futuro.", +c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Editar alarme",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("Nome",c.ElementName)+addHtmlValue("Tempo de vig\u00edlia",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("interno",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Depois de acordar",1==c.DeleteOnCompletion?"Excluir alarme":"Manter Alarme")+"
    ";messagebox(format("Alarme {0}",c.ElementName),a);setDialogMode(11,"Alarme"+ -c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"Est\u00e1 bem",401:"Erro de autentica\u00e7\u00e3o",408:"Erro de tempo limite",601:"Erro de an\u00e1lise do WSMAN",602:"N\u00e3o foi poss\u00edvel analisar o cabe\u00e7alho de resposta HTTP",603:"Resposta inesperada de enumera\u00e7\u00e3o HTTP",604:"Resposta inesperada de recebimento de HTTP",997:"Regi\u00e3o de resumo inv\u00e1lida"}; +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"Est\u00e1 bem",401:"Erro de autentica\u00e7\u00e3o",408:"Erro de tempo limite",601:"Erro de an\u00e1lise do WSMAN",602:"N\u00e3o foi poss\u00edvel analisar o cabe\u00e7alho de resposta HTTP",603:"Resposta inesperada de enumera\u00e7\u00e3o HTTP",604:"Resposta inesperada de recebimento de HTTP",997:"Regi\u00e3o de resumo inv\u00e1lida"}; 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("Erro # {0}",b)),401==b&&QH(5,'Erro de autentica\u00e7\u00e3o

    '),go(100),QS(3).width=0);return 200!=b} function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Erro de chamada",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Erro de chamada",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"

    "} function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""} function AddButton2(b,c,a){return""}function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", -c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), -u&1):0==N&&(H?g.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),u&1):g.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),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30== -v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11); -switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a, -b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e= -new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&& -v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84, -String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29); -if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2", -a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8)); -return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0}; -var H=[],N=!1,u=null,T,P,F;return g},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,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function v(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData=""; -for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,D,G){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40, +0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:G=((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,G,d);a(c,G,d,D);break;case 10:return G=((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,G,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){G= +d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;G=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;G=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,G,0),D&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1, +2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);G=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),D&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null== +g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,G);g.SendDataToHost(G,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),D&1);break;case 40:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10", +c,G,d);a(c,G,d,D);break;case 42:case 46:G=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,G,d);g.SendGetDataFromHost(c,512*d);break;case 67:G=ReadShort(d,7);var q=d.charCodeAt(1)&2,J=d.charCodeAt(2)&7;0==J&&(J=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+G+", msf="+q+", format="+J);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==J?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0), +D&1):0==J&&(q?g.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),D&1):g.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),D&1));break;case 70:var J=2!=d.charCodeAt(1),P=ReadShort(d,2);G=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,J,P,G);if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;q=IntToStr(8);0==P&&(q+=m);if(1==P||J&&1>P)q+=l;if(2==P||J&&2>P)q+=h;if(3==P||J&&3>P)q+=r;if(16==P||J&&16>P)q+=O;if(30== +P||J&&30>P)q+=C;if(256==P||J&&256>P)q+=x;if(261==P||J&&261>P)q+=z;q=IntToStr(q.length)+q;q.length>G&&(q=q.substring(0,G));g.SendDataToHost(c,!0,q,D&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");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),D&1);break;case 76:g.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),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);G=ReadShort(d,7);q=null;if(0==G)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),D&1),-1;G=0;160==c?null!=g.floppy&&(G=g.floppy.size>>9):null!=g.cdrom&&(G=g.cdrom.size>>11); +switch(d.charCodeAt(2)&63){case 1:q=160==c?2880>=G?A:R:y;break;case 5:160==c&&(q=2880>=G?p:n);break;case 63:q=160==c?2880>=G?v:k:E;break;case 26:176==c&&(q=e);break;case 29:176==c&&(q=B);break;case 42:176==c&&(q=w)}null==q?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,q,D&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,x,e){var c=null,A=0;160==a&&(c=g.floppy,null!=g.floppy&&(A=g.floppy.size>>9));176== +a&&(c=g.cdrom,null!=g.cdrom&&(A=g.cdrom.size>>11));if(0>x||b+x>A)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,A,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==J?D.push({media:c,dev:a,lba:b,len:x,fr:e}):(J=c,P=a,q=b,N=x,d(e)))}function d(a){var b=N,x=q;N>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);N-=b;q+=b;var e=new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b), +b=String.fromCharCode.apply(null,b));g.SendDataToHost(P,0==N,b,a&1);0>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=u&&u.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++; +g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.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)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr= +ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192g.acc.length)break;a=g.acc.charCodeAt(8);null===J?(g.SendCommand(71),b("RESETOCCURED1",a)):(G=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)): +2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),A=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),A,x);c(a,e,A,x);return 28;case 83:if(14>g.acc.length)break; +a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.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",g.acc[0]),g.Stop()}return 0};var D=[],G=!1,J=null,P,q,N;return g},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,g,u,n){b("SIDER-Start",a,d,g,u,n);c.host=a;c.port=d;c.user=g;c.pass=u;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="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof u?"&serverauth=1&user="+g:"")+"&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(g){}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,g){function u(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 n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function k(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData= +"";for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&& (e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&& "chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.lengthp)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")? -e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0= e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a, b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm; if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop, -response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;pn.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.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>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;iw;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+ -p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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>n.byteLength)break;b=10; -break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;iw;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+ +k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.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> +n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLengthn.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8'+a.InstanceID+""; -var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; -b+=""}else b+=a[c];b+=""}return b+""}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('
    "+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A=""; -g="";null!=l&&null!=B&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+l+''+ -B+"",A='');null!=g&&(g=""+g+"");"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"+q.Address+ -""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+g+""+A+"";q.PerformAjax(a+"
    ",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe= -function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";q.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ -q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(k)+"";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&& -b[g].ReferenceParameters){a+=""+b[g].Address+""+b[g].ReferenceParameters.ResourceURI+"";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B"+K[B].Value+"";else a+=""+K.Value+"";a+=""}else if(Array.isArray(b[g]))for(B=0;B"+b[g][B].toString()+"";else a+=""+b[g].toString()+"";b=a+("")}else b="";q.PerformAjax(k+b+"",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(k)+"';for(var g in b)a+=""+b[g]+"";q.PerformAjax(a+"",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(b)+"";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k, -h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+=""+c[l][B]+"";else g+=""+c[l]+"";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+""+q.Address+""+a+""+q.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -p(h)+"'+c+"",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', -b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+q.Address+""+a+""+q.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", -c,p,d)};q.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), -e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e, -null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435"; -if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}", +-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,g,u){function n(a){for(var b,c={},p=0;p'+a.InstanceID+""; +var b="",c;for(c in a)if(a.hasOwnProperty(c)){b+='';if(a[c].ReferenceParameters){var b=b+"",b=b+(""+a[c].Address+""+a[c].ReferenceParameters.ResourceURI+""),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d"+p[d].Value+"";else b+=""+p.Value+""; +b+=""}else b+=a[c];b+=""}return b+""}var v={NextMessageId:1,Address:"/wsman"};v.comm=CreateWsmanComm(b,c,a,d,g,u);v.PerformAjax=function(a,b,c,p,d){null==d&&(d="");v.comm.PerformAjax('
    "+a,function(a,c,e){var p=v.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(v,p.Header.ResourceURI,p,c,e)}else b(v,null,{Header:{HttpError:c}},601,e)},c,p)};v.CancelAllQueries=function(a){v.comm.CancelAllQueries(a)};v.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};v.ExecSubscribe=function(a,b,c,d,m,l,h,r,g,k){var x="",z=""; +r="";null!=g&&null!=k&&(x='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+g+''+ +k+"",z='');null!=r&&(r=""+r+"");"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"+v.Address+ +""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(h)+x+'
    '+c+""+r+""+z+"";v.PerformAjax(a+"
    ",d,m,l,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};v.ExecUnSubscribe= +function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+p(m)+"";v.PerformAjax(a+"",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};v.ExecPut=function(a,b,c,d,m,l){l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+ +v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+p(l)+"";if(a&&null!=b){var h=v.GetNameFromUrl(a);a="';for(var r in b)if(b.hasOwnProperty(r)&&0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&& +b[r].ReferenceParameters){a+=""+b[r].Address+""+b[r].ReferenceParameters.ResourceURI+"";var g=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(g))for(var C=0;C"+g[C].Value+"";else a+=""+g.Value+"";a+=""}else if(Array.isArray(b[r]))for(C=0;C"+b[r][C].toString()+"";else a+=""+b[r].toString()+"";b=a+("")}else b="";v.PerformAjax(l+b+"",c,d,m)};v.ExecCreate=function(a,b,c,d,m,l){var h=v.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(l)+"';for(var g in b)a+=""+b[g]+"";v.PerformAjax(a+"",c,d,m)};v.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(b)+"";v.PerformAjax(a,c,d,m)};v.ExecGet=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S",b,c,p)};v.ExecMethod=function(a,b,c,p,d,l, +h){var g="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var C in c[k])g+=""+c[k][C]+"";else g+=""+c[k]+"";v.ExecMethodXml(a,b,g,p,d,l,h)};v.ExecMethodXml=function(a,b,c,d,m,l,h){v.PerformAjax(a+"/"+b+""+v.Address+""+a+""+v.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +p(h)+"'+c+"",d,m,l)};v.ExecEnum=function(a,b,c,p){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +b,c,p)};v.ExecPull=function(a,b,c,p,d){v.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+v.Address+""+a+""+v.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+b+"", +c,p,d)};v.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 p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],l;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(), +e.Enum(a[0],a[1],a[2]),g(0))}function u(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,u(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,d)}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](e, +null,y[2]);else{var h,m,g;b=y[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0m)){g={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*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=l[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,k,[y[0],b,y[2]]);else y[0](e,b,y[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435"; +if(0==b)return E[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],O[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}", h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&&64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase"; if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18==a&&170==c[0])return"\u0410\u0433\u0435\u043d\u0442 \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0439"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043d\u0430"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"\u0421\u043b\u0443\u0447\u0430\u0439 \u0432\u0442\u043e\u0440\u0436\u0435\u043d\u0438\u044f"; if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"\u0423\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441 Serial Over LAN \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d.";if(1==c[2])return"\u0421\u0435\u0430\u043d\u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0431\u044b\u043b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d."; @@ -102,23 +101,23 @@ if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"\u041f\u043e\u043b\u0 if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"\u041e\u0448\u0438\u0431\u043a\u0430 HWA: \u043e\u0431\u0449\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430"}return 6==a?"\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438"+(c[1]+(c[2]<<8))+" \u0440\u0430\u0437. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0442\u0430\u043a\u043e\u0432\u0430\u043d\u0430.":30==a?"\u041d\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f": 32==a?"\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b": 37==a?"\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e).":"\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #"+ -a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0\u041c\u0435\u0441\u0442\u043d\u044b\u0439",h=5);3==b.InitiatorType&&(b.Initiator="KVM \u043f\u043e\u0440\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++); -r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0; -e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)}, -0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a), -b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCountm.length)e.AMT_AuditLog_ReadRecords(m.length+1,v,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0; +e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var B=0,w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,y,h,l,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,A,z){c();d(e,a,A,z,y)},0,h,l,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,y){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,y,h,l){c();b(e,a,h,l,p)}, +0,d,y);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,h,l,m){c();b(e,a,l,m,p)},0,d);c()};e.Put=function(a,b,p,d,y,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y,h);c()};e.Create=function(a,b,p,d,y){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Delete=function(a,b,p,d,y){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,y,z,h){c();p(e,a,z,h,d)},0,y);c()};e.Exec=function(a,b,p,d,y,h,l){e.wsman.ExecMethod(e.CompleteName(a), +b,p,function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.ExecWithXml=function(a,b,p,d,y,h,l){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,A,z){c();d(e,a,e.CompleteExecResponse(A),z,y)},0,h,l);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,b)};e.SetBootConfigRole=function(a,b){e.CIM_BootService_SetBootConfigRole('
    http://schemas.xmlsoap.org/ws/2004/08/addressing
    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h, -k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= +l,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,l,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence= function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature= function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService", -"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", +"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,l){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},l)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx", {Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService", "SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash= function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a, @@ -128,8 +127,8 @@ b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","Canc b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService", "AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey= function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair= -function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, -Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", +function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,l,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b, +Port:c,AuthMethod:p,Certificate:d,Username:h,Password:l,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService", "CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)}; e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout= @@ -150,8 +149,8 @@ c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sens {},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog", "Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange= function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a, -b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, -NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= +b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a, +NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin= function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService", "StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange= @@ -161,12 +160,12 @@ TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p 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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n, -[a,b,[]])};var D="\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e. ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u200b\u200b\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. ; \u041d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u043e \u0432\u0441\u0435\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c\u044b\u0439 \u0441\u0431\u043e\u0439. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u044b\u0439 \u0441\u0431\u043e\u0439 \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 / \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 ATAPI / IDE. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u044b\u0439 \u0441\u0431\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u044b. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u0434\u0438\u0441\u043a\u0435\u0442\u0430 \u0421\u0431\u043e\u0439 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 PS / 2 \u0438\u043b\u0438 USB-\u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b. ; \u0421\u044a\u0435\u043c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e. ; \u041d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0432\u0438\u0434\u0435\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. ; \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (BIOS) \u041f\u0417\u0423. ; \u041d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 (\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044e) ; \u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430".split(";"), +[a,b,[]])};var E="\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e. ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u200b\u200b\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. ; \u041d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u043e \u0432\u0441\u0435\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c\u044b\u0439 \u0441\u0431\u043e\u0439. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u044b\u0439 \u0441\u0431\u043e\u0439 \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 / \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 ATAPI / IDE. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u044b\u0439 \u0441\u0431\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u044b. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u0434\u0438\u0441\u043a\u0435\u0442\u0430 \u0421\u0431\u043e\u0439 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 PS / 2 \u0438\u043b\u0438 USB-\u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b. ; \u0421\u044a\u0435\u043c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d. ; \u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e. ; \u041d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0432\u0438\u0434\u0435\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. ; \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (BIOS) \u041f\u0417\u0423. ; \u041d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 (\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044e) ; \u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430".split(";"), m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"), -k="\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e ; \u0414\u0440\u0443\u0433\u043e\u0435 ; \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e ; \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 ; \u0414\u0438\u0441\u043a ; \u041f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 ; \u041c\u043e\u0434\u0443\u043b\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 ; \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 ; \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 ; \u0411\u043b\u043e\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0442\u0443 ; \u041f\u043b\u0430\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 ; \u041f\u043b\u0430\u0442\u0430 \u0437\u0430\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 ; \u041f\u043b\u0430\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u0417\u0430\u0434\u043d\u044f\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u043f\u0440\u0438\u0432\u043e\u0434\u0430 ; \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043f\u043b\u0430\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043b\u0430\u0442\u0430 ; \u0414\u0440\u0443\u0433\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 ; \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 ; \u0411\u043b\u043e\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u0411\u043b\u043e\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u041f\u043b\u0430\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c ; \u041f\u043b\u0430\u0442\u0430 \u0437\u0430\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0448\u0430\u0441\u0441\u0438 ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0448\u0430\u0441\u0441\u0438 ; \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0448\u0430\u0441\u0441\u0438 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0434\u0430 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u0434\u0438\u0441\u043a\u043e\u0432 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 ; \u0412\u0435\u043d\u0442\u0438\u043b\u044f\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0445\u043b\u0430\u0436\u0434\u0435\u043d\u0438\u0435 ; \u0411\u043b\u043e\u043a \u043e\u0445\u043b\u0430\u0436\u0434\u0435\u043d\u0438\u044f ; \u041a\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 ; \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0430\u043c\u044f\u0442\u0438 ; \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 ; BIOS ; Intel (r) ME ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u0448\u0438\u043d\u0430 ; \u0413\u0440\u0443\u043f\u043f\u0430 ; Intel (r) ME ; \u0412\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0440\u0435\u0434\u0430 ; \u0411\u0430\u0442\u0430\u0440\u0435\u044f ; \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0431\u043b\u0435\u0439\u0434 ; \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f ; \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 / \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 ; \u041c\u043e\u0434\u0443\u043b\u044c \u0432\u0432\u043e\u0434\u0430 / \u0432\u044b\u0432\u043e\u0434\u0430 ; \u041c\u043e\u0434\u0443\u043b\u044c \u0432\u0432\u043e\u0434\u0430 / \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 ; \u041f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ; \u041a\u0430\u043d\u0430\u043b IPMI ; \u0428\u0438\u043d\u0430 PCI ; \u0428\u0438\u043d\u0430 PCI Express ; \u0428\u0438\u043d\u0430 SCSI ; \u0428\u0438\u043d\u0430 SATA / SAS ; \u0428\u0438\u043d\u0430 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430".split(";"); +l="\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e ; \u0414\u0440\u0443\u0433\u043e\u0435 ; \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e ; \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 ; \u0414\u0438\u0441\u043a ; \u041f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 ; \u041c\u043e\u0434\u0443\u043b\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 ; \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 ; \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 ; \u0411\u043b\u043e\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0442\u0443 ; \u041f\u043b\u0430\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 ; \u041f\u043b\u0430\u0442\u0430 \u0437\u0430\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 ; \u041f\u043b\u0430\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u0417\u0430\u0434\u043d\u044f\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u043f\u0440\u0438\u0432\u043e\u0434\u0430 ; \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043f\u043b\u0430\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043b\u0430\u0442\u0430 ; \u0414\u0440\u0443\u0433\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 ; \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0430 ; \u0411\u043b\u043e\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u0411\u043b\u043e\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f ; \u041f\u043b\u0430\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c ; \u041f\u043b\u0430\u0442\u0430 \u0437\u0430\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0448\u0430\u0441\u0441\u0438 ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0448\u0430\u0441\u0441\u0438 ; \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0448\u0430\u0441\u0441\u0438 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0434\u0430 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u0434\u0438\u0441\u043a\u043e\u0432 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 ; \u041e\u0442\u0441\u0435\u043a \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 ; \u0412\u0435\u043d\u0442\u0438\u043b\u044f\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0445\u043b\u0430\u0436\u0434\u0435\u043d\u0438\u0435 ; \u0411\u043b\u043e\u043a \u043e\u0445\u043b\u0430\u0436\u0434\u0435\u043d\u0438\u044f ; \u041a\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 ; \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0430\u043c\u044f\u0442\u0438 ; \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 ; BIOS ; Intel (r) ME ; \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u0448\u0438\u043d\u0430 ; \u0413\u0440\u0443\u043f\u043f\u0430 ; Intel (r) ME ; \u0412\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0440\u0435\u0434\u0430 ; \u0411\u0430\u0442\u0430\u0440\u0435\u044f ; \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0431\u043b\u0435\u0439\u0434 ; \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f ; \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 / \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 ; \u041c\u043e\u0434\u0443\u043b\u044c \u0432\u0432\u043e\u0434\u0430 / \u0432\u044b\u0432\u043e\u0434\u0430 ; \u041c\u043e\u0434\u0443\u043b\u044c \u0432\u0432\u043e\u0434\u0430 / \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 ; \u041f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ; \u041a\u0430\u043d\u0430\u043b IPMI ; \u0428\u0438\u043d\u0430 PCI ; \u0428\u0438\u043d\u0430 PCI Express ; \u0428\u0438\u043d\u0430 SCSI ; \u0428\u0438\u043d\u0430 SATA / SAS ; \u0428\u0438\u043d\u0430 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430".split(";"); e.RealmNames=";; \u041f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ;; \u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 ; \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ; \u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 ; \u0414\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 ; \u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 ; \u041c\u0435\u0441\u0442\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u0430 ; \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u0430 ; \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c ; \u0412\u0440\u0435\u043c\u044f \u0441\u0435\u0442\u0438 ; \u041e\u0431\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f ; \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 ; EIT ; LocalUN ; \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 ; \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 Admin ; \u0427\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 ; \u0416\u0443\u0440\u043d\u0430\u043b \u0430\u0443\u0434\u0438\u0442\u0430 ; \u041e\u0431\u043b\u0430\u0441\u0442\u044c ACL ;;; \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430".split(";"); e.WatchdogCurrentStates={1:"\u041d\u0435 \u043d\u0430\u0447\u0430\u0442\u043e",2:"\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f",4:"\u0411\u0435\u0433",8:"\u0418\u0441\u0442\u0435\u043a\u0448\u0438\u0439",16:"\u043f\u043e\u0434\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u0439"};var h="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(";"), -r=";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(";"),K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438",17:"RCO",18:"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f", +r=";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(";"),O={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},C={16:"\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438",17:"RCO",18:"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f", 19:"\u0414\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438",20:"\u0416\u0443\u0440\u043d\u0430\u043b \u0430\u0443\u0434\u0438\u0442\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438",21:"\u0421\u0435\u0442\u0435\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f",22:"\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0438", 23:"\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430",24:"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u043e \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f\u043c",25:"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f", 26:"\u0414\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u043e\u0432",27:"\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u0438",28:"EAC",29:"KVM",30:"\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f", @@ -195,17 +194,17 @@ e.GetAuditLogExtendedDataStr=function(a,b){if((1602==a||1604==a)&&0==b.charCodeA 0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"\u0414\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0443\u043b\u044c\u0442"+["NOAUTH","ServerAuth","\u0432\u0437\u0430\u0438\u043c\u043e\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438"][b.charCodeAt(0)]+", \u041c\u0435\u0441\u0442\u043d\u044b\u0439"+["NOAUTH","ServerAuth","\u0432\u0437\u0430\u0438\u043c\u043e\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438"][b.charCodeAt(1)]: 1617==a?e.RealmNames[ReadInt(b,0)]+","+["NOAUTH","Auth","\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","\u041c\u0435\u0441\u0442\u043d\u044b\u0439 \u041c\u042d\u0418","\u041c\u0435\u0441\u0442\u043d\u044b\u0439 WSMAN","\u0423\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 WSAMN"][b.charCodeAt(0)]:1900==a?"\u041e\u0442"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" \u0432"+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?"\u041e\u0442"+["\u041d\u0438\u043a\u0442\u043e","KVM","\u0412\u0441\u0435"][b.charCodeAt(0)]+" \u0432"+["\u041d\u0438\u043a\u0442\u043e","KVM","\u0412\u0441\u0435"][b.charCodeAt(1)]:3001==a?["\u0443\u0441\u043f\u0435\u0445","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c 3 \u0440\u0430\u0437\u0430"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1, -q,[a,[]])};return e}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?"",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("")} +v,[a,[]])};return e}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?"",u;for(u in c)c.hasOwnProperty(u)&&0!==u.indexOf("__")&&("function"===typeof c[u]||Array.isArray(c[u])||("object"===typeof c[u]?console.error("only convert one level down..."):a+=d+u+">"+c[u].toString()+g+u+">"));return a+("")} function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="/wsman"+c.__resourceUri+"",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+=''+c[d].toString()+""));return a+("")} function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;ab.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;cc&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"=== -(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ -c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; +(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0>>=1,0>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[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];e.encode64=function(a,b){for(var c="",p="",e,d,h,l=0;l>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+ +c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,l=0;l>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}}; e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, -b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); -var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0, +b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a); +var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h");break;case "%":d.push("%");break;default:d.push("<#"+ c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;cc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0k.st&&e.ste.st&&k.stc[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0l.st&&e.ste.st&&l.stthis.blockSize<<2)return!1;a.truncate(c);return!0};w.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); @@ -274,27 +273,27 @@ if(0=this.blockSize)for(var d=0;d=this.blockSize)for(var g=0;g< -this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= +this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var v=(this.blockSize-p)%this.blockSize;0=this.blockSize){for(var g=0;gd;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b= [0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.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)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^ -k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^ -g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(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,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher= -function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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= +p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0>=1;for(e=2;eb;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^ +g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^ +l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}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,p){a=k({key:a,output:c,decrypt:!1,mode:p});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,p){a=k({key:a,output:c,decrypt:!0,mode:p});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){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(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(),e=0;e>>=2,e=0;eb.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var l=b.getByte(),m=l&192,h=l&31,r=d(b);if(b.length()=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,d||(g|=128),e.push(g),d=!1;while(0c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"=== +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,g,v=2;v>>=7,d||(g|=128),e.push(g),d=!1;while(0c[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;ac[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(32b;++b)k[b]=Math.floor(4294967296* -Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= -a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qw;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32> -w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>> -27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= -0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, -h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;ql;++l)b[l]=d.getInt32(); -for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-= -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(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- -1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,A+=x,l.putInt32(A>>>0),A=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,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= -{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S- -16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0, -E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0; -q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| -{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408, +'", 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 r=0,k=0;h&&kb;++b)l[b]=Math.floor(4294967296* +Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,y,D,v,k=c.length();64<=k;){p=a.h0;h=a.h1;g=a.h2;y=a.h3;for(v=0;16>v;++v)b[v]=c.getInt32Le(),e=y^h&(g^y),e=p+e+l[v]+b[v],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;32>v;++v)e=g^y&(h^g),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;48>v;++v)e=h^g^y,e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;for(;64>v;++v)e=g^(h|~y),e=p+e+l[v]+b[n[v]],D=m[v],p=y,y=g,g=h,h+=e<>>32-D;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3= +a.h3+y|0;k-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),l=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d>>0,v>>>0],y=m.fullMessageLength.length-1;0<=y;--y)m.fullMessageLength[y]+=v[1],v[1]=v[0]+(m.fullMessageLength[y]/4294967296>>>0),m.fullMessageLength[y]>>>=0,v[0]=v[1]/4294967296>>>0;g.putBytes(c);d(b,l,g);(2048>>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 m};var k=null,n=null,m=null,l=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g= +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vw;++w)e=d.getInt32(),b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=k^g&(v^k),e=(p<<5|p>>>27)+A+z+1518500249+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;32> +w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>>27)+A+z+1859775393+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g&v|k&(g^v),e=(p<<5|p>>>27)+A+z+2400959708+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,A=g^v^k,e=(p<<5|p>>> +27)+A+z+3395469782+e,z=k,k=v,v=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+v|0;a.h3=a.h3+k|0;a.h4=a.h4+z|0;y-=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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),e=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>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>= +0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,x+=C,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3, +h4:b.h4};c(w,e,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 g=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vk;++k)b[k]=d.getInt32(); +for(;64>k;++k)e=b[k-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[k-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[k]=e+b[k-7]+p+b[k-16]|0;A=a.h0;w=a.h1;y=a.h2;D=a.h3;G=a.h4;J=a.h5;B=a.h6;q=a.h7;for(k=0;64>k;++k)e=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7),g=B^G&(J^B),p=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),v=A&w|y&(A^w),e=q+e+g+n[k]+b[k],p+=v,q=B,B=J,J=G,G=D+e|0,D=y,y=w,w=A,A=e+p|0;a.h0=a.h0+A|0;a.h1=a.h1+w|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+G|0;a.h5=a.h5+J|0;a.h6=a.h6+B|0;a.h7=a.h7+q|0;u-= +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||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[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(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32, +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e>>0,x>>>0],w=r.fullMessageLength.length- +1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048>>0,z+=x,k.putInt32(z>>>0),z=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,e,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 r};var g=null,k=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge= +{}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 v=0;vS;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)k=b[S-2],w=k[0],k=k[1],e=((w>>>19|k<<13)^(k>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|k>>>19)^(k<<3|w>>>29)^(w<<26|k>>>6))>>>0,k=b[S-15],w=k[0],k=k[1],g=((w>>>1|k<<31)^(w>>>8|k<<24)^w>>>7)>>>0,l=((w<<31|k>>>1)^(w<<24|k>>>8)^(w<<25|k>>>7))>>>0,w=b[S-7],B=b[S- +16],k=p+w[1]+l+B[1],b[S][0]=e+w[0]+g+B[0]+(k/4294967296>>>0)>>>0,b[S][1]=k>>>0;w=a[0][0];B=a[0][1];q=a[1][0];n=a[1][1];u=a[2][0];L=a[2][1];Y=a[3][0];K=a[3][1];E=a[4][0];V=a[4][1];I=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];H=a[7][0];F=a[7][1];for(S=0;80>S;++S)e=((E>>>14|V<<18)^(E>>>18|V<<14)^(V>>>9|E<<23))>>>0,k=((E<<18|V>>>14)^(E<<14|V>>>18)^(V<<23|E>>>9))>>>0,p=(ba^E&(I^ba))>>>0,y=(W^V&(aa^W))>>>0,g=((w>>>28|B<<4)^(B>>>2|w<<30)^(B>>>7|w<<25))>>>0,l=((w<<4|B>>>28)^(B<<30|w>>>2)^(B<<25|w>>>7))>>>0, +D=(w&q|u&(w^q))>>>0,v=(B&n|L&(B^n))>>>0,k=F+k+y+m[S][1]+b[S][1],e=H+e+p+m[S][0]+b[S][0]+(k/4294967296>>>0)>>>0,p=k>>>0,k=l+v,g=g+D+(k/4294967296>>>0)>>>0,l=k>>>0,H=ba,F=W,ba=I,W=aa,I=E,aa=V,k=K+p,E=Y+e+(k/4294967296>>>0)>>>0,V=k>>>0,Y=u,K=L,u=q,L=n,q=w,n=B,k=p+l,w=e+g+(k/4294967296>>>0)>>>0,B=k>>>0;k=a[0][1]+B;a[0][0]=a[0][0]+w+(k/4294967296>>>0)>>>0;a[0][1]=k>>>0;k=a[1][1]+n;a[1][0]=a[1][0]+q+(k/4294967296>>>0)>>>0;a[1][1]=k>>>0;k=a[2][1]+L;a[2][0]=a[2][0]+u+(k/4294967296>>>0)>>>0;a[2][1]=k>>>0; +k=a[3][1]+K;a[3][0]=a[3][0]+Y+(k/4294967296>>>0)>>>0;a[3][1]=k>>>0;k=a[4][1]+V;a[4][0]=a[4][0]+E+(k/4294967296>>>0)>>>0;a[4][1]=k>>>0;k=a[5][1]+aa;a[5][0]=a[5][0]+I+(k/4294967296>>>0)>>>0;a[5][1]=k>>>0;k=a[6][1]+W;a[6][0]=a[6][0]+ba+(k/4294967296>>>0)>>>0;a[6][1]=k>>>0;k=a[7][1]+F;a[7][0]=a[7][0]+H+(k/4294967296>>>0)>>>0;a[7][1]=k>>>0;Z-=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 g=a.sha384=a.sha512.sha384=a.sha512.sha384|| +{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;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){n||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),m=[[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]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199], +[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]],l={"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]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength= -0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]= -h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;hz;++z)x[z]=Array(2);var A={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength= +0;A.fullMessageLength=A.messageLength128=[];for(var b=A.messageLengthSize/4,c=0;c>>0,h>>>0],l=A.fullMessageLength.length-1;0<=l;--l)A.fullMessageLength[l]+=h[1],h[1]=h[0]+(A.fullMessageLength[l]/4294967296>>>0),A.fullMessageLength[l]>>>=0,h[0]= +h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048>>0,m+=l,d.putInt32(m>>>0),m=y;y=Array(e.length);for(r=0;rb.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=m.length();for(h=0;h>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H>>4|q<<28)^a[T+1];b=g; -g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(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 e=d.start;d.start=function(b,c){var g= +e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var k={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(k);if(h[2]){for(var v=h[2].split(g),C=0;h&&C>>4^v)&252645135;v^=b;g^=b<<4;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(g>>>1^v)&1431655765;for(var v=v^b,g=g^b<<1,g=g<<1|g>>>31,v=v<<1|v>>>31,J=0;J>>4|v<<28)^a[N+1];b=g; +g=v;v=b^(n[U>>>24&63]|l[U>>>16&63]|r[U>>>8&63]|C[U&63]|k[L>>>24&63]|m[L>>>16&63]|h[L>>>8&63]|u[L&63])}b=g;g=v;v=b}g=g>>>1|g<<31;v=v>>>1|v<<31;b=(g>>>1^v)&1431655765;v^=b;g^=b<<1;b=(v>>>8^g)&16711935;g^=b;v^=b<<8;b=(v>>>2^g)&858993459;g^=b;v^=b<<2;b=(g>>>16^v)&65535;v^=b;g^=b<<16;b=(g>>>4^v)&252645135;c[0]=g^b<<4;c[1]=v^b}function g(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 e=d.start;d.start=function(b,c){var g= null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({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],g=[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], -k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[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],n=8>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27); -var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;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 l=[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, +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[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],L=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],K=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8>>4^F)&252645135;F^=E;H^=E<<4;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>2^F)&858993459;F^=E;H^=E<<2;E=(F>>>-16^H)&65535;H^=E;F^=E<<-16;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=(F>>>8^H)&16711935;H^=E;F^=E<<8;E=(H>>>1^F)&1431655765;F^=E;H^=E<<1;E=H<<8|F>>>20&240;for(var H=F<<24|F<<8&16711680|F>>>8&65280|F>>>24&240,F=E,S=0;S>>26,F=F<<2|F>>>26):(H=H<<1|H>>>27,F=F<<1|F>>>27); +var H=H&-15,F=F&-15,Z=c[H>>>28]|d[H>>>24&15]|e[H>>>20&15]|g[H>>>16&15]|h[H>>>12&15]|l[H>>>8&15]|k[H>>>4&15],ca=m[F>>>28]|v[F>>>24&15]|r[F>>>20&15]|w[F>>>16&15]|L[F>>>12&15]|C[F>>>8&15]|K[F>>>4&15];E=(ca>>>16^Z)&65535;B[O++]=Z^E;B[O++]=ca^E<<16}}this._keys=B;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],n=[-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],m=[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],k=[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, +8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[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],r=[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],v=[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],B=[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 g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qA)return q(null,z);n.start(null, -null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N4294967295*x){b=Error("Derived key is too long."); -if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=Nc;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()), -e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.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&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; -return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;qz)return k(null,y);n.start(null, +null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();q=2;C()}function C(){if(q<=d)return n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G,++q,a.util.setImmediate(C);y+=P4294967295*x){b=Error("Derived key is too long."); +if(k)return k(b);throw b;}var z=Math.ceil(l/x),A=l-(z-1)*x,n=a.hmac.create();n.start(h,b);var y="",D,G,J;if(!k){for(var P=1;P<=z;++P){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(P));D=J=n.digest().getBytes();for(var q=2;q<=d;++q)n.start(null,null),n.update(J),G=n.digest().getBytes(),D=a.util.xorBytes(D,G,x),J=G;y+=Pc;++c)b=31===b?2147483648:b<<2,0===b%l.reseeds&&(a.update(l.pools[c].digest().getBytes()),l.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();l.key=l.plugin.formatKey(b);l.seed=l.plugin.formatSeed(a);l.reseeds=4294967295===l.reseeds?0:l.reseeds+1;l.generated=0}function g(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()>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()), +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var l={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();l.pools=h;l.pool=0;l.generate=function(b,d){function e(v){if(v)return d(v);if(m.length()>=b)return d(null,m.getBytes(b));1048575>d&255);l.collect(c)};l.registerWorker=function(a){a===self?l.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&&l.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})}; +return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- -1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]= -(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c)); -b.push(c&65535)}y=g?0:63;for(c=0;cA;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 q=0;q>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, -c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(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 r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= -function(a){a.divRemTo(this.m,null,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)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};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)};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}; +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,k=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n- +1)+e.at(n-g)&255]);e.setAt(128-k,c[e.at(128-k)&h]);for(n=127-k;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+k)]);return e};var g=function(b,c,g){var l=!1,h=null,k=null,v=null,n,x,z,A,B=[];b=a.rc2.expandKey(b,c);for(z=0;64>z;z++)B.push(b.getInt16Le());g?(n=function(a){for(z=0;4>z;z++){a[z]+=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);var b=a[z],c=d[z];a[z]=b<>16-c;A++}},x=function(a){for(z=0;4>z;z++)a[z]+=B[a[(z+3)%4]&63]}):(n=function(a){for(z=3;0<=z;z--){var b=a[z],c=d[z];a[z]= +(b&65535)>>c|b<<16-c&65535;a[z]-=B[A]+(a[(z+3)%4]&a[(z+2)%4])+(~a[(z+3)%4]&a[(z+1)%4]);A--}},x=function(a){for(z=3;0<=z;z--)a[z]-=B[a[(z+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));l=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;v=b;y.output=k},update:function(a){for(l||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(z=0;4>z;z++){var c=h.getInt16Le();null!==v&&(g?c^=v.getInt16Le():v.putInt16Le(c)); +b.push(c&65535)}A=g?0:63;for(c=0;cz;z++)null!==v&&(g?v.putInt16Le(b[z]):b[z]^=v.getInt16Le()),k.putInt16Le(b[z])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(l=!0,y.update());!g&&(b=0===h.length())&&(a?b=a(8,k,!g):(a=k.length(),c=k.at(a-1),c>a?b=!1:k.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 g(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 g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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 k=0;k>=15;0<=--p;){var h=this.data[a]&32767,y=this.data[a++]>>15,l=b*h+y*g,h=g*h+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b, +c,d,e,p){var g=b&16383;for(b>>=14;0<=--p;){var h=this.data[a]&16383,y=this.data[a++]>>14,l=b*h+y*g,h=g*h+((l&16383)<<14)+c.data[d]+e;e=(h>>28)+(l>>14)+b*y;c.data[d++]=h&268435455}return e}function m(a,b){var c=P[a.charCodeAt(b)];return null==c?-1:c}function l(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 r(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=q;++q)P[J++]=q;J=97;for(q=10;36>q;++q)P[J++]=q;J=65;for(q=10;36>q;++q)P[J++]=q;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce= +function(a){a.divRemTo(this.m,null,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)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>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)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.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;0a?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,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<>this.DB-g):this.data[this.t-1]|=h<=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|p,p=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<>d;for(var p= -c+1;p>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=p.t)){var z=this.abs();if(z.t>this.F2:0),u=this.FV/E,E=(1<m&&c.ZERO.subTo(g,g)}}}};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 0a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<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<>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0>d|g,g=(this.data[h]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<>d;for(var g= +c+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=g.t)){var y=this.abs();if(y.t>this.F2:0),q=this.FV/D,D=(1<k&&c.ZERO.subTo(p,p)}}}};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 0a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<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<>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0this.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&&0a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.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};E.prototype.revert=function(a){return a};E.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)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.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||36k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.ta||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.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};D.prototype.revert=function(a){return a};D.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)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],U=67108864/N[N.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||36l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(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=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++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)<>24};c.prototype.shortValue= +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=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++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)<>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>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<c?(d=(this.data[a]&(1<>(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,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=16,c+=16); +(this.s&128)!=(d&128)&&++e,0this.compareTo(a)?this:a};c.prototype.max=function(a){return 0a?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>=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?0!=this.s:0!=(this.data[b]&1<=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y); -if(w)m[x].copyTo(p),w=!1;else{for(;1--c&&(c=this.DB-1,--y)}return z.revert(p)};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(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1, -g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a, +A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};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(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v); +if(G)k[x].copyTo(g),G=!1;else{for(;1--c&&(c=this.DB-1,--v)}return y.revert(g)};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(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1, +p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a, new R)};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>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create(); -v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;kb&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-vb&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r}); -z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), -c=0;cd-11)throw g= +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,l){var h,k,n,u;"string"===typeof e?(h=e,k=g||void 0,n=l||void 0):e&&(h=e.label||void 0,k=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));n?n.start():n=a.md.sha1.create(); +u||(u=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw u=Error("RSAES-OAEP input message length is too long."),u.length=d.length,u.maxLength=e,u;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(l=0;lb&&(m=k(b,c));if(m.isProbablePrime(D))return l(null,m);m.dAddOffset(h[y++%8],0)}while(0>v||+new Date-rb&&(y=k(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:r}); +y.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],e=0;e=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 m=a.prime=a.prime||{},l=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new l(null);r.fromInt(30);var u=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length), +c=0;cd-11)throw g= Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;hb.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): -(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", -tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL, -type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=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=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e, +b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,v,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)): +(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.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 v={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(v.prng=c.prng);e()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(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 m)var m=a.jsbn.BigInteger;var l=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2", +tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL, +type:l.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=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=l.oidToDer(b).getBytes();b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,c));d.value.push(l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,""));a=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return l.toDer(b).getBytes()},R=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(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.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 g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0=b||kp?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.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(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.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&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q, p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}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 e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,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=k.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,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!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,g)}};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,x,!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:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0, -[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."), -c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b, -16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL, -k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.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(!k.validate(b,x,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 m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING, -!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.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;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&& -b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break; -case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), -e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== -typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>=8,V+=E.at(l)+ea.at(l),ea.setAt(l,V&255);K.putBuffer(ea)}w=K;n.putBuffer(B)}n.truncate(n.length()-g);return n};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 e={};b=[];if(!g.validate(c,l,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.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 h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),v;switch(k.oids[b]){case "aes128-CBC":v=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":v=24;h=a.aes.createDecryptionCipher;break; +case "aes256-CBC":v=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":v=24;h=a.des.createDecryptionCipher;break;case "desCBC":v=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,v);e=e.encIv;h=h(b);h.start(e);return h};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},l=[];if(!g.validate(c,h,e,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations), +e=e.getInt(e.length()<<3),m;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:m=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;}m=k.pbe.generatePkcs12Key(d,l,1,e,m);d=k.pbe.generatePkcs12Key(d,l,2,e,c);return b(m,d)};k.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"=== +typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1); -return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q>8*x-n&255;A=String.fromCharCode(A.charCodeAt(0)&~n)+A.substr(1); +return A+u+String.fromCharCode(188)},verify:function(b,k,l){var v;v=l-1;l=Math.ceil(v/8);k=k.substr(-l);if(l>8*l-v&255;if(0!==(u.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),y="";for(v=0;vm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); -y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), -e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)}; -y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cm.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); +q.validity.notBefore=m[0];q.validity.notAfter=m[1];q.tbsCertificate=e.tbsCertificate;if(d){q.md=null;if(q.signatureOid in r)switch(k=r[q.signatureOid],k){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."), +e.signatureOid=q.signatureOid,e;m=l.toDer(q.tbsCertificate);q.md.update(m.getBytes())}m=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){g([a]);q.issuer.attributes.push(a)};q.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(q.issuer.uniqueId=e.certIssuerUniqueId);q.issuer.hash=m.digest().toHex();m=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){g([a]);q.subject.attributes.push(a)}; +q.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(q.subject.uniqueId=e.certSubjectUniqueId);q.subject.hash=m.digest().toHex();q.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];k===h.oids.rsaEncryption&&(q.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return q};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;cq.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate}); -if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0A.validity.notAfter)l={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:g};if(null===l){v=c[0]||b.getIssuer(A);null===v&&A.isIssuer(A)&&(r=!0,v=A);if(v){var n=v;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0k.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));A=null===l?!0:l.error;k=d?d(A,m,e):A;if(!0===k)l=null;else{!0===A&&(l={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&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error));throw l;}k=!1;++m}while(0>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d); -for(var q=0;q>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d); +for(var r=0;rd)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods= -l(c,1));h=d-(h-c.length());if(0d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods= +k(c,1));h=d-(h-c.length());if(0c.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 g,e=1;ec.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 g,e=1;ed)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.", -send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); -try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, -description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal, +description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=u;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=G;b.process()};m.handleServerHelloDone=function(b,c,d){if(0d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+ -4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)): +4);d.read+=4;e in I[b.entity][b.expect]?(b.entity!==m.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!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),I[b.entity][b.expect][e](b,c,g)): m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!== -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u, -P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u], -[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.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,P,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,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.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]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d= +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var l=1,h=2,r=3,u=4,C=5,x=6,z=7,A=8,R=1,y=2,D=3,G=4,J=5,P=6,q=m.handleUnexpected,N=m.handleChangeCipherSpec,U=m.handleAlert,L=m.handleHandshake,Y=m.handleApplicationData,K=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];ea[m.ConnectionEnd.server]=[[q,U,L,q,K],[q, +U,L,q,K],[q,U,L,q,K],[q,U,L,q,K],[N,U,q,q,K],[q,U,L,q,K],[q,U,L,Y,K],[q,U,L,q,K]];var N=m.handleHelloRequest,U=m.handleCertificate,L=m.handleServerKeyExchange,Y=m.handleCertificateRequest,K=m.handleServerHelloDone,V=m.handleFinished,I=[];I[m.ConnectionEnd.client]=[[q,q,m.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,U,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,L,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,Y,K,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q], +[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[N,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];I[m.ConnectionEnd.server]=[[q,m.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,U,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,m.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q, +q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,V],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];m.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,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(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)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.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:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}): a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.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:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}); return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.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 m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm."); }return h};m.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};m.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};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello= -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1- -d;e=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; +return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.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=m.Versions.TLS_1_1.minor&&l.output.putBytes(k);l.update(b.fragment);l.finish(g)&&(b.fragment=l.output,b.length=b.fragment.length(),e=!0);return e}function g(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=g?(b.fragment=e.output.getBytes(A-g),v=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length= +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;A=a.hmac.create();A.start("SHA1",e);A.update(v);v=A.digest().getBytes();A.start(null,null);A.update(g);g=A.digest().getBytes();return v===g&&d}var m=a.tls;m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16; a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.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=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length= -20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.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 l=0;l=c&&eb.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(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;db.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(),l;for(l in c)c[l].start().update(h);l=new Date;for(d=0;da){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 g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5>8&248)+","+(r>>3&252)+","+ -((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1r){k=4;B=15;if(2==h.bpp){for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}else{for(e=0;e=r&&(k=2,B=3);for(;u>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((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 p(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 q(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 e(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 C(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 w(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 D(a){return 127>8&248)+","+(r>>3&252)+","+ +((r&31)<<3))+")"),a=B(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,l);else if(1r){l=4;C=15;if(2==h.bpp){for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}else{for(e=0;e=r&&(l=2,C=3);for(;q>e&C],q++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;q>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=E((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 p(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 v(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 e(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 B(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 w(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 E(a){return 127=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.decimationMode=0;h.graymode=!1;h.lowcolor=!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&&0h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLengthr){if(1>e||64q|| -64h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength< -16+w)break;r=16;if(5h.acc.byteLength)return;h.state=100+k.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLengthc.byteLength)e=0;else if(b=k.getUint32(4)+8,c.byteLengthr){if(1>e||64v|| +64h.acc.byteLength)break;w=k.getUint32(12);if(h.acc.byteLength< +16+w)break;r=16;if(5a;)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,C(0,0),w(0,0));h.width=h.canvas.canvas.width; +-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,B(0,0),w(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 r={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){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){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAliveh.state)return!0;var c=h.canvas.canvas.height/ -Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="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){1b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b, -4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&& -delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY- -g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result); -0==n.length?v=!1:g.readAsArrayBuffer(n.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==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;el.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;uE[0]-1;n--)for(u=0;u=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1== -u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;Je&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;uE[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height- -1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;uE[0]+ -p;n--)for(u=0;uE[0];n--)for(u=0;u=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27, -79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27, -91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.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(111a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which); -a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"
    ")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=y[b][h],d){case "&":a+="&"; -break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c");800'+c+b+a+"";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height): -l.Init();return l},ZLIB=ZLIB||{}; +h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var O=!1,C=!1;h.GrabMouseInput=function(){if(1!=O){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;O=!0}};h.UnGrabMouseInput=function(){if(0!=O){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;O=!1}};h.GrabKeyInput=function(){1!=C&&(document.onkeyup= +h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,C=!0)};h.UnGrabKeyInput=function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return l(0,a)};h.handleKeyDown=function(a){return l(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b= +0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){var c=h.buttonmask;h.buttonmask|=1<<(0h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight, +d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=v(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);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,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var u="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){1b.length)){var c=null,n=0,e=0,B=ReadShort(b,0),w=ReadShort(b,2),E=0;if(27==B&&8==w){if(12>b.length)return;B=ReadShort(b,8);w=ReadInt(b,4);if(w+8>b.length){a.accumulator=b;return}b= +b.substring(8);E=8}w!=b.length&&0b.length)a.accumulator=b;else{if(3==B||4==B||7==B)c=b.substring(4,w),n=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0u.length&&(b=0);g=u[b];d&&(a.CanvasId.style.cursor=g)}return w+E}}};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 n={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:n[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,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&delete a.TouchArray[g];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,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-g[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 n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var u="",u=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,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(u),a.Alternate=1):a.Alternate=0:a.send(u)}}};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,g=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:g});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(!(1b;)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 g=new FileReader,u=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);0==n.length?u=!1:g.readAsArrayBuffer(n.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==u)n.push(a.data);else if(g.readAsBinaryString)u=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)u=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;ek.width&&(E=k.width);m>k.height-1&&(m=k.height-1);switch(b){case "\b":0D[1]&&(k.recordLineTobackBuffer(0),n(1),m=D[1]); +k.lineFeed="\r";E=0;break;case "\r":E=0;break;default:E>=k.width&&(E=0,w&&m++,m>=k.height-1&&(n(1),m=k.height-1)),d(b),E++}}}function d(a){A[m][E]=a;z[m][E]=(e<<6)+(B<<12)+v}function g(){for(var a=(e<<6)+(B<<12)+v,b=E;b":G=!1;r=0;break;case "7":l=E;h=m;r=0;break;case "8":E=l;m=h;r=0;break;case "M":for(n=D[1];n>=D[0]+1;n--)for(var q=0;qD[0]-1;n--)for(q=0;q=p){O[C]=O[C]?10*O[C]+(p-0):p-0;break}else if(";"==p){C++;break}else if("?"==p){x=1;break}else{O[0]||(O[0]=0);var n=O,q=C+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(y=!1);break;case "h":25==n[0]&&(y=!0)}else if(0==R){var I=void 0;switch(p){case "c":k.TermResetScreen();break;case "A":1==q&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==q&&(0==n[0]?m++:m+=n[0],m>k.height&&(m=k.height));break;case "C":1==q&&(0== +n[0]?E++:E+=n[0],E>k.width&&(E=k.width));break;case "D":1==q&&(0==n[0]?E--:E-=n[0],0>E&&(E=0));break;case "d":1==q&&(m=n[0]-1,m>k.height&&(m=k.height),0>m&&(m=0));break;case "G":1==q&&(E=n[0]-1,0>E&&(E=0),E>k.width-1&&(E=k.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(I=E;I=m+I;n--)A[n]=A[n-I],z[n]=z[n-I];for(n=m;nn[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>k.height&&(n[0]=k.height),n[1]>k.width&&(n[1]=k.width),m=n[0]-1,E=n[1]-1):E=m=0;break;case "m":for(I=0;Ie&&(e+=8):2==n[I]||22==n[I]?8<=e&&(e-=8):7==n[I]?v=2:27==n[I]?v=0:30<=n[I]&& +37>=n[I]?(p=8<=e,e=n[I]-30,p&&8>=e&&(e+=8)):40<=n[I]&&47>=n[I]?B=n[I]-40:90<=n[I]&&99>=n[I]?e=n[I]-82:100<=n[I]&&109>=n[I]&&(B=n[I]-92):(B=0,e=7,v=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(e<<6)+(B<<12)+v,q=0;qD[0]&&(D[0]=0);D[0]>k.height-1&&(D[0]=k.height-1);0>D[1]&&(D[1]=0);D[1]>k.height-1&&(D[1]=k.height-1);D[0]>D[1]&&(D[0]= +D[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=D[0];n<=D[1]-p;n++)for(q=0;qD[0]+p;n--)for(q=0;qD[0];n--)for(q=0;q=k.width&&(I=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)C++;else if(7==n){n=O;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1=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==G){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(111a.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];J.push(a+b+"
    ")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c=""+c,e=d),d=A[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");800'+c+b+a+"";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,g=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,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;qv&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(q=0;qU?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<>>x)+C]=G;while(0!=C);for(A=1<>>=1; -0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<=A)break;n++;A<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check, -[b&255,b>>>8&255],0,2)}function n(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 l(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 p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],r=[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],K=[16,16,16, +(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,k=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,u,v,w,x,z,B,E,C,W,H,F,S,Z,ca,fa,ga,T,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(u=0;uv&&(w=v);if(0==v)return F={op:64,bits:1,val:0},m[c++]=F,m[c++]=F,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0p;p++)x[p+1]=x[p]+M[p];for(u=0;uT?(F.op=fa[ga+e[u]],F.val=Z[ca+e[u]]):F.op=96;z=1<>>x)+C]=F;while(0!=C);for(z=1<>>=1; +0!=z?(E&=z-1,E+=z):E=0;u++;if(0==--M[p]){if(p==v)break;p=g[k+e[u]]}if(p>w&&(E&H)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<=z)break;n++;z<<=1}B+=1<a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function u(a,b){a.state.check=a.checksum_function(a.state.check, +[b&255,b>>>8&255],0,2)}function n(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 p(a){a.hold=0;a.bits=0}function v(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<>>=b;a.bits-=b}function E(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var l=[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],r=[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],O=[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||15b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,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<>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, -[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len- -d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),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){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}, +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>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(B(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);q=B(g,4)+8;if(0==d.wbits)d.wbits=q;else if(q>d.wbits){a.msg="invalid window size";d.mode= +29;break}d.dmax=1<>>8&1);d.flags&512&&u(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check, +[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&u(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&u(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(q=d.head.extra_len- +d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(q+r>d.head.extra_max?d.head.extra_max-q:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{q=a.input_data.charAt(g.next+r);r++;if("\x00"===q)break;null!==d.head&&d.length>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return k(g),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){E(g);d.mode=26;break}if(!e(g,3))break a;d.last=B(g,1);w(g,1);switch(B(g,2)){case 0:d.mode=13;break;case 1:r=d;q=void 0;C||(C=[{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}, @@ -919,43 +917,43 @@ val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bi 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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5; -d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= -r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; -case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= -"invalid bit length repeat";d.mode=29;break}for(;r--;)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(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=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<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0, -ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&& -u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);ML-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2>>3;F-=X;G-=X<<3;I&=(1<>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; -d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; -d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0== -d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; -d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+rq;q++)r.codes[q]=C[q];for(q=0;32>q;q++)r.codes[q+512]=x[q];r.lenbits=9;r.distbits=5; +d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:E(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-= +r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=B(g,5)+257;w(g,5);d.ndist=B(g,5)+1;w(g,5);d.ncode=B(g,4)+4;w(g,4);if(286d.have;)d.lens[z[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(O=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18; +case 18:for(;d.haver.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}q=d.lens[d.have-1];r=3+B(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);q=0;r=3+B(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);q=0;r=11+B(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg= +"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=q}}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(O=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(O=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<=g.have&&258<=g.left){k(g);r=a;var L=N=q=void 0,Y=void 0,K=void 0, +ea=void 0,V=void 0,I=void 0,aa=void 0,ba=void 0,W=void 0,H=void 0,F=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,T=void 0,M=void 0,X=void 0,ha=void 0,da=-1,T=-1,q=r.state,N=r.input_data,L=r.next_in,Y=L+r.avail_in-5,K=r.next_out,ea=K-(l-r.avail_out),V=K+(r.avail_out-257),I=q.wsize,aa=q.whave,ba=q.wnext,W=q.window,H=q.hold,F=q.bits,S=q.codes,Z=q.lencode,ca=q.distcode,fa=(1<F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(0==M)r.output_data+=String.fromCharCode(T.val),K++;else if(M&16){X=T.val;if(M&=15)F>>=M,F-=M;15>F&&(H+=(N.charCodeAt(L++)&255)<>>=M;F-=M;M=T.op;if(M&16){ha=T.val;M&=15;F>>=M;F-=M;M=K-ea;if(ha>M){M=ha-M;if(M>aa&& +q.sane){r.msg="invalid distance too far back";q.mode=29;break b}da=0;T=-1;da=0==ba?da+(I-M):da+(ba-M);MK-T&&(M=K-T);r.output_data+=r.output_data.substring(T,T+M);K+=M;X-=M;T+=M;for(K+=X;2>>3;L-=X;F-=X<<3;H&=(1<>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a; +d.length+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+B(g,d.distbits)];if(r.bits<=g.bits)break;if(!v(g))break a}if(0==(r.op&240)){for(q=r;;){r=d.codes[d.distcode+q.val+(B(g,q.bits+q.op)>>>q.bits)];if(q.bits+r.bits<=g.bits)break;if(!v(g))break a}w(g,q.bits);d.back+=q.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a; +d.offset+=B(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=l-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,q=d.wsize-r):q=d.wnext-r;N=-1;r>d.length&&(r=d.length)}else q=-1,N=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=q)a.output_data+=d.window.substring(q,q+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(N++);while(--r)}0== +d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;l-=g.left;a.total_out+=l;d.total+=l;l&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-l,l));l=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check"; +d.mode=29;break}p(g)}d.mode=28;case 28:O=ZLIB.Z_STREAM_END;break a;case 29:O=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(g);if(d.wsize||l!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& -255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), -a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= -a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= -65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); -(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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, +(function(){function b(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)& +255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;u--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,u){var n,k;n=a>>>16&65535;a&=65535;if(1==u)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521), +a|n<<16;if(null===b)return 1;if(16>u){for(;u--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=u;){u-=5552;k=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--k);a%=65521;n%=65521}if(u){for(;16<=u;)u-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+= +a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;u--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,u){return"string"===typeof d?b(a,d,g,u):c(a,d,g,u)};ZLIB.adler32_combine=function(a,b,c){var u,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;u=n*c%65521;c+=(b&65535)+65521-1;u+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-= +65521);131042<=u&&(u-=131042);65521<=u&&(u-=65521);return c|u<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js"); +(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var u;for(u=0;32>u;u++)a[u]=b(c,c[u])}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,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b= -a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])& -255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})(); -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),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; -b.chrome?c():setTimeout(c,500)},q=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(g){n(g)}}},e=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},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= -new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w= -(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend= -function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, -b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); +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,u,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b= +a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,b=a[(b^c.charCodeAt(u++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(u++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])& +255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,b=a[(b^c[u++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[u++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,u){var n,k,p,v;if(0>=u)return a;p=Array(32);v=Array(32);v[0]=3988292384;for(n=k=1;32>n;n++)v[n]=k,k<<=1;c(p,v);c(v,p);do{c(p,v);u&1&&(a=b(p,a));u>>=1;if(0==u)break;c(v,p);u&1&&(a=b(v,a));u>>=1}while(0!=u);return a^g}})(); +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),g=b.webkitRequestFileSystem,u=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()}; +b.chrome?c():setTimeout(c,500)},v=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(g){n(g)}}},e=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},B=function(n,m,l){l||(n=e(n));var h=this;l=n.type;var r=!1,w,B,x=function(){v(h,["writestart","progress","write","writeend"])},z=function(){if(B&&d&&"undefined"!==typeof FileReader){var a= +new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},A=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},R={create:!0,exclusive:!1},y;h.readyState=h.INIT;m||(m="download");if(a)w= +(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&l&&"application/octet-stream"!==l&&(y=n.slice||n.webkitSlice,n=y.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===l||g)B=b;u?(k+=n.size,u(b.TEMPORARY,k,A(function(a){a.root.getDirectory("saved",R,A(function(a){var b=function(){a.getFile(m,R,A(function(a){a.createWriter(A(function(b){b.onwriteend= +function(b){B.location.href=a.toURL();h.readyState=h.DONE;v(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&z()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),z)}),z)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():z()}))}),z)}),z)):z()}},w=B.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, +b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;v(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new B(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.9.3",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_Battery 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="
    Loading ...
    ",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},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 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), @@ -971,7 +969,7 @@ function setAuthCallback(b){meshcentral2credCallback=b}function setUrlVar(b,c){u function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).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(48).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(48).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,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= +function connect(b,c,a,d,g,u,n){go(0);fullscreenonly=!1;connectFunc=u;connectFuncTag=n;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,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull= 0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,""); QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive= !1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)} @@ -990,39 +988,39 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic function syncClock(){xxdialogMode||setDialogMode(11,"\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u044b",3,syncClockEx,"\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u044b Intel AMT \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c?")} function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u0441\u0442\u0430\u0442\u0443\u0441 ="+d):0!=a.Body.ReturnValue?messagebox("","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u043e\u0448\u0438\u0431\u043a\u0430: "+ a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}var DMTFPowerStates=";;\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c;\u041b\u0435\u0433\u043a\u0438\u0439 \u0441\u043e\u043d;\u0413\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0441\u043e\u043d;\u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f;\u0412\u044b\u043a\u043b - \u0416\u0435\u0441\u0442\u043a\u0438\u0439;Hibernate (Off soft);Soft off;\u0426\u0438\u043a\u043b \u043f\u0438\u0442\u0430\u043d\u0438\u044f (Off-Hard);\u0421\u0431\u0440\u043e\u0441 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0448\u0438\u043d\u044b;\u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 (NMI);\u041d\u0435\u043f\u0440\u0438\u0433\u043e\u0434\u043d\u044b\u0439;Off - \u043c\u044f\u0433\u043a\u0430\u044f \u0438\u0437\u044f\u0449\u043d\u0430\u044f;Off - \u0416\u0435\u0441\u0442\u043a\u0438\u0439 \u0438\u0437\u044f\u0449\u043d\u044b\u0439;\u041c\u0430\u0441\u0442\u0435\u0440 \u0430\u0432\u0442\u043e\u0431\u0443\u0441 \u0441\u0431\u0440\u043e\u0441\u0438\u043b \u0438\u0437\u044f\u0449\u043d\u044b\u0439;\u0421\u0438\u043b\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b (\u0412\u044b\u043a\u043b. - \u041c\u044f\u0433\u043a\u0438\u0439 \u0438\u0437\u044f\u0449\u043d\u044b\u0439);\u0421\u0438\u043b\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b (\u0412\u044b\u043a\u043b. - \u0416\u0435\u0441\u0442\u043a\u0438\u0439 \u0438\u0437\u044f\u0449\u043d\u044b\u0439);\u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 (INIT)".split(";"); -function updateSystemStatus(){if(amtsysstate&&!(99\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0\u041d\u0438\u043a\u0442\u043e":EscapeHtml(c);d+=TableEntry("\u0418\u043c\u044f \u0438 \u0434\u043e\u043c\u0435\u043d",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+=TableEntry("\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b", -guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5n.DefaultScreen&&(g=["\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439","\u0412\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439","3-\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439"][n.DefaultScreen]),g=''+g+"",1==n.Is5900PortEnabled&&(g+="\u041f\u043e\u0440\u0442 5900 \u0432\u043a\u043b\u044e\u0447\u0435\u043d"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0
    "); QH(15,d);d=""+TableEnd("
     "+AddRefreshButton("PullSystemStatus(1)")+" \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u0435\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439."); -d=d+"

    \u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438

    "+TableStart();g="";"\u041d\u0438\u043a\u0442\u043e"!=c&&(1==v.SharedFQDN&&(g=", \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u0441 \u041e\u0421"),0==v.SharedFQDN&&(g="\u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u041e\u0421"));d+=TableEntry("\u0418\u043c\u044f \u0438 \u0434\u043e\u043c\u0435\u043d",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName)); -c="\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e";1==v.DDNSUpdateEnabled?c="\u0412\u043a\u043b\u044e\u0447\u0435\u043d \u043a\u0430\u0436\u0434\u044b\u0439"+v.DDNSPeriodicUpdateInterval+" \u043c\u0438\u043d\u0443\u0442, TTL"+v.DDNSTTL+" \u043c\u0438\u043d\u0443\u0442":1==v.DDNSUpdateByDHCPServerEnabled&&(c="\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c");d+=TableEntry("\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 DNS", +d=d+"

    \u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438

    "+TableStart();g="";"\u041d\u0438\u043a\u0442\u043e"!=c&&(1==u.SharedFQDN&&(g=", \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u0441 \u041e\u0421"),0==u.SharedFQDN&&(g="\u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u041e\u0421"));d+=TableEntry("\u0418\u043c\u044f \u0438 \u0434\u043e\u043c\u0435\u043d",addLinkConditional(c+g,"showEditNameDlg(1)",xxAccountAdminName)); +c="\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e";1==u.DDNSUpdateEnabled?c="\u0412\u043a\u043b\u044e\u0447\u0435\u043d \u043a\u0430\u0436\u0434\u044b\u0439"+u.DDNSPeriodicUpdateInterval+" \u043c\u0438\u043d\u0443\u0442, TTL"+u.DDNSTTL+" \u043c\u0438\u043d\u0443\u0442":1==u.DDNSUpdateByDHCPServerEnabled&&(c="\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c");d+=TableEntry("\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 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+="

    "+(amtwirelessif==a?"\u0411\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441":"\u041f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441")+ -"

    ";d+=TableStart();d+=TableEntry("\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438",1==c.LinkIsUp?"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432\u0432\u0435\u0440\u0445":"\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"), -224==c.LinkPolicy[C]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a",addLinkConditional(0==g.length?"\u041d\u0435\u0442 \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438":"\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC-\u0430\u0434\u0440\u0435\u0441",c.MACAddress));amtwirelessif== +"";d+=TableStart();d+=TableEntry("\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438",1==c.LinkIsUp?"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432\u0432\u0435\u0440\u0445":"\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(B in c.LinkPolicy)1==c.LinkPolicy[B]&&g.push("S0 / AC"),14==c.LinkPolicy[B]&&g.push("Sx / AC"),16==c.LinkPolicy[B]&&g.push("S0 / DC"), +224==c.LinkPolicy[B]&&g.push("Sx / DC");0==g.length&&g.push("");d+=TableEntry("\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a",addLinkConditional(0==g.length?"\u041d\u0435\u0442 \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438":"\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC-\u0430\u0434\u0440\u0435\u0441",c.MACAddress));amtwirelessif== a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("\u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("\u0420\u0430\u0434\u0438\u043e \u0413\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u043e",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+ ", SSID: "+(s?s:"\u041d\u0438\u043a\u0442\u043e")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?"\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e":"\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e", "showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e":"\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e", -"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("\u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043f\u0438\u043d\u0433",addLinkConditional(["\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e","ICMP-\u043e\u0442\u0432\u0435\u0442","\u041e\u0442\u0432\u0435\u0442 RMCP","ICMP \u0438 RMCP \u043e\u0442\u0432\u0435\u0442"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()", +"showUefiWifiCoExDlg()",xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("\u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043f\u0438\u043d\u0433",addLinkConditional(["\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e","ICMP-\u043e\u0442\u0432\u0435\u0442","\u041e\u0442\u0432\u0435\u0442 RMCP","ICMP \u0438 RMCP \u043e\u0442\u0432\u0435\u0442"][u.PingResponseEnabled+(u.RmcpPingResponseEnabled<<1)],"showPingActionDlg()", xxAccountAdminName)),g=1==c.DHCPEnabled?"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430":"\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP-\u0430\u0434\u0440\u0435\u0441",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 IPv4",addLinkConditional(g, "showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("\u0410\u0434\u0440\u0435\u0441 IPv4",isIpAddress(c.IPAddress,"\u041d\u0438\u043a\u0442\u043e"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("\u0428\u043b\u044e\u0437 / \u043c\u0430\u0441\u043a\u0430 IPv4",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"\u041d\u0438\u043a\u0442\u043e")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("\u0421\u0435\u0440\u0432\u0435\u0440 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u043d IPv4", -g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5Available in S0/AC - Powered on & plugged in
    ");a+="
    ";a+="
    @@ -256,10 +242,8 @@
    - -
    @@ -347,7 +331,6 @@ - '; } } - response += '

      EventTime\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&& -(v=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0== +function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g=" - - - - - - - -

      EventTime\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435";for(a in c){d++;var u=1,n=c[a];8<=n.EventSeverity&&(u=2);16<=n.EventSeverity&& +(u=3);g+="

    "+(parseInt(a)+1)+'
    '+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
    "+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"
    "+n.EntityStr.replace("(r)","®")+""+n.Desc}g+=TableEnd(0== d?" ":"");QH(18,g+"
    ");processMessageLog0()}function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})} function ClearLog(b){xxdialogMode||(QH(60,"\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439?"),setDialogMode(1,"\u0416\u0443\u0440\u043d\u0430\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439",3,ClearLogEx))} function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("\u0416\u0443\u0440\u043d\u0430\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439","\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c, \u043e\u0448\u0438\u0431\u043a\u0430: "+d):PullEventLog()})} @@ -1081,8 +1079,8 @@ TableStart(),c+=TableEntry("\u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u04 2==a[0].OverwritePolicy?"\u0417\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u043d\u044b\u0439":"\u041d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442"),c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))} function processAuditLog1(b,c){auditLog=c;var a,d;d=""+(TableEnd('
     
    '+AddRefreshButton("PullAuditLog(1)")+AddButton("\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c...","SaveAuditLog()")+AddButton("\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b", "ClearAuditLog()"))+"
    ");if(0==c.length)d="\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.";else{var g=0;d+="
    @@ -221,8 +208,6 @@ - - @@ -326,7 +311,6 @@ var loginMode = '{{{loginmode}}}'; var newAccount = '{{{newAccount}}}'; var newAccountPass = parseInt('{{{newAccountPass}}}'); - var newAccountCaptcha = '{{{newAccountCaptcha}}}'; var emailCheck = '{{{emailcheck}}}'; var passRequirements = '{{{passRequirements}}}'; var hardwareKeyChallenge = decodeURIComponent('{{{hkey}}}'); @@ -339,10 +323,8 @@ var webPageFullScreen = true; var nightMode = (getstore('_nightMode', '0') == '1'); var publicKeyCredentialRequestOptions = null; - var otpduo = (decodeURIComponent('{{{otpduo}}}') === 'true'); var otpemail = (decodeURIComponent('{{{otpemail}}}') === 'true'); var otpsms = (decodeURIComponent('{{{otpsms}}}') === 'true'); - var otpmsg = (decodeURIComponent('{{{otpmsg}}}') === 'true'); var autofido = (decodeURIComponent('{{{autofido}}}') === 'true'); var twoFactorCookieDays = parseInt('{{{twoFactorCookieDays}}}'); var authStrategies = '{{{authStrategies}}}'.split(','); @@ -352,8 +334,8 @@ // Display the right server message var i; var messageid = parseInt('{{{messageid}}}'); - var okmessages = ['', "If valid, reset mail sent.", "Email sent.", "Email verification required, check your mailbox and click the confirmation link.", "SMS sent.", "Sending notification...", "Message sent."]; - var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later.", "Server under maintenance.", "Unable to send device notification.", "Invalid security check."]; + var okmessages = ['', "If valid, reset mail sent.", "Email sent.", "Email verification required, check your mailbox and click the confirmation link.", "SMS sent."]; + var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later.", "Server under maintenance."]; if (messageid > 0) { var msg = ''; if ((messageid < 100) && (messageid < okmessages.length)) { msg = okmessages[messageid]; } @@ -364,19 +346,6 @@ } } - // Display flash error Messages - var flashErrors = JSON.parse('{{{flashErrors}}}'); - if (flashErrors && (flashErrors.length > 0)) { - var msg = ''; - for (i = 0; i < flashErrors.length; i++) { - if (flashErrors[i]) { - msg += '' + flashErrors[i] + '

    '; - } - } - QH('message1', msg); - QV('message1', true); - } - // Fix links if a loginKey if used var urlargs = parseUriArgs(); if (urlargs.key) { @@ -439,10 +408,9 @@ if (authStrategies.indexOf('twitter') >= 0) { QV('auth-twitter', true); } if (authStrategies.indexOf('google') >= 0) { QV('auth-google', true); } if (authStrategies.indexOf('github') >= 0) { QV('auth-github', true); } + if (authStrategies.indexOf('reddit') >= 0) { QV('auth-reddit', true); } if (authStrategies.indexOf('azure') >= 0) { QV('auth-azure', true); } if (authStrategies.indexOf('oidc') >= 0) { QV('auth-oidc', true); } - if (authStrategies.indexOf('oidc-azure') >= 0) { QV('auth-oidc-azure', true); } - if (authStrategies.indexOf('oidc-google') >= 0) { QV('auth-oidc-google', true); } if (authStrategies.indexOf('jumpcloud') >= 0) { QV('auth-jumpcloud', true); } if (authStrategies.indexOf('intel') >= 0) { QV('auth-intel', true); } if (authStrategies.indexOf('saml') >= 0) { QV('auth-saml', true); } @@ -459,13 +427,12 @@ window.onresize = center; center(); + validateLogin(); validateCreate(); if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); } QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link. if ((passhint != null) && (passhint.length > 0)) { QV('showPassHintLink', true); } QV('newAccountPass', (newAccountPass == 1)); - QV('newAccountCaptcha', (newAccountCaptcha != '')); - QV('newAccountCaptchaImg', (newAccountCaptcha != '')); QV('resetAccountDiv', (emailCheck == 'true')); QV('hrAccountDiv', (emailCheck == 'true') || (newAccountPass == 1)); @@ -474,10 +441,8 @@ try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null } var twofakey = (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn'); QV('securityKeyButton', twofakey); - QV('emailKeyButton', otpemail && (messageid != 2) && (messageid != 4) && (messageid != 6)); - QV('smsKeyButton', otpsms && (messageid != 2) && (messageid != 4) && (messageid != 6)); - QV('msgKeyButton', otpmsg && (messageid != 2) && (messageid != 4) && (messageid != 6)); - QV('duoKeyButton', otpduo && (messageid != 2) && (messageid != 4) && (messageid != 6)); + QV('emailKeyButton', otpemail && (messageid != 2) && (messageid != 4)); + QV('smsKeyButton', otpsms && (messageid != 2) && (messageid != 4)); // If hardware key is an option, trigger it now if (autofido && twofakey) { setTimeout(function () { useSecurityKey(1); }, 300); } @@ -488,10 +453,8 @@ try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null } var twofakey = (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn'); QV('securityKeyButton2', twofakey); - QV('emailKeyButton2', otpemail && (messageid != 2) && (messageid != 4) && (messageid != 6)); - QV('smsKeyButton2', otpsms && (messageid != 2) && (messageid != 4) && (messageid != 6)); - QV('msgKeyButton2', otpmsg && (messageid != 2) && (messageid != 4) && (messageid != 6)); - QV('duoKeyButton2', otpduo && (messageid != 2) && (messageid != 4) && (messageid != 6)); + QV('emailKeyButton2', otpemail && (messageid != 2) && (messageid != 4)); + QV('smsKeyButton2', otpsms && (messageid != 2) && (messageid != 4)); // If hardware key is an option, trigger it now if (autofido && twofakey) { setTimeout(function () { useSecurityKey(2); }, 300); } @@ -605,35 +568,6 @@ } } - function useMsgToken(panelAction) { - if (otpmsg != true) return; - setDialogMode(1, "Secure Login", 3, useMsgTokenEx, "Send token to messaging application?", panelAction); - } - - function useMsgTokenEx(b, panelAction) { - if (panelAction == 1) { - Q('hwtokenInput').value = '**msg**'; - QE('tokenOkButton', true); - Q('tokenOkButton').click(); - } else if (panelAction == 2) { - Q('resetHwtokenInput').value = '**msg**'; - QE('resetTokenOkButton', true); - Q('resetTokenOkButton').click(); - } - } - - function useDuoToken(panelAction) { - if (panelAction == 1) { - Q('hwtokenInput').value = '**duo**'; - QE('tokenOkButton', true); - Q('tokenOkButton').click(); - } else if (panelAction == 2) { - Q('resetHwtokenInput').value = '**duo**'; - QE('resetTokenOkButton', true); - Q('resetTokenOkButton').click(); - } - } - function showPassHint(e) { messagebox("Password Hint", passhint); haltEvent(e); @@ -678,11 +612,11 @@ } function validateLogin(box, e) { - setTimeout(function(){ - setDialogMode(0); - if ((e != null) && (e.keyCode == 13)) { if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); } else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); } } - if (e != null) { haltEvent(e); } - }, 100); + var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0)); + QE('loginButton', ok); + setDialogMode(0); + if ((e != null) && (e.keyCode == 13)) { if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); } else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); } } + if (e != null) { haltEvent(e); } } function validateCreate(box, e) { @@ -693,7 +627,6 @@ var pass1ok = (Q('apassword1').value.length > 0); var pass2ok = (Q('apassword2').value.length > 0) && (Q('apassword2').value == Q('apassword1').value); var newAccOk = (newAccountPass == 0) || (Q('anewaccountpass').value.length > 0); - var newCaptchaOk = (newAccountCaptcha == '') || (Q('anewaccountcaptcha').value.length > 0); var ok = (userok && emailok && pass1ok && pass2ok && newAccOk); // Color the fields @@ -702,7 +635,6 @@ QS('nuPass1').color = pass1ok ? 'black' : '#7b241c'; QS('nuPass2').color = pass2ok ? 'black' : '#7b241c'; QS('nuToken').color = newAccOk ? 'black' : '#7b241c'; - QS('nuCaptcha').color = newCaptchaOk ? 'black' : '#7b241c'; if (Q('apassword1').value == '') { QH('passWarning', ''); @@ -731,13 +663,13 @@ } } if ((e != null) && (e.keyCode == 13)) { + if ((box == 1) && userok) { Q('aemail').focus(); } if ((box == 2) && emailok) { Q('apassword1').focus(); } if ((box == 3) && pass1ok) { Q('apassword2').focus(); } if ((box == 4) && pass2ok) { if (passRequirements.hint === true) { Q('apasswordhint').focus(); } else { box = 5; } } if (box == 5) { if (newAccountPass == 1) { Q('anewaccountpass').focus(); } else { box = 6; } } - if (box == 6) { if (newAccountCaptcha != '') { Q('anewaccountcaptcha').focus(); } else { box = 7; } } - if (box == 7) { Q('createButton').click(); } + if (box == 6) { Q('createButton').click(); } } if (e != null) { haltEvent(e); } QE('createButton', ok); @@ -985,4 +917,4 @@ - + \ No newline at end of file diff --git a/views/login2.handlebars b/views/login2.handlebars index 10537565..de42ce39 100644 --- a/views/login2.handlebars +++ b/views/login2.handlebars @@ -7,7 +7,6 @@ - @@ -69,12 +68,12 @@

      \u0412\u0440\u0435\u043c\u044f\u0438\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440Action"; -for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0  '+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+v.Time.toLocaleTimeString("en",{hour:"2-digit", -minute:"2-digit",second:"2-digit"})+"
    "+l+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","\u0416\u0443\u0440\u043d\u0430\u043b \u0430\u0443\u0434\u0438\u0442\u0430 Intel AMT",auditLog)} +for(a in c){var u=c[a],n=u.AuditApp,k=u.Initiator;g++;var p="";0
      '+u.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"
      "+u.Time.toLocaleTimeString("en",{hour:"2-digit", +minute:"2-digit",second:"2-digit"})+"
    "+k+p+""+n}d+=TableEnd(0==g?" ":"")+"
    "}QH(50,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","\u0416\u0443\u0440\u043d\u0430\u043b \u0430\u0443\u0434\u0438\u0442\u0430 Intel AMT",auditLog)} function ClearAuditLog(b){QH(60,"\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b \u0430\u0443\u0434\u0438\u0442\u0430?");setDialogMode(1,"\u0410\u0443\u0434\u0438\u0442 \u0416\u0443\u0440\u043d\u0430\u043b",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("\u0410\u0443\u0434\u0438\u0442 \u0416\u0443\u0440\u043d\u0430\u043b","\u041e\u0448\u0438\u0431\u043a\u0430: "+d)} function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="
    "+addHtmlValue("\u0412\u0440\u0435\u043c\u044f",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("\u0438\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("\u0410\u0434\u0440\u0435\u0441",a.NetAddress));d+=addHtmlValue("\u0437\u0430\u044f\u0432\u043a\u0430",a.AuditApp);d+=addHtmlValue("\u0421\u043e\u0431\u044b\u0442\u0438\u0435",a.Event);if(null!= @@ -1120,10 +1118,10 @@ function issueCertButtonOk2(b){0==amtcert_loadP12File(b.target.result,Q("certope 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("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b: "+d):0!=a.Body.ReturnValue?messagebox("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442", "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439,"+a.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,a.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)} -function GenerateKeyPairResponse2(b,c,a,d,g){if(200!=d)messagebox("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b: "+d);else{b=null;for(var v in a)a[v].InstanceID==g&&(b=a[v].DERKey); -a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};g={CN:"\u041d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442"};if(null!=xxCaPrivateKey&&xxCaSubjectAttributes)for(v in g={},xxCaSubjectAttributes)g[xxCaSubjectAttributes[v].shortName]=xxCaSubjectAttributes[v].value;v={name:"extKeyUsage"};Q("d11_cu4").checked&& -(v.serverAuth=!0);Q("d11_cu5").checked&&(v.clientAuth=!0);Q("d11_cu6").checked&&(v.emailProtection=!0);Q("d11_cu7").checked&&(v.codeSigning=!0);Q("d11_cu8").checked&&(v.timeStamping=!0);v=amtcert_signWithCaKey(b,xxCaPrivateKey,a,g,v);null==v?messagebox("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442."): -(v=forge.pki.certificateToPem(v).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(v.substring(27,v.length-25),GenerateKeyPairResponse4))}} +function GenerateKeyPairResponse2(b,c,a,d,g){if(200!=d)messagebox("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b: "+d);else{b=null;for(var u in a)a[u].InstanceID==g&&(b=a[u].DERKey); +a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};g={CN:"\u041d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442"};if(null!=xxCaPrivateKey&&xxCaSubjectAttributes)for(u in g={},xxCaSubjectAttributes)g[xxCaSubjectAttributes[u].shortName]=xxCaSubjectAttributes[u].value;u={name:"extKeyUsage"};Q("d11_cu4").checked&& +(u.serverAuth=!0);Q("d11_cu5").checked&&(u.clientAuth=!0);Q("d11_cu6").checked&&(u.emailProtection=!0);Q("d11_cu7").checked&&(u.codeSigning=!0);Q("d11_cu8").checked&&(u.timeStamping=!0);u=amtcert_signWithCaKey(b,xxCaPrivateKey,a,g,u);null==u?messagebox("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442."): +(u=forge.pki.certificateToPem(u).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(u.substring(27,u.length-25),GenerateKeyPairResponse4))}} function GenerateKeyPairResponse4(b,c,a,d){200!=d?messagebox("\u0412\u044b\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b: "+d):PullCertificates()} function certificateAdded(b,c,a,d){200!=d||0!=a.Body.ReturnValue?messagebox("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043e\u0448\u0438\u0431\u043a\u0430"+(200!=d?d:a.Body.ReturnValueStr)):PullCertificates()} function certificateRemoved(b,c,a,d){200!=d?messagebox("\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442","\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043e\u0448\u0438\u0431\u043a\u0430"+d):PullCertificates()} @@ -1153,7 +1151,7 @@ function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableE xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f");b+=TableEnd()+"
    ";b+=TableStart2();b+="

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u0430 Intel® AMT.

    ";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses|| 0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="
    \u0410\u0433\u0435\u043d\u0442 \u043f\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044e \u0437\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.

    ";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+="
    ";a.transitions&&(b+='");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(v.OldState)+" → "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430")}""!=d&&(b+="
    "+d+"
    ");b+="
    "}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+ +c+")>");b+="
    "+d+", "+amtstack.WatchdogCurrentStates[a.CurrentState]+"
    ";var d="",g;for(g in a.transitions){var u=a.transitions[g];""!=d&&(d+="
    ");d+=getWatchdogTransitionStr(u.OldState)+" → "+getWatchdogTransitionStr(u.NewState);u.actions&&1==u.actions[0].EventOnTransition&&(d+=" : \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430")}""!=d&&(b+="
    "+d+"
    ");b+=""}b=b+"
    "+TableEnd(AddRefreshButton("PullWatchdog()")+ AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 ...","AddWatchdog()"));b+="
    ";QH(54,b)}}function getWatchdogTransitionStr(b){if(31==b)return"\u041b\u044e\u0431\u043e\u0439 \u0448\u0442\u0430\u0442";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("\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0441\u0443\u0431\u044a\u0435\u043a\u0442",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435", amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u043a\u0430",b.StartupInterval+" \u0441\u0435\u043a\u0443\u043d\u0434 (\u044b)");c+=addHtmlValue("\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0442\u0430\u0439\u043c-\u0430\u0443\u0442\u0430", @@ -1182,12 +1180,12 @@ b+=TableEntry((0==c?"\u041f\u0440\u043e\u0432\u043e\u0434\u043d\u0430\u044f":"\u "s":"")),b+="
    "+EscapeHtml(a.PolicyName)+""+d+"
    ";b+="

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b Intel® AMT.

    ";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+= "
    \u0424\u0438\u043b\u044c\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.

    ";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="\u0412\u0441\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b Ethernet"+a.HdrProtocolID8021),d+= ", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" \u0432"+a.FilterProfileData+" \u043f\u0430\u043a\u0435\u0442 / \u0441\u0435\u043a"),1==a.ActionEventOnMatch&&(d+="\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430 \u043c\u0430\u0442\u0447"),b+="
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    ";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a= -xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="\u0412\u0441\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" \u0432"+a.FilterProfileData+" \u043f\u0430\u043a\u0435\u0442 / \u0441\u0435\u043a");1==a.ActionEventOnMatch&&(d+="\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430 \u043c\u0430\u0442\u0447");var v=0;for(g in xxSystemDefenceFilters)a[g]&& -v++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 ...","AddDefenseFilter()")+AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 ...", +xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="\u0412\u0441\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b Ethernet"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" \u0432"+a.FilterProfileData+" \u043f\u0430\u043a\u0435\u0442 / \u0441\u0435\u043a");1==a.ActionEventOnMatch&&(d+="\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430 \u043c\u0430\u0442\u0447");var u=0;for(g in xxSystemDefenceFilters)a[g]&& +u++;0
    "+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+", "+d+"
    "}}b+="
    "+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 ...","AddDefenseFilter()")+AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 ...", "AddDefensePolicy()"));QH(53,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('http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortIntel(r) AMT Ethernet Port '+b+"",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}): (xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()} -function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} +function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var u in a)d=a[u].ReadCount,c=getItem(a[u].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()} function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="
    \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e
    ",b)}} function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortCIM_EthernetPortIntel(r) AMT Ethernet Port '+ @@ -1202,12 +1200,12 @@ b+="
    \u0438\u043c\u044f
    TX / RX \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e
    '; @@ -1249,9 +1247,9 @@ DMTFMemFormFactor=";\u0414\u0440\u0443\u0433\u043e\u0439;\u043d\u0435\u0438\u043 192:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ 2 Solo",193:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ 2 Extreme",194:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ 2 Quad",195:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ 2 Extreme \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u041f\u041a",196:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ 2 Duo \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u041f\u041a", 197:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ 2 Solo \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u041f\u041a",198:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Core ™ i7",199:"\u0414\u0432\u0443\u0445\u044a\u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel® Celeron®"},HardwareInventory; function processHardware(b,c,a,d){if(200==d){var g;b="";HardwareInventory=a;QV("go2",!0);b+=TableEnd("
     "+AddRefreshButton("PullHardware(1)")+AddButton("\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c...","SaveHardwareLog()")+" \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b."); -c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    \u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430

    "+FullTable({"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c":c.Model,"\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c":c.Manufacturer,"\u0412\u0435\u0440\u0441\u0438\u044f":c.Version,"\u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440":c.SerialNumber, +c=a.CIM_Chassis.response;d=a.CIM_Card.response;var u=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"

    \u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430

    "+FullTable({"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c":c.Model,"\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c":c.Manufacturer,"\u0412\u0435\u0440\u0441\u0438\u044f":c.Version,"\u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440":c.SerialNumber, "\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="

    \u043f\u043b\u0438\u043d\u0442\u0443\u0441

    ";b+=FullTable({"\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c":d.Manufacturer,"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u0430":d.Model,"\u0412\u0435\u0440\u0441\u0438\u044f":d.Version, -"\u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440":d.SerialNumber,"\u0422\u0435\u0433 \u0430\u043a\u0442\u0438\u0432\u0430":d.Tag,"\u0421\u043c\u0435\u043d\u043d\u0430\u044f?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({"\u043f\u0440\u043e\u0434\u0430\u0432\u0435\u0446":a.CIM_BIOSElement.response.Manufacturer,"\u0412\u0435\u0440\u0441\u0438\u044f":v,"\u0414\u0430\u0442\u0430 \u0432\u044b\u043f\u0443\u0441\u043a\u0430":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", +"\u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440":d.SerialNumber,"\u0422\u0435\u0433 \u0430\u043a\u0442\u0438\u0432\u0430":d.Tag,"\u0421\u043c\u0435\u043d\u043d\u0430\u044f?":1==d.CanBeFRUed?"Yes":"No"},"");b+="

    BIOS

    ";b+=FullTable({"\u043f\u0440\u043e\u0434\u0430\u0432\u0435\u0446":a.CIM_BIOSElement.response.Manufacturer,"\u0412\u0435\u0440\u0441\u0438\u044f":u,"\u0414\u0430\u0442\u0430 \u0432\u044b\u043f\u0443\u0441\u043a\u0430":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en", {timeZone:"UTC"})},"");b+="
    ";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="

    \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 "+(parseInt(g)+1)+"

    ",b+=FullTable({"\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c":trademarks(d.Manufacturer),"\u0441\u0435\u043c\u044c\u044f":DMTFProcFamilly[c.Family],"\u0412\u0435\u0440\u0441\u0438\u044f":trademarks(d.Version),"\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u043e\u0437\u0435\u0442\u043a\u0438":c.MaxClockSpeed+ " \u041c\u0413\u0446","\u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b":DMTFCPUStatus[c.CPUStatus]},"");b+="
    ";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="

    \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 "+(+g+1)+"

    ",b+=FullTable({"\u0411\u0430\u043d\u043a \u041c\u0435\u0442\u043a\u0430":c.BankLabel,"\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c":c.Manufacturer,"\u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440":c.SerialNumber, "\u0420\u0430\u0437\u043c\u0435\u0440":parseInt(c.Capacity/1048576)+" \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442","\u0424\u0430\u043a\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b":DMTFMemFormFactor[c.FormFactor],"\u0422\u0438\u043f":DMTFMemType[c.MemoryType],"\u0422\u0435\u0433 \u0430\u043a\u0442\u0438\u0432\u0430":c.Tag,"\u041d\u043e\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438":c.PartNumber},"");b+="
    ";for(g in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[g], @@ -1265,22 +1263,22 @@ c)}}function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByT 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 g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}} function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))} -function updateAccounts(){if(!(0
    '; + r += '
    ' + name + '
    ' + devNotify + ''; // Use defaults if needed if (deviceViewSettings == null) { deviceViewSettings = {}; } @@ -4932,51 +4558,19 @@ r += ''; - } - if (hardware.network && hardware.network.dns) { - x += ''; + x += ''; } x += '

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 Intel® AMT \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername? -(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==v&&(n+="\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="\u0430\u0443\u0434\u0438\u0442\u043e\u0440,");n=0<=a.Realms.indexOf(3)?n+"\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440": -1==l?n+"1 \u0446\u0430\u0440\u0441\u0442\u0432\u043e":n+(l+" \u0446\u0430\u0440\u0441\u0442\u0432")}else n+="\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440",a.Handle=-1;b+="
    ";0

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 Intel® AMT \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430.

    ",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,u=0;a.DigestUsername? +(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(u=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==u&&(n+="\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e,");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&k++;0<=a.Realms.indexOf(20)&&(n+="\u0430\u0443\u0434\u0438\u0442\u043e\u0440,");n=0<=a.Realms.indexOf(3)?n+"\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440": +1==k?n+"1 \u0446\u0430\u0440\u0441\u0442\u0432\u043e":n+(k+" \u0446\u0430\u0440\u0441\u0442\u0432")}else n+="\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440",a.Handle=-1;b+="
    ";0'+d+"
    "+n+"
    "}}c='
     "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("\u041d\u043e\u0432\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442","newAccountButton()"));b+="
    "+TableEnd(c+"");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){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,"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442",-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,"\u041d\u043e\u0432\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())} -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430","\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+ -":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)} +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,u=d2password1.value,n=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||u!=d2password2.value){messagebox("\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430","\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b");return}null==n?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+ +":"+u)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,k,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)} function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()} function updateRealms(b){QV(61,null!=b);if(null!=b){var c="

  • ",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="
  • ")}QH(62, c)}}function updateAccountDialog(){var b=!0;if("none"!=Q(61).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",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("\u0438\u043c\u044f",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("\u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439",1==xxAccountEnabledInfo[b].Enabled?"\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e":"\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e"));if(g==xxAccountAdminName)a+= -addHtmlValue("\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435","\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440");else{var a=a+addHtmlValue("\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v="\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440",0<=c.Realms.indexOf(20)&&(v+="\u0410\u0443\u0434\u0438\u0442\u043e\u0440");else for(d in xxAccountRealmInfo[b].Realms)""!= -amtstack.RealmNames[c.Realms[d]]&&(0"+v+""}messagebox("\u0421\u0447\u0435\u0442"+g,a+"")}} +addHtmlValue("\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435","\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440");else{var a=a+addHtmlValue("\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435",xxUserPermissions[c.AccessPermission]),u="";if(0<=c.Realms.indexOf(3))u="\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440",0<=c.Realms.indexOf(20)&&(u+="\u0410\u0443\u0434\u0438\u0442\u043e\u0440");else for(d in xxAccountRealmInfo[b].Realms)""!= +amtstack.RealmNames[c.Realms[d]]&&(0"+u+""}messagebox("\u0421\u0447\u0435\u0442"+g,a+"")}} function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0"+g+"
    ",b=200==c.status?0==c.responses.length?b+"
    (\u041f\u0443\u0441\u0442\u043e)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("
    \u041e\u0448\u0438\u0431\u043a\u0430 #"+c.status+"
    "),b+="

    ";QH(24,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())} @@ -1330,10 +1328,10 @@ function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!= 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"+p24filetreelocation[v]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70'+EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='":(w=q,0"+q+""),w='
     '+e+""+C+"
    "+w+"
    "); -3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v"+p24filetreelocation[u]+"";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(u in n){var k=n[u],p=k.n,v;v=70'+EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=k.d&&(e=new Date(k.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" ");var B="";null!=k.s&&(B=getFileSizeStr(k.s));var w="";3>k.t?w='":(w=v,0"+v+""),w='
     '+e+""+B+"
    "+w+"
    "); +3>k.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),u=0;ub;)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.lnc.d?1*p24sortorder:b.d"+(ider.m.server?"\u0441\u0435\u0440\u0432\u0435\u0440":"")+"\u0421\u0435\u0441\u0441\u0438\u044f IDE-R , \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e,"+ider.m.bytesFromAmt+" \u0432,"+ider.m.bytesToAmt+" \u0432\u043d\u0435.")}var heatMapWidth=600,heatMapDividor={}; -function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0 CDROM , \u0431\u043b\u043e\u043a\u0438 - {0} \u0431\u0430\u0439\u0442\u043e\u0432.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" \u0424\u043b\u043e\u043f\u043f\u0438-\u0434\u0438\u0441\u043a , \u0431\u043b\u043e\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 {0}.", -512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height=6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b CDROM , \u0431\u043b\u043e\u043a\u0438 - {0} \u0431\u0430\u0439\u0442\u043e\u0432.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format(" \u0424\u043b\u043e\u043f\u043f\u0438-\u0434\u0438\u0441\u043a , \u0431\u043b\u043e\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 {0}.", +512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)u.height=6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;bv&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("\u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0432\u044f\u0437\u044c",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Intel® AMT.

    "; +if(0u&&(u="0"+u),c+=", at "+g+":"+u+" daily")}b+=TableEntry("\u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0432\u044f\u0437\u044c",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"
    "+TableStart2();b+="

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Intel® AMT.

    "; if(0==xxCiraServers.length)b+="

    \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.

    ";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="
    "+xxCiraServers[d].AccessInfo+""+EscapeHtml(c)+"
    ";if(a)if(b+= "
    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 HTTP \u043f\u0440\u043e\u043a\u0441\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438.

    ",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="

    \u041d\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043f\u0440\u043e\u043a\u0441\u0438.

    "; else for(d in c)b+="
    "+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+" / "+EscapeHtml(c[d].NetworkDnsSuffix)+"
    ";d="";xxAccountAdminName&&(d=AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440...","AddRemoteAccessServer()"),a&&(d+=AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 ...","AddRemoteAccessProxy()")));b+="
    "+ @@ -1400,9 +1398,9 @@ g+">
    ");setDialogMode(11,format("{0} \u0441\u043e\ function editMpsPolicyUpdate(){var b=11=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||23a||59http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server2").value].Name+"");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),v&&(0==Q("d2server2cira").value?d.push(v):n.push(v))):g&&(d.push(g),v&&d.push(v));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp; +function editMpsPolicyOk2(b,c,a,d){b=11http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server2").value].Name+"");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),u&&(0==Q("d2server2cira").value?d.push(u):n.push(u))):g&&(d.push(g),u&&d.push(u));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp; function editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u043e 5 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u0432 \u0434\u043e\u043c\u0435\u043d\u0430 \u0438\u043d\u0442\u0440\u0430\u0441\u0435\u0442\u0438. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u044d\u0442\u0438\u0445 \u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b Intel® AMT \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0431\u0443\u0434\u0443\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b.

    "); 0==editEnvironmentDetectionTmp.length&&(c+="\u0414\u043e\u043c\u0435\u043d\u044b \u0438\u043d\u0442\u0440\u0430\u0441\u0435\u0442\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e.
    ");for(var a in editEnvironmentDetectionTmp)c+="
    "+ AddButton2("\u0423\u0434\u0430\u043b\u0438\u0442\u044c","editEnvironmentDetectionRemove("+a+")")+'
    '+editEnvironmentDetectionTmp[a]+"
    ";xxAccountAdminName&&5>editEnvironmentDetectionTmp.length&&(c+="
    "); @@ -1491,7 +1489,7 @@ function powerActionDlgRPE(b){var c;c="Confirm execution of Intel® Remote Pl [],d=amtPowerBootCapabilities.PlatformErase;d&4&&a.push("");d&64&&a.push("");d&33554432&&a.push("");d&67108864&&a.push(""); d&-2147483648&&a.push("");1Select the actions to take:

    {0}

    ",a.join("
    ")));c+="";setDialogMode(11,"\u0421\u0438\u043b\u043e\u0432\u044b\u0435 \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f", 3,powerActionDlgRPEEx,c,b);QE("c54",!1)}function powerActionDlgRPEValidate(){var b=0,c=amtPowerBootCapabilities.PlatformErase,a=[2,6,25,26,31],d;for(d in a)c&1<b&&2amtversion&&(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; @@ -1532,13 +1530,13 @@ function powerActionResponse4(b,c,a,d){200==d&&(QH(60,"\u0421\u0438\u043b\u043e\ function consentChanged(){QE("c54",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",2c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(D){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][b[c].name]=b[c])}xxStorage.content= +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(E){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 g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][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"])}d=0;a=TableStart2()+"

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c Intel® AMT \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430.

    "; -var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="
    "),v=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+"\u043a\u043e\u0440\u0435\u043d\u044c";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("\u0421\u043a\u0430\u0447\u0430\u0442\u044c","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("
    "+ -EscapeHtml(e)+", "+b[c][p][e].size+" \u0431\u0430\u0439\u0442\u043e\u0432
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+= -"

    \u0424\u0430\u0439\u043b\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.

    ");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c ...","UploadToStorage()"):""));QH(55,a)}else QH(55,"\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 ...
    "+ +var u,n,g="";for(c in b){var k=0,p;for(p in b[c]){k++;var v=0,e;for(e in b[c][p]){v++;if(c!=u||p!=n)""!=g&&(a+=g,g="
    "),u=c,n=p,g=""!=c?g+EscapeHtml(c+" / "+p):g+"\u043a\u043e\u0440\u0435\u043d\u044c";var B='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('
    "),g=g+(" "+AddButton2("\u0421\u043a\u0430\u0447\u0430\u0442\u044c","DownloadFromStorage("+B+',"'+e+'",event)')),g=g+("
    "+ +EscapeHtml(e)+", "+b[c][p][e].size+" \u0431\u0430\u0439\u0442\u043e\u0432
    ");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==v&&(wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+= +"

    \u0424\u0430\u0439\u043b\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b.

    ");u=!1;try{var w=new FileReader;u=null!=w&&null!=w.readAsBinaryString}catch(E){console.log(E)}a+="
    "+TableEnd(AddRefreshButton("PullStorage()")+(u?AddButton("\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c ...","UploadToStorage()"):""));QH(55,a)}else QH(55,"\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 ...
    "+ AddButton("\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435","PullStorage()"))} -function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("\u043f\u0440\u043e\u0434\u0430\u0432\u0435\u0446",b));""!=c&&(g+=addHtmlValue("\u0437\u0430\u044f\u0432\u043a\u0430",c));g+=addHtmlValue("\u0438\u043c\u044f",a);g+=addHtmlValue("\u0420\u0430\u0437\u043c\u0435\u0440",v.size+" bytes");v.link&&(g+=addHtmlValue("\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442",v.link));setDialogMode(11,"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f", +function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",u=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("\u043f\u0440\u043e\u0434\u0430\u0432\u0435\u0446",b));""!=c&&(g+=addHtmlValue("\u0437\u0430\u044f\u0432\u043a\u0430",c));g+=addHtmlValue("\u0438\u043c\u044f",a);g+=addHtmlValue("\u0420\u0430\u0437\u043c\u0435\u0440",u.size+" bytes");u.link&&(g+=addHtmlValue("\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442",u.link));setDialogMode(11,"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f", 5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")} function storageDeleteResponse(b,c){200!=c?messagebox("\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f",format("\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0430\u0439\u043b (ERR {0}), \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0432\u043a\u043b\u044e\u0447\u0435\u043d.",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","noopener,noreferrer");a.opener=null;a.focus()}} @@ -1553,8 +1551,8 @@ a+="";for(var d in xxStorageVendors)a+='

    \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u043c.

    ";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,g){if(200==g){QV("go23",!0);if(0"+d[c].ElementName+", \u043f\u0440\u043e\u0441\u043d\u0443\u0442\u044c\u0441\u044f "+(new Date(d[c].StartTime.Datetime)).toLocaleString().replace(", ", @@ -1563,33 +1561,33 @@ b+="
    "+a "RemoveAllAlarms()")+AddButton("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c","showAddAlarm()"));b+="
    "+TableEnd(d+"");QH(57,b)}},null,!0)} function prepareAlarmOccurenceTemplate(b,c,a,d,g){return''+b+''+a+''+d+""+ g+""}function RemoveAllAlarms(){setDialogMode(1,"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u0438",3,RemoveAllAlarmsEx,"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u0432?")} -function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})} +function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,u){0==--b&&PullAlarms()})} function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(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],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}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()), +d=[0,0,0],g;for(g in a){var u=a[g].length-1;"D"==a[g][u]&&(d[0]=parseInt(a[g].substring(0,u)));"H"==a[g][u]&&(d[1]=parseInt(a[g].substring(0,u)));"M"==a[g][u]&&(d[2]=parseInt(a[g].substring(0,u)))}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,"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}} function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0 \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435.", +"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",u=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,u);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a",format("\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a. \u0421\u0442\u0430\u0442\u0443\u0441: {0}.
    \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435.", d)):0!=c.Body.ReturnValue?messagebox("\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a",format("\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0440\u0435\u0432\u043e\u0433\u0438 {0}.
    \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0440\u0435\u0432\u043e\u0433\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0431\u0443\u0434\u0443\u0449\u0435\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.", -c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a",format("Failed to change alarm. Status: {0}.
    Verify the alarm for at a future time.", +c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime=''+d+"",a.Interval=''+g+"",a.DeleteOnCompletion=u,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a",format("Failed to change alarm. Status: {0}.
    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=new Date(c.StartTime.Datetime),a="
    "+addHtmlValue("\u0438\u043c\u044f",c.ElementName)+addHtmlValue("\u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u044f",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u044f", 1==c.DeleteOnCompletion?"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a":"\u0414\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0440\u0435\u0432\u043e\u0433\u0443")+"
    ";messagebox(format("\u0422\u0440\u0435\u0432\u043e\u0433\u0430 {0}",c.ElementName),a);setDialogMode(11,"\u0410\u0432\u0430\u0440\u0438\u0439\u043d\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f"+c.ElementName,5,showAlertDetailsDelete,a,b)}} -function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; -function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)} +function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,u){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag; +function setDialogMode(b,c,a,d,g,u){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=u;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));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(9).display&&(b+=32);QS(14).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(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]= "hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)} -function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ -n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")} +function SaveJsonFile(b,c,a,d){var g="",u={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,u={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(u.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+ +n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);u[c]=d;saveAs(data2blob(JSON.stringify(u,null," ").replace(/\n/g,"\r\n")),b+g+".json")} var httpErrorTable={200:"\u0425\u043e\u0440\u043e\u0448\u043e",401:"\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438",408:"\u041e\u0448\u0438\u0431\u043a\u0430 \u0442\u0430\u0439\u043c-\u0430\u0443\u0442\u0430",601:"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 WSMAN",602:"\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u0442\u0432\u0435\u0442\u0430 HTTP", 603:"\u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439 HTTP-\u043e\u0442\u0432\u0435\u0442 enum",604:"\u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439 HTTP-\u043e\u0442\u0432\u0435\u0442",997:"\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0426\u0430\u0440\u0441\u0442\u0432\u043e \u0414\u0430\u0439\u0434\u0436\u0435\u0441\u0442\u0430"}; 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("\u041e\u0448\u0438\u0431\u043a\u0430 \u2116 {0}",b)),401==b&&QH(5,'\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438

    '), go(100),QS(3).width=0);return 200!=b}function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}} function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!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){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1♦ "+b+""}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,g=0,v;for(v in b){var n=b.charCodeAt(v);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u0430",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1} +function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,u;for(u in b){var n=b.charCodeAt(u);64n?c=1:96n?a=1:47n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u0430",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1} function TableStart(){return" - @@ -867,8 +814,8 @@
    - + Disconnected
    @@ -884,29 +831,18 @@ - - - - @@ -1136,25 +1061,14 @@ @@ -1236,7 +1150,7 @@ @@ -1366,7 +1280,7 @@
    -   +  
    @@ -1375,7 +1289,6 @@ -
    @@ -1412,15 +1325,6 @@
    -
    -
    Encoding
    - -
    Other Settings
    @@ -1458,16 +1362,16 @@
    Display Size
    @@ -1479,7 +1383,7 @@ - + @@ -1520,7 +1424,7 @@ var autoReconnect = true; var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"]; var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"]; - var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android", "Linux ARM", "macOS x86-32bit", "Android x86", "PogoPlug ARM", "Android", "Linux Poky x86-32bit", "macOS x86-64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "MIPS24KC (OpenWRT)", "Apple Silicon", "FreeBSD x86-64", "Unknown", "Linux ARM 64 bit (glibc/2.24 NOKVM)", "Alpine Linux x86 64 Bit (MUSL)", "Assistant (Windows)", "Armada370 - ARM32/HF (libc/2.26)", "OpenWRT x86-64", "OpenBSD x86-64", "Unknown", "Unknown", "MIPSEL24KC (OpenWRT)", "ARMADA/CORTEX-A53/MUSL (OpenWRT)", "Windows ARM 64bit console", "Windows ARM 64bit service"]; + var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android", "Linux ARM", "macOS x86-32bit", "Android x86", "PogoPlug ARM", "Android", "Linux Poky x86-32bit", "macOS x86-64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "MIPS24KC (OpenWRT)", "Apple Silicon", "FreeBSD x86-64", "Unknown", "Linux ARM 64 bit (glibc/2.24 NOKVM)", "Alpine Linux x86 64 Bit (MUSL)", "Assistant (Windows)", "Armada370 - ARM32/HF (libc/2.26)", "OpenWRT x86-64", "OpenBSD x86-64", "Unknown", "Unknown", "MIPSEL24KC (OpenWRT)", "ARMADA/CORTEX-A53/MUSL (OpenWRT)"]; var agentsStrNoAgent = ['', '', '', '', "Windows", '', "Linux", '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', "Apple"]; var sort = 0; var searchFocus = 0; @@ -1543,8 +1447,8 @@ var stars = {}; // Devices that have been "stared" by the user. var nodeShortIdent = 0; var desktop; - var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false, swapmouse: false, remotekeymap: false, autoclipboard: false, autolock: false, agentencoding: 4 }; - var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000, agentencoding: 4 }; + var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false, swapmouse: false, remotekeymap: false, autoclipboard: false, autolock: false }; + var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 }; var terminal; var files; var debugLevel = parseInt('{{{debuglevel}}}'); @@ -1552,9 +1456,6 @@ var features2 = parseInt('{{{features2}}}'); var sessionTime = parseInt('{{{sessiontime}}}'); var webRelayPort = parseInt('{{{webRelayPort}}}'); - var webRelayDns = '{{{webRelayDns}}}'; - var hidePowerTimeline = '{{{hidePowerTimeline}}}'; - var showNotesPanel = '{{{showNotesPanel}}}'; var sessionRefreshTimer = null; var domain = '{{{domain}}}'; var domainUrl = '{{{domainurl}}}'; @@ -1568,8 +1469,6 @@ var debugmode = 0; var windowsBrowser = detectWindowsBrowser(); var attemptWebRTC = ((features & 128) != 0); - var webrtcconfiguration = '{{{webrtcconfig}}}'; - if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: "' + webrtcconfiguration + '".'); webrtcconfiguration = null; } } var passRequirements = '{{{passRequirements}}}'; if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } var customui = '{{{customui}}}'; @@ -1603,7 +1502,6 @@ var deskKeyboardStrings = []; var deskLastClipboardSent = null; var requestedLastConnects = false; - var devicePagingState = null; // Console Message Display Timers var p11DeskConsoleMsgTimer = null; @@ -1621,13 +1519,7 @@ // Check if WebP is supported var webpSupport = false; - check_webp_feature('lossy', function (f, x) { - webpSupport = x; - if (!x) { - d7encoding.options[1].disabled = true; - d7encoding.value = 1; - } - }); + check_webp_feature('lossy', function (f, x) { webpSupport = x; }); function startup() { if ((features & 32) == 0) { @@ -1647,7 +1539,6 @@ delete urlargs.viewmode; delete urlargs.gotonode; delete urlargs.gotodevicename; - delete urlargs.gotodeviceip; delete urlargs.gotomesh; delete urlargs.gotouser; delete urlargs.gotougrp; @@ -1663,7 +1554,7 @@ if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } } debugmode = args.debug; - //attemptWebRTC = false; // For now, default WebRTC off unless we set it in the URL. + attemptWebRTC = false; // For now, default WebRTC off unless we set it in the URL. if (args.webrtc != null) { attemptWebRTC = (args.webrtc == 1); } QV('p13AutoConnect', debugmode); // Files @@ -1691,7 +1582,7 @@ // Setup logout control var logoutControl = ''; if (logoutControls) { - if (logoutControls.name != null) { logoutControl = ('' + format("Welcome {0}.", logoutControls.name) + ''); } + if (logoutControls.name != null) { logoutControl = ('' + format("Welcome {0}.", logoutControls.name) + ''); } if (logoutControls.logoutUrl != null) { logoutControl += format(' ' + "Logout" + ''); } } if (args.hide & 1) { QH('logoutControlSpan2', logoutControl); } else { QH('logoutControlSpan', logoutControl); } @@ -1710,26 +1601,7 @@ QV('DeskESC', browserfullscreen); if ((xtermfit != null) && (xxcurrentView == 12)) { xtermfit.fit(); } } - setTimeout(function() { - if (urlargs.filter) { Q('SearchInput').value = urlargs.filter; Q('KvmSearchInput').value = urlargs.filter; } - mainUpdate(512); - }, 200); - - // open notes markdown links in new tab - if (DOMPurify) { - DOMPurify.addHook('afterSanitizeAttributes', function (node) { - if ('target' in node) { - node.setAttribute('target', '_blank'); - node.setAttribute('rel', 'noopener noreferrer'); - } - if (!node.hasAttribute('target') && (node.hasAttribute('xlink:href') || node.hasAttribute('href'))) { - node.setAttribute('xlink:show', 'new'); - } - }); - } - - // Show the modern ui switcher - QV('textnewui', ((features2 & 0x40000000) == 0) ? false : true); + setTimeout(function() { mainUpdate(512); }, 200); // Connect to the mesh server meshserver = MeshServerCreateControl(domainUrl); @@ -1754,7 +1626,7 @@ for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); } Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel'); - // Setup upload drag & drop for server files + // Setup upload drag & drop Q('p5filetable').addEventListener('drop', p5fileDragDrop, false); Q('p5filetable').addEventListener('dragover', p5fileDragOver, false); Q('p5filetable').addEventListener('dragleave', p5fileDragLeave, false); @@ -1762,12 +1634,7 @@ //Q('p5fileCatchAllInput').addEventListener('dragover', p5fileDragOver, false); //Q('p5fileCatchAllInput').addEventListener('dragleave', p5fileDragLeave, false); - // Setup drag & drop for device desktop - Q('deskarea0').addEventListener('drop', p11fileDragDrop, false); - Q('deskarea0').addEventListener('dragover', p11fileDragOver, false); - Q('deskarea0').addEventListener('dragleave', p11fileDragLeave, false); - - // Setup upload drag & drop for device files + // Setup upload drag & drop Q('p13filetable').addEventListener('drop', p13fileDragDrop, false); Q('p13filetable').addEventListener('dragover', p13fileDragOver, false); Q('p13filetable').addEventListener('dragleave', p13fileDragLeave, false); @@ -1803,14 +1670,12 @@ QV('p4UserBatchCreate', (features & 0x00080000) == 0); // Set the file editor - d4EditWrapVal = Number(getstore('editorWrap', 0)); - d4EditSizeVal = Number(getstore('editorSize', 0)); - d4EditEncodingVal = Number(getstore('editorEncoding', 0)); - d4EditLineBreakVal = Number(getstore('editorLineBreak', 0)); + d4EditWrapVal = getstore('editorWrap', 0); + d4EditSizeVal = getstore('editorSize', 0); + d4EditEncodingVal = getstore('editorEncoding', 0); d4ToggleWrap(true); d4ToggleSize(true); d4ToggleEncoding(true); - d4ToggleLineBreak(true); if (pluginHandler != null) pluginHandler.callHook('onWebUIStartupEnd'); // Deleted non-english style and fix all topbar titles @@ -1851,7 +1716,7 @@ // Set the user's desktop shortcut keys deskKeyboardShortcuts = []; var deskKeyboardShortcutsStr = getstore('deskKeyShortcuts', '0x0A002E,0x100000,0x100028,0x100026,0x10004C,0x10004D,0x11004D,0x100052,0x020073,0x080057,0x020009,0x100025,0x100027').split(','); - for (var i in deskKeyboardShortcutsStr) { if (deskKeyboardShortcutsStr[i] != "") { deskKeyboardShortcuts.push(parseInt(deskKeyboardShortcutsStr[i])); } } + for (var i in deskKeyboardShortcutsStr) { deskKeyboardShortcuts.push(parseInt(deskKeyboardShortcutsStr[i])); } updateDeskShortcutKeys(); // Set the user's desktop strings @@ -1872,9 +1737,6 @@ // Fix HTML words that in english have two or more meanings Q('DeskType').value = multiTranslate("[KeyboardTyping]|Type"); - - // Show the "Scroll to top" button - QV('ScrollToTopButton', (features2 & 0x08000000) != 0); } function refreshCookieSession() { @@ -2147,8 +2009,6 @@ setNightMode(); } - if(window.matchMedia) { window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', setNightMode); } - function setNightMode() { // Set night mode var nNightMode = getstore('nightMode', '0') @@ -2191,29 +2051,10 @@ QV('body', true); } - function saveUserInterfaceMode() { - var nUiViewMode = 2; - if (Q('ui1').checked) { nUiViewMode = 3; } - if (getstore('uiViewMode', 2) != nUiViewMode) { - putstore('uiViewMode', nUiViewMode); - reload(); - } - } - - function toggleBootstrapUIMode() { - if (xxdialogMode) return; - var uiViewMode = getstore('uiViewMode', 2); - var x = '
    '; - x += '
    '; - setDialogMode(2, "User Interface", 3, saveUserInterfaceMode, x); - QV('uiMenu', false); - } - function getNodeFromId(id) { if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } } return null; } function reload() { var x = window.location.href; if (x.endsWith('/#')) { x = x.substring(0, x.length - 2); } - if (x.endsWith('#')) { x = x.substring(0, x.length - 1); } window.location.href = x; } @@ -2234,14 +2075,13 @@ QV('verifyEmailId2', false); QV('logoutControl', false); if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; } - if (errorCode == 'invalidorigin') { QH('p0span', "Invalid origin in HTTP request"); return; } if (prevState == 2) { if (autoReconnect) { setTimeout(serverPoll, 5000); } } else { QH('p0span', "Unable to connect web socket"); } if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; } } else if (state == 2) { // Fetch list of meshes, nodes, files meshserver.send({ action: 'usergroups' }); meshserver.send({ action: 'meshes' }); - meshserver.send({ action: 'nodes', id: '{{currentNode}}', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); + meshserver.send({ action: 'nodes', id: '{{currentNode}}' }); meshserver.send({ action: 'loginTokens' }); if (pluginHandler != null) { meshserver.send({ action: 'plugins' }); } if ('{{currentNode}}'.toLowerCase() == '') { meshserver.send({ action: 'files' }); } @@ -2281,21 +2121,18 @@ QV('p2AccountActions', !accountSettingsLocked) QV('managePhoneNumber1', (features & 0x02000000) && (features & 0x04000000) && (serverinfo.lock2factor != true)); QV('managePhoneNumber2', (features & 0x02000000) && !(features & 0x04000000) && (serverinfo.lock2factor != true)); - QV('manageMessaging1', (features2 & 0x02000000) && (features2 & 0x04000000) && (serverinfo.lock2factor != true)); - QV('manageMessaging2', (features2 & 0x02000000) && !(features2 & 0x04000000) && (serverinfo.lock2factor != true)); QV('manageEmail2FA', (features & 0x00800000) && (serverinfo.lock2factor != true)); QV('p2AccountPassActions', ((features & 4) == 0) && (serverinfo.domainauth == false) && (userinfo != null) && (userinfo._id.split('/')[2].startsWith('~') == false)); // Hide Account Actions if in single user mode or domain authentication //QV('p2AccountImage', ((features & 4) == 0) && (serverinfo.domainauth == false)); // If account actions are not visible, also remove the image on that panel QV('accountCreateLoginTokenSpan', features2 & 0x00000080); QV('p2AccountImageFrame', !accountSettingsLocked) - QV('p2ServerActions', (siteRights & 21) && ((serverFeatures & 143) != 0)); + QV('p2ServerActions', (siteRights & 21) && ((serverFeatures & 15) != 0)); QV('LeftMenuMyServer', (siteRights & 21) && ((serverFeatures & 64) != 0)); // 16 + 4 + 1 QV('MainMenuMyServer', siteRights & 21); QV('p2ServerActionsBackup', (siteRights & 1) && ((serverFeatures & 1) != 0)); QV('p2ServerActionsRestore', (siteRights & 4) && ((serverFeatures & 2) != 0)); QV('p2ServerActionsVersion', (siteRights & 16) && ((serverFeatures & 4) != 0)); QV('p2ServerActionsErrors', (siteRights & 16) && ((serverFeatures & 8) != 0)); - QV('p2ServerActionsConfig', (siteRights & 16) && ((serverFeatures & 128) != 0)); QV('MainMenuMyFiles', siteRights & 8); QV('LeftMenuMyFiles', siteRights & 8); if (((siteRights & 8) == 0) && (xxcurrentView == 5)) { setDialogMode(0); go(1); } @@ -2371,7 +2208,6 @@ if (userinfo.otphkeys > 0) { authFactorCount += userinfo.otphkeys; } // FIDO hardware factor if ((features & 0x00800000) && (userinfo.otpekey == 1)) { authFactorCount++; } // EMail factor if ((features & 0x02000000) && (features & 0x04000000) && (userinfo.phone != null)) { authFactorCount++; } // SMS factor - if ((features2 & 0x02000000) && (features2 & 0x04000000) && (userinfo.msghandle != null)) { authFactorCount++; } // Messaging factor if ((authFactorCount > 0) && (userinfo.otpkeys > 0) && ((features2 & 0x40000) == 0)) { authFactorCount++; } // Backup keys return authFactorCount; } @@ -2384,12 +2220,9 @@ QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true) && (accountSettingsLocked == false)); QV('manageOtp', (serverinfo.lock2factor != true) && (authFactorCount > 0) && ((features2 & 0x40000) == 0)); QV('authPhoneNumberCheck', (userinfo.phone != null)); - QV('authMessagingCheck', (userinfo.msghandle != null)); QV('authEmailSetupCheck', (userinfo.otpekey == 1) && (userinfo.email != null) && (userinfo.emailVerified == true)); - QV('authDuoSetupCheck', (userinfo.otpduo == 1) && ((features2 & 0x20000000) != 0)); QV('authAppSetupCheck', userinfo.otpsecret == 1); QV('manageAuthApp', (serverinfo.lock2factor != true) && ((userinfo.otpsecret == 1) || ((features2 & 0x00020000) == 0))); - QV('manageDuoApp', (serverinfo.lock2factor != true) && ((features2 & 0x20000000) != 0)); QV('authKeySetupCheck', userinfo.otphkeys > 0); QV('authPushAuthDevCheck', (userinfo.otpdev > 0) && ((features2 & 0x40) != 0)); QV('authCodesSetupCheck', userinfo.otpkeys > 0); @@ -2432,43 +2265,14 @@ function setSessionActivity() { sessionActivity = Date.now(); QH('idleTimeoutNotify', ''); } function checkIdleSessionTimeout() { var delta = (Date.now() - sessionActivity); - if (delta > serverinfo.timeout) { - if (desktop != null) { // Disconnect remote desktop - desktop.Stop(); - webRtcDesktopReset(); - desktopNode = desktop = null; - if (pluginHandler != null) { pluginHandler.callHook('onDesktopDisconnect'); } - } - if (terminal != null) { // Disconnect terminal - terminal.Stop(); - terminal = null; - } - if (files != null) { // Disconnect files - files.Stop(); - files = null; - } - if (serverinfo.logoutonidlesessiontimeout) { - window.location.href = 'logout'; - } - } else { + if (delta > serverinfo.timeout) { window.location.href = 'logout'; } else { var ds = Math.round((serverinfo.timeout - delta) / 1000); - var sessionInProgress = desktop != null || terminal != null || files != null; - var show = serverinfo.logoutonidlesessiontimeout || sessionInProgress; - var isLogout = serverinfo.logoutonidlesessiontimeout; - var theText = ''; // Initialize theText if (ds <= 60) { - theText = isLogout - ? (ds == 1 ? "1 second until logout" : "{0} seconds until logout") - : (ds == 1 ? "1 second until disconnect" : "{0} seconds until disconnect"); + QH('idleTimeoutNotify', '
    ' + format((ds == 1)?"1 second until disconnect":"{0} seconds until disconnect", ds)); } else { ds = Math.round(ds / 60); - if (ds <= 5) { - theText = isLogout - ? (ds == 1 ? "1 minute until logout" : "{0} minutes until logout") - : (ds == 1 ? "1 minute until disconnect" : "{0} minutes until disconnect"); - } + if (ds <= 5) { QH('idleTimeoutNotify', '
    ' + format((ds == 1)?"1 minute until disconnect":"{0} minutes until disconnect", ds)); } } - QH('idleTimeoutNotify', show && theText ? '
    ' + format(theText, ds) : ''); } } @@ -2502,7 +2306,7 @@ case 'serverwarnings': { if ((message.warnings != null) && (message.warnings.length > 0)) { var ServerWarnings = { - 1: "", + 1: "MeshCentral SSH support requires NodeJS 11 or higher.", 2: "Missing WebDAV parameters.", 3: "Unrecognized configuration option \"{0}\".", 4: "WebSocket compression is disabled, this feature is broken in NodeJS v11.11 to v12.15 and v13.2", @@ -2523,12 +2327,7 @@ 19: "SMS gateway has limited use in LAN mode.", 20: "Invalid \"LoginCookieEncryptionKey\" in config.json.", 21: "Backup path can't be set within meshcentral-data folder, backup settings ignored.", - 22: "Failed to sign agent {0}: {1}", - 23: "Unable to load agent icon file: {0}.", - 24: "Unable to load agent logo file: {0}.", - 25: "This NodeJS version does not support OpenID.", - 26: "This NodeJS version does not support Discord.js.", - 27: "Firebase now requires a service account JSON file, Firebase disabled." + 22: "Failed to sign agent {0}: {1}" }; var x = ''; for (var i in message.warnings) { @@ -2537,7 +2336,7 @@ x += '
    ' + "WARNING: " + y + '
    '; } else { var z = ServerWarnings[y.id]; - if (z == null) { z = y.msg; } else { if (y.args != null) { z = format(z, ...y.args); } } + if (z == null) { z = y.msg; } else { z = format(z, ...y.args); } x += '
    ' + "WARNING: " + z + '
    '; } } @@ -2570,24 +2369,11 @@ } } if (serverinfo.preConfiguredRemoteInput) { - // Setup the pre-configured keyboard remote input strings var x = ''; for (var i in serverinfo.preConfiguredRemoteInput) { x += '
    ' + EscapeHtml(serverinfo.preConfiguredRemoteInput[i].name) + '
    '; } if (x != '') { x += '
    '; } QH('deskPreConfigShortcutContextMenu1', x); } - if (serverinfo.preConfiguredScripts) { - // Setup the pre-configured scripts - var x = '', y = ''; - for (var i in serverinfo.preConfiguredScripts) { - var s = serverinfo.preConfiguredScripts[i]; - var z = '
    ' + EscapeHtml(serverinfo.preConfiguredScripts[i].name) + '
    '; - if (s.type != 3) { x += z; } - if (s.type >= 3) { y += z; } - } - QH('deskPreConfigScriptContextMenu1', x); // Windows devices - QH('deskPreConfigScriptContextMenu2', y); // Other devices - } break; } case 'userinfo': { @@ -2662,10 +2448,6 @@ // Change the reference to the current node if (currentNode != null) { currentNode = getNodeFromId(currentNode._id); if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); } else { go(1); } } - // Update device paging - devicePagingState = (message.totalcount == null) ? null : { total: message.totalcount, skip: message.skip, limit: message.limit }; - updateDevicePageState(); - mainUpdate(1 | 2 | 4 | 64); break; } @@ -2750,8 +2532,6 @@ showDeskToolsProcesses(message); } else if (message.type === 'services') { showDeskToolsServices(message); - } else if (message.type === 'service') { - showServiceDetailsDialog(message); } else if ((message.type === 'getclip') && (currentNode != null) && (currentNode._id == message.nodeid)) { if ((message.tag == 1) && (xxdialogTag === 'clipboard')) { Q('d2clipText').value = message.data; // Put remote clipboard data into dialog box @@ -2770,16 +2550,6 @@ else if (userSessions.length === 1) { connectDesktop(null, 1, userSessions[0].SessionId, message.tag); } // One active session, connect to it else { var x = ''; - var sortBy = "{{{userSessionsSort}}}"; - if (sortBy != '') { - userSessions.sort(function(a, b) { - if (!a[sortBy]) return -1; // a comes before b - if (!b[sortBy]) return 1; // b comes before a - if (a[sortBy] < b[sortBy]) return -1; - if (a[sortBy] > b[sortBy]) return 1; - return 0; - }); - } for (var i in userSessions) { x += '
    ' + userSessions[i].State + (userSessions[i].StationName ? (', ' + userSessions[i].StationName) : ''); if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } } @@ -2793,11 +2563,6 @@ var x = '
    '; //x += addHtmlValue4("Process ID", message.pid); if ((typeof message.value == 'object') && (Object.keys(message.value).length > 0)) { - // lets fix agent psinfo not being camelcase - message.value = jsonToCamel(message.value); - if(!message.value.cmd && message.value.path){ message.value.cmd = message.value.path } - if(!message.value.processUser && message.value.userName){ message.value.processUser = message.value.userName.split("\\")[1]; } - if(!message.value.processDomain && message.value.userName){ message.value.processDomain = message.value.userName.split("\\")[0]; } if (message.value.processName) { x += '
    ' + "Process Name" + '
    ' + message.value.processName + '
    '; } if (message.value.machineName) { x += addHtmlValue5("Machine Name", message.value.machineName); } if (message.value.cmd) { x += '
    ' + "Command Line" + '
    ' + message.value.cmd + '
    '; } @@ -2826,12 +2591,6 @@ x += '
    '; QH('id_dialogOptions', x); } - } else if (message.type === 'deskBackground') { - if(message.data != "") { - Q('DeskBackgroundButtonImage').src = 'images/icon-background.png'; - }else{ - Q('DeskBackgroundButtonImage').src = 'images/icon-background-red.png'; - } } } } else { @@ -2877,11 +2636,11 @@ if (net.name) { x += addHtmlValue2("Name", '' + EscapeHtml(net.name) + ''); } if (net.desc) { x += addHtmlValue2("Description", EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); } if (net.dnssuffix) { x += addHtmlValue2("DNS suffix", EscapeHtml(net.dnssuffix) + ' '); } - if (net.mac) { x += addHtmlValue2("MAC address", '' + EscapeHtml(net.mac.toLowerCase()) + ' '); } + if (net.mac) { x += addHtmlValue2("MAC address", '' + EscapeHtml(net.mac.toLowerCase()) + ' '); } if (net.v4addr) { x += addHtmlValue2("IPv4 address", EscapeHtml(net.v4addr) + ' '); } if (net.v4mask) { x += addHtmlValue2("IPv4 mask", EscapeHtml(net.v4mask) + ' '); } if (net.v4gateway) { x += addHtmlValue2("IPv4 gateway", EscapeHtml(net.v4gateway) + ' '); } - if (net.gatewaymac) { x += addHtmlValue2("Gateway MAC", '' + EscapeHtml(net.gatewaymac.toLowerCase()) + ' '); } + if (net.gatewaymac) { x += addHtmlValue2("Gateway MAC", '' + EscapeHtml(net.gatewaymac.toLowerCase()) + ' '); } } } else if (message.netif2 != null) { // New style @@ -2890,7 +2649,7 @@ if ((Array.isArray(net) == false) || (net.length < 1) || (net[0] == null) || ((typeof net[0].mac == 'string') && (net[0].mac.startsWith('00:00:00:00')))) continue; x += '
    ' x += addHtmlValue2("Name", '' + EscapeHtml(i) + ''); - if (typeof net[0].mac == 'string') { x += addHtmlValue2("MAC address", '' + EscapeHtml(net[0].mac.toLowerCase()) + ' '); } + if (typeof net[0].mac == 'string') { x += addHtmlValue2("MAC address", '' + EscapeHtml(net[0].mac.toLowerCase()) + ' '); } if (net[0].fqdn) { x += addHtmlValue2("FQDN", net[0].fqdn); } for (var j = 0; j < net.length; j++) { var netif = net[j]; @@ -2938,7 +2697,7 @@ case 'servererrors': { if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerErrors')) { if (message.data == null) { - setDialogMode(2, "Server Errors", 1, null, "Server has no error log."); + setDialogMode(2, "MeshCentral Server Errors", 1, null, "Server has no error log."); } else { var x = '
    ' + EscapeHtml(message.data) + '
    '; x += '
    '; @@ -2949,23 +2708,6 @@ } break; } - case 'serverconfig': { - if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerConfig')) { - if (message.data == null) { - setDialogMode(2, "Server Configuration", 1, null, "Server has no config file."); - } else { - setDialogMode(4, "Server Configuration", 2); - QV('d4EncodingButton', false); - QV('d4LineBreakButton', false); - QS('dialog').width = 'auto'; - QS('dialog').bottom = '80px'; - QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px'; - Q('d4editorarea').value = message.data; - Q('d4editorarea').setAttribute('readonly','readonly'); - } - } - break; - } case 'serverconsole': { p15consoleReceive('serverconsole', message.value); break; @@ -2985,7 +2727,6 @@ } case 'recordings': { p52recordings = message.events; - if (message.error != null) { p52recordings = message.error; } updateRecordings(); break; } @@ -3036,9 +2777,6 @@ QV('idx_dlgOkButton', true); focusTextBox('d2devNotes'); } - }else{ - Q('notesPanelArea').innerHTML = (message.notes && marked && DOMPurify) ? DOMPurify.sanitize(marked.parse(decodeURIComponent(message.notes), { breaks: true }), { USE_PROFILES: { html: true } }) : ''; - if ((showNotesPanel === 'true') && message.notes) { QV('notesPanel',true); }else{ QV('notesPanel', false); } } break; } @@ -3051,7 +2789,7 @@ var secret = message.secret; if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); } else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '
    ' + secret.substring(20) } - QH('d2optinfo', '

    "}function TableStart2(){return"

    "}function TableEntry(b,c){return"

    "+b+"

    "+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"

    "+(b?b:"")+"

    "}function AddButton(b,c){return""}function AddButton2(b,c,a){return""} function AddRefreshButton(b){return'"}function MoreStart(){return'▼ More
    '; - x += '
    ' + EscapeHtml((m.BankLabel ? m.BankLabel : (m.DeviceLocator ? m.DeviceLocator : 'Unknown'))) + '
    '; + x += '
    ' + EscapeHtml(m.BankLabel) + '
    '; if (m.Capacity && m.Speed) { x += addDetailItem("Capacity / Speed", format("{0} Mb, {1} Mhz", (m.Capacity / 1024 / 1024), m.Speed), s); } else if (m.Capacity) { x += addDetailItem("Capacity", format("{0} Mb", (m.Capacity / 1024 / 1024)), s); } if (m.PartNumber) { x += addDetailItem("Part Number", EscapeHtml((m.Manufacturer && m.Manufacturer != 'Undefined') ? (m.Manufacturer + ', ') : '') + EscapeHtml(m.PartNumber), s); } @@ -6465,48 +5848,6 @@ } } - if (hardware.linux) { - if (hardware.linux.memory && (hardware.linux.memory.Memory_Device.length > 0)) { - var x = ''; - // Sort Memory - hardware.linux.memory.Memory_Device.sort(function(a, b) { if (a.Locator > b.Locator) return 1; if (a.Locator < b.Locator) return -1; return 0; }); - - x += ''; - for (var i in hardware.linux.memory.Memory_Device) { - var m = hardware.linux.memory.Memory_Device[i]; - if(m.Size && (m.Size == 'No Module Installed')) continue; - x += '
    '; - x += '
    ' + EscapeHtml((m.Locator ? m.Locator : 'Unknown')) + '
    '; - if (m.Size && m.Speed) { x += addDetailItem("Capacity / Speed", format("{0}, {1}", m.Size, m.Speed), s); } - else if (m.Size) { x += addDetailItem("Capacity", format("{0}", (m.Size)), s); } - if (m.PartNumber) { x += addDetailItem("Part Number", EscapeHtml((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + EscapeHtml(m.PartNumber), s); } - x += '
    '; - } - x += '
    '; - - if (x != '') { sections.push({ name: "Memory", html: x, img: 'ram'}); } - } - } - - if (hardware.darwin) { - if (hardware.darwin.memory && (hardware.darwin.memory.length > 0)) { - var x = ''; - x += ''; - for (var i in hardware.darwin.memory) { - var m = hardware.darwin.memory[i]; - if(m.Size && (m.Size == 'No Module Installed')) continue; - x += '
    '; - x += '
    ' + EscapeHtml((m.DeviceLocator ? m.DeviceLocator : 'Unknown')) + '
    '; - if (m.Size && m.Speed) { x += addDetailItem("Capacity / Speed", format("{0}, {1}", m.Size, m.Speed), s); } - else if (m.Size) { x += addDetailItem("Capacity", format("{0}", (m.Size)), s); } - if (m.PartNumber) { x += addDetailItem("Part Number", EscapeHtml((m.Manufacturer && m.Manufacturer != '')?(m.Manufacturer + ', '):'') + EscapeHtml(m.PartNumber), s); } - x += '
    '; - } - x += '
    '; - if (x != '') { sections.push({ name: "Memory", html: x, img: 'ram'}); } - } - } - // Storage if (hardware.identifiers && ident.storage_devices) { var x = ''; @@ -6525,10 +5866,6 @@ if (typeof m.Size == 'number') { x += addDetailItem("Capacity", format("{0} Mb", Math.floor(m.Size / 1024 / 1024)), s); } if (typeof m.Size == 'string') { x += addDetailItem("Capacity", EscapeHtml(m.Size), s); } } - if(hardware.windows && hardware.windows.drives && m.Model){ - const foundObject = hardware.windows.drives.find(obj => obj['Model'] === m.Model); - if(foundObject) x += addDetailItem("Status", EscapeHtml(foundObject.Status), s); - } x += '
    '; } } @@ -6537,101 +5874,6 @@ if (x != '') { sections.push({ name: "Storage", html: x, img: 'storage' }); } } - // Volumes and Bitlocker - if (hardware.windows && hardware.windows.volumes) { - var x = ''; - for (var i in hardware.windows.volumes) { - var m = hardware.windows.volumes[i]; - x += '
    '; - x += '
    ' + i + ':' + (((m.name == null) || (m.name == '')) ? '' : (' - ' + EscapeHtml(m.name))) + '
    '; - if (m.size) { - var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.size} ${sizes[j]}` : `${(m.size / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - x += addDetailItem("Capacity", EscapeHtml(fsize), s); - } - if (m.sizeremaining) { - var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.sizeremaining)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.sizeremaining} ${sizes[j]}` : `${(m.sizeremaining / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s); - } - if (m.type) { - var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : '')); - x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s); - } - - if (m.protectionStatus || m.volumeStatus) { - var bitlockerState = []; - if (m.protectionStatus) bitlockerState.push("Enabled"); - if (m.volumeStatus && m.volumeStatus == 'FullyDecrypted') bitlockerState.push("Fully Decrypted"); - if (m.volumeStatus && m.volumeStatus == 'EncryptionInProgress') bitlockerState.push("Encryption In Progress"); - if (m.volumeStatus && m.volumeStatus == 'FullyEncrypted') bitlockerState.push("Fully Encrypted"); - bitlockerState = bitlockerState.join(' - '); - if (m.recoveryPassword) { bitlockerState += addKeyLink('', 'deviceDetailsShowBitlockerInfo(\"' + encodeURIComponentEx(i) + '\",\"' + encodeURIComponentEx(m.identifier) + '\",\"' + encodeURIComponentEx(m.recoveryPassword) + '\")'); } - x += addDetailItem("BitLocker", bitlockerState, s); - } - x += '
    '; - } - if (x != '') { sections.push({ name: "Storage Volumes", html: '' + x + '
    ', img: 'storage'}); } - } - - // Linux Volumes - if (hardware.linux && hardware.linux.volumes) { - var x = ''; - for (var i in hardware.linux.volumes) { - var m = hardware.linux.volumes[i]; - if(m.mount_point.startsWith('/var/lib/docker/overlay2')) continue; - x += '
    '; - x += '
    ' + m.mount_point + '
    '; - if (m.size) { - var sizes = ['KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.size} ${sizes[j]}` : `${(m.size / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - x += addDetailItem("Capacity", EscapeHtml(fsize), s); - } - if (m.available) { - if (Math.abs(m.available) == 0) { - var fsize = `0 KB`; - } else { - var sizes = ['KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - } - x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s); - } - if (m.type) { - var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : '')); - x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s); - } - x += '
    '; - } - if (x != '') { sections.push({ name: "Storage Volumes", html: '' + x + '
    ', img: 'storage'}); } - } - - // MacOS Volumes - if (hardware.darwin && hardware.darwin.volumes) { - var x = ''; - for (var i in hardware.darwin.volumes) { - var m = hardware.darwin.volumes[i]; - if(m.mount_point.startsWith('/var/lib/docker/overlay2')) continue; - x += '
    '; - x += '
    ' + m.mount_point + '
    '; - if (m.size) { - x += addDetailItem("Capacity", EscapeHtml(m.size), s); - } - if (m.available) { - x += addDetailItem("Capacity Remaining", EscapeHtml(m.available), s); - } - if (m.type) { - var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : '')); - x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s); - } - x += '
    '; - } - if (x != '') { sections.push({ name: "Storage Volumes", html: '' + x + '
    ', img: 'storage'}); } - } - // Render the sections var x = ''; for (var i in sections) { @@ -6652,13 +5894,6 @@ } } - function deviceDetailsShowBitlockerInfo(drive, identifier, password) { - if (xxdialogMode) return false; - var x = '

    ' + "Identifier" + '

    ' + (identifier ? decodeURIComponent(identifier) : "Unknown") + '

    '; - x += '

    ' + "Recovery Password" + '

    ' + (password ? decodeURIComponent(password) : "Unknown") + '

    '; - setDialogMode(2, decodeURIComponent(drive) + ': ' + "BitLocker Information", 1, null, x, ''); - } - // // CONSOLE @@ -6819,19 +6054,7 @@ if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'default' }); } // Upload default core else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'clear' }); } // Clear the core else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file - else { - var htmlValue = ''; - setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", htmlValue)); - } + else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '')); } } function p15uploadCoreEx() { @@ -6856,12 +6079,6 @@ } else if (Q('d3coreMode').value == 7) { // Upload a tiny core meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'tiny' }); - } else if (Q('d3coreMode').value == 8) { - // Restart MeshAgent service - meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' }); - } else if (Q('d3coreMode').value == 9) { - // Update mesh agent - meshserver.send({ action: 'updateAgents', nodeids: [consoleNode._id] }); } } @@ -6871,7 +6088,7 @@ Q('d3localmodeform').action = 'uploadmeshcorefile.ashx'; Q('d3auth').value = authCookie; Q('d3attrib').value = currentNode._id; - setDialogMode(4, "Upload Mesh Agent Core", 3, p15uploadCoreEx2); + setDialogMode(3, "Upload Mesh Agent Core", 3, p15uploadCoreEx2); d3init(); } @@ -7053,11 +6270,9 @@ function p20installAndroidDialog() { if (xxdialogMode) return; - var x = '

    ' + "Install the MeshCentral Agent on your Android device. Once installed, click the pairing link to connect your device to this server." + '

    '; - x += '

    '; - x += '

    '; - x += '

    ' + "Android APK" + '

    '; - x += '

    ' + "Device Pairing Link" + '

    '; + var x = '
    ' + "Install the MeshCentral Agent on your Android device. Once installed, click the pairing link to connect your device to this server." + '
    '; + x += '
    ' + "MeshCentral Agent for Android" + '
    '; + x += '
    ' + "Device Pairing Link" + '
    '; setDialogMode(2, "Android Installation", 1, null, x); } @@ -7619,8 +6834,6 @@ function addHtmlValue4(t, v) { return '
    ' + t + '' + v + '
    '; } function addLink(x, f) { return '♦ ' + x + ''; } function addLinkConditional(x, f, c) { if (c) return addLink(x, f); return x; } - function addKeyLink(x, f) { return '' + x + ' '; } - function addKeyLinkConditional(x, t, c) { if (c) return '' + x + ' '; return x } function passwordcheck(p) { var re = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/; return re.test(p); } function getFileSizeStr(size) { if (typeof size != 'number') { size = 0; } if (size == 1) return "1 byte"; return format('{0} bytes', size); } function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); } @@ -7639,4 +6852,4 @@ - + \ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 8b11665a..7bfaf286 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -7,7 +7,6 @@ - @@ -42,13 +41,9 @@ - - - - {{{title}}} @@ -64,7 +59,6 @@
    Web-RDP
    Web-VNC
    Web-SSH
    -
    RDP

    @@ -139,15 +133,12 @@ -
    Server Statistics



    @@ -632,18 +595,6 @@
    @@ -704,7 +655,6 @@ -
    @@ -717,8 +667,6 @@
    - -
    @@ -751,16 +699,15 @@
    - +   - - + @@ -768,7 +715,7 @@ - +
    @@ -815,7 +762,7 @@
    -
    +
    
                                 
    -
    - Filter - Show   - Filter - Show  
    ' + format("Install" + ' ' + "Google Authenticator" + ' ' + "or a compatible application and scan the barcode, use this link or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.", message.url) + '

    ' + 'Secret ' + '
    ' + secret + '


    ' + "Enter the token here for 2-step login:" + '
    '); + QH('d2optinfo', '
    ' + format("Install Google Authenticator or a compatible application and scan the barcode, use this link or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.", message.url) + '

    ' + "Secret" + '
    ' + secret + '


    ' + "Enter the token here for 2-step login:" + '
    '); new QRCode(Q('qrcode'), { text: message.url, width: 128, height: 128, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.H }); QV('idx_dlgOkButton', true); QE('idx_dlgOkButton', false); @@ -3106,7 +2844,7 @@ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return; var start = '
    '; var end = '
    '; - var x = '' + "Hardware keys" + ' ' + "are used as secondary login authentication."; + var x = "Hardware keys are used as secondary login authentication."; x += '
    '; if (message.keys && message.keys.length > 0) { for (var i in message.keys) { @@ -3176,79 +2914,29 @@ account_managePhoneCodeValidate(); break; } - case 'verifyMessaging': { - if (xxdialogMode && (xxdialogTag != 'verifyMessaging')) return; - var x = '
    '; - x += '' + "Check your messaging application and enter the verification code."; - x += '

    ' + "Verification code:" + '
    '; - setDialogMode(2, "Messaging Notifications", 3, account_manageMessagingConfirm, x, message.cookie); - Q('d2phoneCodeInput').focus(); - account_managePhoneCodeValidate(); - break; - } - case 'fileoperation': { - // View the file in the dialog box - var p5editSaveBack = function(b, tag) { - var data; - var value = Q('d4editorarea').value; - value = d4EditLineBreakVal === 0 ? value.replace(/\r?\n|\r/g, '\r\n') : // Windows - d4EditLineBreakVal === 2 ? value.replace(/\r\n|\n/g, '\r') : // Mac - value.replace(/\r\n|\r/g, '\n'); // Linux - if (d4EditEncodingVal == 1) { - data = encode_utf8(value); // UTF8 encoding - } else { - data = value; // RAW encoding - } - meshserver.send({ action: 'fileoperation', fileop: 'set', path: tag.path, file: tag.file, data: btoa(data) }); - } - setDialogMode(4, EscapeHtml(message.file), 3, p5editSaveBack, null, message); - QV('d4EncodingButton', true); - QV('d4LineBreakButton', true); - QS('dialog').width = 'auto'; - QS('dialog').bottom = '80px'; - QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px'; - if (d4EditEncodingVal == 1) { - Q('d4editorarea').value = decode_utf8(atob(message.data)); // UTF8 Encoding - } else { - Q('d4editorarea').value = atob(message.data); // RAW Encoding - } - break; - } case 'event': { if (!message.event.nolog) { if (currentNode && (message.event.nodeid == currentNode._id) && (currentDeviceEvents != null)) { // If this event has a nodeid and we are looking at this node, update the log in real time. - if ((message.event.action == p16filterevents.value) || (p16filterevents.value == "")) { - if(currentDeviceEvents != null) { - currentDeviceEvents.unshift(message.event); - var eventLimit = parseInt(p16limitdropdown.value); - while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end - } - mainUpdate(1024); - } + currentDeviceEvents.unshift(message.event); + var eventLimit = parseInt(p16limitdropdown.value); + while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end + mainUpdate(1024); } if (currentUser && (message.event.userid == currentUser._id)) { // If this event has a userid and we are looking at this user, update the log in real time. - if ((message.event.action == p31filterevents.value) || (p31filterevents.value == "")) { - if(currentUserEvents != null) { - currentUserEvents.unshift(message.event); - var eventLimit = parseInt(p31limitdropdown.value); - while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end - } - mainUpdate(2048); - } + currentUserEvents.unshift(message.event); + var eventLimit = parseInt(p31limitdropdown.value); + while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end + mainUpdate(2048); } // Add this event to the main events log. - if ((message.event.action == p3filterevents.value) || (p3filterevents.value == "")) { - if(events != null) { - events.unshift(message.event); - var eventLimit = parseInt(p3limitdropdown.value); - while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end - } - mainUpdate(32); - } + events.unshift(message.event); + var eventLimit = parseInt(p3limitdropdown.value); + while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end + mainUpdate(32); } if (message.event.noact) break; // Take no action on this event @@ -3275,7 +2963,7 @@ break; } case 'recording': { - if ((p52recordings != null) && (typeof p52recordings == 'object')) { p52recordings.unshift(message.event); message.event.present = 1; updateRecordings(); } + if (p52recordings != null) { p52recordings.unshift(message.event); message.event.present = 1; updateRecordings(); } break; } case 'userWebState': { @@ -3311,7 +2999,7 @@ // Set the user's desktop shortcut keys deskKeyboardShortcuts = []; var deskKeyboardShortcutsStr = webstate.deskKeyShortcuts.split(','); - for (var i in deskKeyboardShortcutsStr) { if (deskKeyboardShortcutsStr[i] != "") { deskKeyboardShortcuts.push(parseInt(deskKeyboardShortcutsStr[i])); } } + for (var i in deskKeyboardShortcutsStr) { deskKeyboardShortcuts.push(parseInt(deskKeyboardShortcutsStr[i])); } updateDeskShortcutKeys(); } if (webstate.deskStrings != null) { @@ -3356,7 +3044,7 @@ } // If our list of nodes may have changes, request the new list now. - if (message.event.nodeListChange == userinfo._id) { meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); } + if (message.event.nodeListChange == userinfo._id) { meshserver.send({ action: 'nodes' }); } } if (currentNode) { refreshDevice(currentNode._id); } if (users == null) break; @@ -3398,7 +3086,7 @@ // Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed. meshserver.send({ action: 'meshes' }); - meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); + meshserver.send({ action: 'nodes' }); break; } case 'deleteusergroup': { @@ -3433,7 +3121,7 @@ // This is a new mesh for us if (add) { meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links, amt: message.event.amt, invite: message.event.invite, expireDevs: message.event.expireDevs, relayid: message.event.relayid }; - meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh). + meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh). } } else { // This is an existing device group @@ -3542,7 +3230,6 @@ // Change the node node.name = message.event.node.name; node.rname = message.event.node.rname; - node.lusers = message.event.node.lusers; node.users = message.event.node.users; node.host = message.event.node.host; node.desc = message.event.node.desc; @@ -3588,7 +3275,6 @@ } if (message.event.node.av != null) { node.av = message.event.node.av; } if (message.event.node.wsc != null) { node.wsc = message.event.node.wsc; } - if (message.event.node.volumes != null) { node.volumes = message.event.node.volumes; } node.namel = node.name.toLowerCase(); if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; } if (message.event.node.icon) { node.icon = message.event.node.icon; } @@ -3689,19 +3375,17 @@ // Show the notification if (n & 2) { var agentPrivilages = "Agent connected"; - if ((node.agent != null) && (node.agent.root === false)) { agentPrivilages = "Agent connected with limited privilages"; } - var abc = { title: node.name, icon: node.icon, nodeid: node._id, id: message.event.id }; - if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { abc.text = agentPrivilages; addNotification(abc); } - if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { abc.text = "Intel AMT detected"; addNotification(abc); } - if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { abc.text = "Intel AMT CIRA connected"; addNotification(abc); } - if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { abc.text = "MQTT connected"; addNotification(abc); } + if ((node.agent != null) && (node.agent.root === false)) { "Agent connected with limited privilages"; } + if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: agentPrivilages, title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: "Intel AMT detected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: "Intel AMT CIRA connected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { addNotification({ text: "MQTT connected", title: node.name, icon: node.icon, nodeid: node._id }); } } if (n & 4) { - var abc = { title: node.name, icon: node.icon, nodeid: node._id, id: message.event.id }; - if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { abc.text = "Agent disconnected"; addNotification(abc); } - if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { abc.text = "Intel AMT not detected"; addNotification(abc); } - if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { abc.text = "Intel AMT CIRA disconnected"; addNotification(abc); } - if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { abc.text = "MQTT disconnected"; addNotification(abc); } + if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: "Agent disconnected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: "Intel AMT not detected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: "Intel AMT CIRA disconnected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { addNotification({ text: "MQTT disconnected", title: node.name, icon: node.icon, nodeid: node._id }); } } // Change the node connection state @@ -3916,7 +3600,7 @@ if (message.consent & 0x0040) { y.push("Privacy bar"); } if (y.length == 0) { y.push("None"); } x += addHtmlValue("User Consent", y.join(', ')); - var type = ''; if (message.p <= 7) { type = ['', "Remote Terminal Link", "Remote Desktop Link", "Remote Desktop + Terminal Link", "Remote Files Link", "Remote Terminal + Files Link", "Remote Desktop + Files Link", "Remote Desktop + Terminal + Files Link"][message.p]; } else if (message.p == 8) { type = format("HTTP/{0} link", message.port); } else if (message.p == 16) { type = format("HTTPS/{0}", message.port); } + var type = ['', "Remote Terminal Link", "Remote Desktop Link", "Remote Desktop + Terminal Link", "Remote Files Link", "Remote Terminal + Files Link", "Remote Desktop + Files Link", "Remote Desktop + Terminal + Files Link"][message.p]; x += '
    '; setDialogMode(2, "Share Device", 1, null, x); break; @@ -4059,10 +3743,6 @@ var foundNode = null; if (nodes != null) { for (var i in nodes) { if (nodes[i].name == args.gotodevicename) { foundNode = nodes[i]._id; } } } if (foundNode) { gotoDevice(foundNode, xviewmode); goBackStack.push(1); } - } else if (args.gotodeviceip != null) { - var foundNode = null; - if (nodes != null) { for (var i in nodes) { if (nodes[i].ip == args.gotodeviceip) { foundNode = nodes[i]._id; } } } - if (foundNode) { gotoDevice(foundNode, xviewmode); goBackStack.push(1); } } else if (args.gotomesh != null) { if (meshes['mesh/' + domain + '/' + args.gotomesh] == null) return; // This device group is not loaded yet gotoMesh('mesh/' + domain + '/' + args.gotomesh); @@ -4109,37 +3789,6 @@ onDeviceSearchChanged(e); } - function updateDevicePageState() { - if ((devicePagingState == null) || (devicePagingState.total <= devicePagingState.limit)) { - QV('devViewPageState', false); - QV('devViewPageButton1', false); - QV('devViewPageButton2', false); - QV('devViewPageButton3', false); - QV('devViewPageButton4', false); - } else { - var currentPage = Math.floor((devicePagingState.skip + devicePagingState.limit) / devicePagingState.limit); - var maxPage = Math.ceil(devicePagingState.total / devicePagingState.limit); - QV('devViewPageState', true); - QV('devViewPageButton1', true); - QV('devViewPageButton2', true); - QV('devViewPageButton3', true); - QV('devViewPageButton4', true); - QH('devViewPageState', currentPage + '/' + maxPage); - } - } - - function onDeviceViewPageChange(i) { - if (devicePagingState == null) return; - var currentPage = (Math.floor((devicePagingState.skip + devicePagingState.limit) / devicePagingState.limit)); - var maxPage = Math.ceil(devicePagingState.total / devicePagingState.limit); - switch (i) { - case 1: { if (currentPage > 1) meshserver.send({ action: 'nodes', skip: 0 }); break; } // Goto first page - case 2: { if (currentPage > 1) meshserver.send({ action: 'nodes', skip: (currentPage - 2) * devicePagingState.limit }); break; } // Goto previous page - case 3: { if (currentPage < maxPage) meshserver.send({ action: 'nodes', skip: currentPage * devicePagingState.limit }); break; } // Goto next page - case 4: { if (currentPage < maxPage) meshserver.send({ action: 'nodes', skip: (maxPage - 1) * devicePagingState.limit }); break; } // Goto last page - } - } - function onDeviceViewChange(i) { if (i != null) { Q('viewselect').value = i; } for (var j = 1; j < 6; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); } @@ -4163,18 +3812,11 @@ x += '
    '; x += '
    '; x += '
    '; - x += '
    '; - x += '
    '; - x += '
    '; - x += '
    '; - x += '
    '; x += '
    '; x += '
    '; x += '
    '; x += '
    '; x += '
    '; - x += '
    '; - x += '
    '; setDialogMode(2, "Device View Columns", 3, onDeviceViewSettingsEx, x); } @@ -4189,13 +3831,6 @@ if (Q('d2c7').checked) { cols.push('lastseen'); } if (Q('d2c8').checked) { cols.push('agtype'); } if (Q('d2c9').checked) { cols.push('agver'); } - if (Q('d2c10').checked) { cols.push('tags'); } - if (Q('d2c11').checked) { cols.push('windowsav'); } - if (Q('d2c12').checked) { cols.push('windowsupdate'); } - if (Q('d2c13').checked) { cols.push('windowsfirewall'); } - if (Q('d2c14').checked) { cols.push('lastbootuptime'); } - if (Q('d2c15').checked) { cols.push('amthost'); } - if (Q('d2c17').checked) { cols.push('amtstate'); } deviceViewSettings.devsCols = cols; putstore('_deviceViewSettings', JSON.stringify(deviceViewSettings)); mainUpdate(4); @@ -4632,17 +4267,10 @@ if (deviceViewSettings.devsCols.indexOf('agtype') >= 0) { colums += '
    ' + "Agent Type"; } if (deviceViewSettings.devsCols.indexOf('agver') >= 0) { colums += '' + "Agent Version"; } if (deviceViewSettings.devsCols.indexOf('os') >= 0) { colums += '' + "OS"; } - if (deviceViewSettings.devsCols.indexOf('tags') >= 0) { colums += '' + "Tags"; } - if (deviceViewSettings.devsCols.indexOf('windowsav') >= 0) { colums += '' + "Windows AV"; } - if (deviceViewSettings.devsCols.indexOf('windowsupdate') >= 0) { colums += '' + "Windows Update"; } - if (deviceViewSettings.devsCols.indexOf('windowsfirewall') >= 0) { colums += '' + "Windows Firewall"; } - if (deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0) { colums += '' + "Last Boot Up Time"; } if (deviceViewSettings.devsCols.indexOf('links') >= 0) { colums += '' + "Links"; } if (deviceViewSettings.devsCols.indexOf('user') >= 0) { colums += '' + "User"; } if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { colums += '' + "Address"; } if (deviceViewSettings.devsCols.indexOf('conn') >= 0) { colums += '' + "Connectivity"; } - if (deviceViewSettings.devsCols.indexOf('amthost') >= 0) { colums += '' + "AMT Host"; } - if (deviceViewSettings.devsCols.indexOf('amtstate') >= 0) { colums += '' + "AMT State"; } if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) { colums += '' + "Last Seen"; if (requestedLastConnects == false) { requestedLastConnects = true; meshserver.send({ action: 'lastconnects' }); } @@ -4710,7 +4338,7 @@ c.removeAttribute('onmousemove'); Q('xkvmid_' + shortid).appendChild(c); QH('skvmid_' + shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][((desktop.m.State == null)?desktop.m.state:desktop.m.State)]); - if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(multidesktopsettings.agentencoding, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); } + if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(webpSupport?4:1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); } desktop.shortid = shortid; desktop.onStateChanged = onMultiDesktopStateChange; desktop.m.onRemoteInputLockChanged = null; @@ -4754,9 +4382,7 @@ var onDevicesTouchActive = false; var onDevicesScrollnagleTimer = null; - function onDevicesScroll(top) { - if(typeof top == 'undefined') top = false; - if(top) Q('xdevices').scrollTop = 0; + function onDevicesScroll() { if ((onDevicesScrollnagleTimer != null) || (onDevicesTouchActive)) return; onDevicesScrollnagleTimer = setTimeout(onDevicesScrollEx, 250); } @@ -4876,7 +4502,7 @@ if (((!node.conn) || (node.conn == 0)) && (node.mtype != 3)) { icon += ' gray'; } if (view == 1) { - div.innerHTML = '
    ' + name + '
    ' + NodeStateStr(node) + '
    ' + devNotify; + div.innerHTML = '
    ' + name + '
    ' + NodeStateStr(node) + '
    ' + devNotify; } else if (view == 2) { var states = []; if (node.conn) { @@ -4905,7 +4531,7 @@ } } - if (node.desc && (deviceViewSettings.devsCols.indexOf('desc') >= 0)) { name = '
    ' + EscapeHtml(node.desc) + '
    ' + name + '
    '; } + if (node.desc && (deviceViewSettings.devsCols.indexOf('desc') >= 0)) { name = '
    ' + EscapeHtml(node.desc) + '
    ' + name + '
    '; } var collapseName = node.meshid; if (sort == 1) { collapseName = ('pwr:' + (node.pwr?node.pwr:0)); } @@ -4913,9 +4539,9 @@ var collapsed = (sort != 3) & (sort != 4) & CollapsedGroups[collapseName]; var r = '
    '; r += '
    '; - r += '
    '; + r += '
    '; r += '
    '; - r += '
    ' + name + '
    ' + devNotify + '
    ' + EscapeHtml(node.osdesc?node.osdesc:''); } } - if (deviceViewSettings.devsCols.indexOf('tags') >= 0) { // Tags - r += ''; - var groupingTags = ''; - if (node.tags != null) { - for (var i in node.tags) { - groupingTags += '' + EscapeHtml(node.tags[i]) + ' '; - } - } - r += '' + groupingTags + ''; - } - if (deviceViewSettings.devsCols.indexOf('windowsav') >= 0) { // Windows AV - r += '' + ((node.wsc && node.wsc.antiVirus != null) ? (node.wsc.antiVirus == 'OK' ? '' + "OK" + '' : '' + "BAD" + '') : ""); - } - if (deviceViewSettings.devsCols.indexOf('windowsupdate') >= 0) {// Windows Update - r += '' + ((node.wsc && node.wsc.autoUpdate != null) ? (node.wsc.autoUpdate == 'OK' ? '' + "OK" + '' : '' + "BAD" + '') : ""); - } - if (deviceViewSettings.devsCols.indexOf('windowsfirewall') >= 0) { // Windows Firewall - r += '' + ((node.wsc && node.wsc.firewall != null) ? (node.wsc.firewall == 'OK' ? '' + "OK" + '' : '' + "BAD" + '') : ""); - } - if (deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0) { // Last Boot Up Time - r += '' + ((node.lastbootuptime != null) ? printDateTime(new Date(node.lastbootuptime)) : ""); - } if (deviceViewSettings.devsCols.indexOf('links') >= 0) { r += '' + getShortRouterLinks(node); } // Links if (deviceViewSettings.devsCols.indexOf('user') >= 0) { r += '' + getUserShortStr(node); } // User if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { var ip = ''; if (node.mtype == 3) { ip = node.host; } else if (node.ip) { ip = node.ip; } r += '' + ip; } // IP address if (deviceViewSettings.devsCols.indexOf('conn') >= 0) { r += '' + states.join(' + '); } // Connectivity if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) { r += ''; if (node.conn > 0) { r += "Connected"; } else if (node.lastconnect != null) { r += printDateTime(new Date(node.lastconnect)); } } - if (deviceViewSettings.devsCols.indexOf('amthost') >= 0) { r += '' + (((node.intelamt == null) || (node.intelamt.host == null)) ? '' : EscapeHtml(node.intelamt.host)); } - if (deviceViewSettings.devsCols.indexOf('amtstate') >= 0) { - var amtstate = ''; - if (node.intelamt) { - if (node.intelamt.state == 0) { amtstate = ' ' + "Pre" + ''; } - if (node.intelamt.state == 1) { amtstate = ' ' + "In" + ''; } - if ((node.intelamt.state == 2) && node.intelamt.flags) { if (node.intelamt.flags & 2) { amtstate = ' ' + "CCM" + ''; } else if (node.intelamt.flags & 4) { amtstate += ' ' + "ACM" + ''; } } - } - r += '' + amtstate; - } div.innerHTML = r; } else if ((view == 3) || (view == 5)) { // Draw the device and canvas - var r = '
    ' + devNotify; + var r = '
    ' + devNotify; //r += ''; r += '
     ' + name + '
    '; - r += '
    ' + "Disconnected" + '
    '; + r += '
    ' + "Disconnected" + '
    '; r += '
    '; return r; } @@ -5052,7 +4646,7 @@ function closeDeviceHelpRequest(appid, nodeid) { setDialogMode(0); - meshserver.send({ action: 'msg', type: 'localapp', nodeid: decodeURIComponent(nodeid), appid: decodeURIComponent(appid), value: { cmd: 'cancelhelp' } }); + meshserver.send({ action: 'msg', type: 'localapp', nodeid: decodeURIComponent(nodeid), appid: decodeURIComponent(appid), value: { cmd: "cancelhelp" } }); } // Show currently active sessions on this device @@ -5218,32 +4812,7 @@ } function disconnectAllKvmFunction() { if (xxdialogMode) return false; for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; } function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} } - function onDeviceSearchChanged(e) { - var url = new URL(window.location.href); - if ((e != null) && ((e.target.id == 'SearchInput') || (e.target.id == 'KvmSearchInput'))){ // search box changed or cleared - if (e.target.id == 'SearchInput') { - Q('KvmSearchInput').value = Q('SearchInput').value; - } else { - Q('SearchInput').value = Q('KvmSearchInput').value; - } - if (e.target.value != '') { - url.searchParams.set('filter', e.target.value); - if (urlargs.filter) { urlargs.filter = e.target.value; } - } else { - url.searchParams.delete('filter'); - if (urlargs.filter) { delete urlargs.filter; } - } - } else if ((e != null) && (e.target.id == 'DevFilterSelect')){ // devfilter box changed - // DO NOTHING - } else { - url.searchParams.delete('filter'); - if (urlargs.filter) { delete urlargs.filter; } - } - if (((features & 0x10000000) == 0) && (xxcurrentView > 0)) { - try { window.history.replaceState({}, document.title, decodeURIComponent(url.toString())); } catch(ex) { } - } - mainUpdate(5); - } + function onDeviceSearchChanged(e) { if (e != null) { if (e.target.id == 'SearchInput') { Q('KvmSearchInput').value = Q('SearchInput').value; } else { Q('SearchInput').value = Q('KvmSearchInput').value; } } mainUpdate(5); } function showMultiDesktopSettings() { QV('td7amtkvm', false); @@ -5252,7 +4821,6 @@ QV('d7desktopOtherSettings', false); d7bitmapquality.value = multidesktopsettings.quality; d7bitmapscaling.value = multidesktopsettings.scaling; - d7encoding.value = multidesktopsettings.agentencoding; if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 100; } setDialogMode(7, "Remote Desktop Settings", 3, showMultiDesktopSettingsChanged); } @@ -5261,10 +4829,9 @@ multidesktopsettings.quality = d7bitmapquality.value; multidesktopsettings.scaling = d7bitmapscaling.value; multidesktopsettings.framerate = d7framelimiter.value; - multidesktopsettings.agentencoding = d7encoding.value; localStorage.setItem('multidesktopsettings', JSON.stringify(multidesktopsettings)); // Make changes to all current connections - for (var i in multiDesktop) { multiDesktop[i].m.SendCompressionLevel(multidesktopsettings.agentencoding, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); } + for (var i in multiDesktop) { multiDesktop[i].m.SendCompressionLevel(webpSupport?4:1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); } } function connectMultiDesktop(node, contype) { @@ -5294,10 +4861,9 @@ desk.m.mouseCursorActive(xxcurrentView == 11); desk.shortid = shortid; desk.attemptWebRTC = attemptWebRTC; - desk.webrtcconfig = webrtcconfiguration; desk.onStateChanged = onMultiDesktopStateChange; //desk.onConsoleMessageChange = function () { console.log('CONSOLEMSG:', desk.consoleMessage); } - desk.m.ImageType = multidesktopsettings.agentencoding; // Send 4 if WebP is supported, otherwise send 1 for JPEG. + desk.m.ImageType = webpSupport?4:1; // Send 4 if WebP is supported, otherwise send 1 for JPEG. desk.m.CompressionLevel = multidesktopsettings.quality; desk.m.ScalingLevel = multidesktopsettings.scaling; if (multidesktopsettings.framerate) { desk.m.FrameRateTimer = multidesktopsettings.framerate; } @@ -5380,35 +4946,6 @@ return false; } - // Intel AMT device import for a device group - // function showAmtImport(meshid) { - // if (xxdialogMode) return false; - // var x = '
    '; - // setDialogMode(2, "Import Intel AMT devices", 3, p5uploadFileEx, x); - // p5updateUploadDialogOk('amtImportInput'); - // } - - function showAmtImport(meshid) { - if (xxdialogMode) return; - var x = "Create many Intel® AMT device at once by importing a JSON file with the following format:" + '
    [\r\n  {\r\n    "fqdn":"mycomputer.com",\r\n    "uuid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",\r\n    "version":"12.0.1",\r\n    "username":"admin",\r\n    "password":"password",\r\n    "tls":true\r\n  }\r\n]
    '; - setDialogMode(2, "Intel® AMT Device Import", 3, showAmtImportEx, x, meshid); - QE('idx_dlgOkButton', false); - } - - function showAmtImportValidate() { - QE('idx_dlgOkButton', Q('d4importFile').value != null); - } - - function showAmtImportEx(b, meshid) { - var fr = new FileReader(); - fr.onload = function (r) { - var j = null; - try { j = JSON.parse(r.target.result); } catch (ex) { setDialogMode(2, "Intel® AMT Device Import", 1, null, format("Invalid JSON file: {0}.", ex)); return; } - if (j != null) { meshserver.send({ action: 'importamtdevices', meshid: meshid, amtdevices: j }); } else { setDialogMode(2, "Intel® AMT Device Import", 1, null, "Invalid JSON file format."); } - }; - fr.readAsText(Q('d4importFile').files[0]); - } - // Intel AMT activation and configuration for agentless device groups function showAmtSetup(meshid) { if (xxdialogMode) return false; @@ -5440,7 +4977,7 @@ x += addHtmlValue("New Password*", ''); x += addHtmlValue("New Password*", ''); if ((features2 & 0x00000020) && (currentMesh.mtype == 1) && (serverinfo.amtProvServerMeshId == currentMesh._id)) { x += ''; } // Intel AMT LAN provisioning server is active. - x += '
    ' + "* 8-16 characters, 1 upper, 1 lower, 1 numeric, 1 non-alpha numeric." + '
    '; + x += '
    ' + "* 8 characters, 1 upper, 1 lower, 1 numeric, 1 non-alpha numeric." + '
    '; setDialogMode(2, "Intel® AMT ACM", 3, showAmtAcmSetupEx, x); Q('dp1password0').focus(); validateAmtAcmSetupEx(); @@ -5556,7 +5093,7 @@ } x += '
    ' + format("Invite someone to install the mesh agent by sharing an invitation link. This link points the user to installation instructions for the \"{0}\" device group. The link is public and no account for this server is needed.", EscapeHtml(mesh.name)) + '

    '; x += addHtmlValue("Link Expiration", ''); - x += addHtmlValue("Agents", ''); + x += addHtmlValue("Agents", ''); x += '
    '; x += addHtmlValue("Installation Type", ''); x += '
    '; @@ -5585,8 +5122,6 @@ function d2CopyInviteToClip() { copyTextToClip(Q('agentInvitationLink').href); } - function d2CopySecretToClip() { copyTextToClip(Q('d2optsecret').getAttribute('secret')); } - function validateAgentInvite() { if ((features & 64) && (Q('d2InviteType').value == 1)) { QE('idx_dlgOkButton', checkEmail(Q('agentInviteEmail').value)); @@ -5610,7 +5145,7 @@ var opts = ''; + opts += ''; x += addHtmlValue("Operating System", opts); var servername = serverinfo.name; @@ -5619,8 +5154,8 @@ if (serverinfo.https == true) { portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port); } else { portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port); } // Add Linux/macOS binary installer option - var binaryInstallAgentsOrder = [ 6, 5, 10005, 25, 26, 28, 30, 32, 36, 37, 40, 41, 16, 29 ]; - var binaryInstallAgents = { 6 : 'Linux x86-64', 5 : 'Linux x86-32', 10005 : 'Apple OSX Universal', 25 : 'Linux ARM-HF, Rasberry Pi', 26 : 'Linux ARM64-HF', 28: 'Linux MIPS24KC (OpenWRT)', 30 : 'FreeBSD x86-64', 32: 'Linux ARM 64 bit (glibc/2.24 NOKVM)', 36: 'OpenWRT x86-64', 37: 'OpenBSD x86-64', 40: 'Linux MIPSEL24KC (OpenWRT)', 41: 'ARMADA/CORTEX-A53/MUSL (OpenWRT)', 16: 'Apple macOS x86-64', 29: 'Apple macOS ARM-64' }; + var binaryInstallAgentsOrder = [ 6, 5, 10005, 25, 26, 28, 30, 32, 37, 40, 41 ]; + var binaryInstallAgents = { 5 : 'Linux x86-32', 6 : 'Linux x86-64', 10005 : 'Apple OSX Universal', 25 : 'Linux ARM-HF, Rasberry Pi', 26 : 'Linux ARM64-HF', 28: 'Linux MIPS24KC (OpenWRT)', 30 : 'FreeBSD x86-64', 32: 'Linux ARM 64 bit (glibc/2.24 NOKVM)', 36: 'OpenWRT x86-64', 37: 'OpenBSD x86-64', 40: 'Linux MIPSEL24KC (OpenWRT)', 41: 'ARMADA/CORTEX-A53/MUSL (OpenWRT)' }; for (var i in binaryInstallAgentsOrder) { moreoptions += '' } x += '
    '; x += addHtmlValue("System Type", ''); @@ -5639,9 +5174,8 @@ // Windows agent install x += '
    ' + format("To add a new computer to device group \"{0}\", download the mesh agent and install it the computer to manage. This agent has server and device group information embedded within it.", EscapeHtml(mesh.name)) + '

    '; - x += addHtmlValue("Mesh Agent", '' + "Windows x86-32 (.exe)" + ' ' + "Windows x86-64 (.exe)" + ' ' + "Windows ARM-64 (.exe)" + ' ' + "Windows (.exe)" + ' ' + "Windows x64 (.exe)" + ' ' + format("{0} settings (.msh)", EscapeHtml(mesh.name)) + ''); } x += '
    '; @@ -5652,19 +5186,11 @@ // macOS agent install x += ''; // QR code agent install - x += '' + x += ''; // MeshCentral Assistant x += '
    '; - x += addDetailItem('' + "DNS Servers" + '', hardware.network.dns.join(", ")); - x += '
    '; if (x != '') { sections.push({ name: "Networking", html: x, img: 'networking64.png'}); } @@ -12293,8 +11245,6 @@ if (node.intelamt != null) { var x = ''; x += addDetailItem("Version", (node.intelamt.ver)?('v' + EscapeHtml(node.intelamt.ver)):('' + "Unknown" + ''), s); - var hardwareidentifier = hardware.identifiers && hardware.identifiers.product_uuid; - x += addDetailItem("Identifier", (node.intelamt.uuid) ? (EscapeHtml(node.intelamt.uuid)) : (hardwareidentifier ? EscapeHtml(hardwareidentifier) : '' + "Unknown" + ''), s); var provisioningStates = { 0: nobreak("Not Activated"), 1: nobreak("Pre-activation"), 2: nobreak("Activated") }; var provisioningMode = ''; if ((node.intelamt.state == 2) && node.intelamt.flags) { if (node.intelamt.flags & 2) { provisioningMode = (', ' + "Client Control Mode (CCM)"); } else if (node.intelamt.flags & 4) { provisioningMode = (', ' + "Admin Control Mode (ACM)"); } } @@ -12316,8 +11266,6 @@ // BIOS if (ident.bios_vendor) { x += addDetailItem("Vendor", EscapeHtml(ident.bios_vendor), s); } if (ident.bios_version) { x += addDetailItem("Version", EscapeHtml(ident.bios_version), s); } - if (ident.bios_serial) { x += addDetailItem("Serial", EscapeHtml(ident.bios_serial), s); } - if (ident.bios_mode) { x += addDetailItem("Mode", EscapeHtml(ident.bios_mode), s); } if (x != '') { sections.push({ name: "BIOS", html: x, img: 'chip64.png' }); } // Motherboard @@ -12332,18 +11280,6 @@ if (x != '') { sections.push({ name: "Motherboard", html: x, img: 'motherboard64.png'}); } } - // TPM - if (hardware.tpm) { - var x = '', tpm = hardware.tpm; - if (tpm.SpecVersion) { x += addDetailItem("SpecVersion", parseFloat(EscapeHtml(tpm.SpecVersion)).toFixed(1), s); } - if (tpm.ManufacturerId) { x += addDetailItem("ManufacturerId", EscapeHtml(tpm.ManufacturerId), s); } - if (tpm.ManufacturerVersion) { x += addDetailItem("ManufacturerVersion", EscapeHtml(tpm.ManufacturerVersion), s); } - if (tpm.IsActivated != null) { x += addDetailItem("IsActivated", (tpm.IsActivated ? "Yes" : "No"), s); } - if (tpm.IsEnabled != null) { x += addDetailItem("IsEnabled", (tpm.IsEnabled ? "Yes" : "No"), s); } - if (tpm.IsOwned != null) { x += addDetailItem("IsOwned", (tpm.IsOwned ? "Yes" : "No"), s); } - if (x != '') { sections.push({ name: "TPM", html: x, img: 'tpm64.png'}); } - } - if (hardware.windows) { if (hardware.windows.memory && (hardware.windows.memory.length > 0)) { var x = ''; @@ -12354,7 +11290,7 @@ for (var i in hardware.windows.memory) { var m = hardware.windows.memory[i]; x += '
    '; - x += '
    ' + EscapeHtml((m.BankLabel ? m.BankLabel : (m.DeviceLocator ? m.DeviceLocator : 'Unknown'))) + '
    '; + x += '
    ' + EscapeHtml(m.BankLabel) + '
    '; if (m.Capacity && m.Speed) { x += addDetailItem("Capacity / Speed", format("{0} Mb, {1} Mhz", (m.Capacity / 1024 / 1024), m.Speed), s); } else if (m.Capacity) { x += addDetailItem("Capacity", format("{0} Mb", (m.Capacity / 1024 / 1024)), s); } if (m.PartNumber) { x += addDetailItem("Part Number", EscapeHtml((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + EscapeHtml(m.PartNumber), s); } @@ -12366,48 +11302,6 @@ } } - if (hardware.linux) { - if (hardware.linux.memory && (hardware.linux.memory.Memory_Device.length > 0)) { - var x = ''; - // Sort Memory - hardware.linux.memory.Memory_Device.sort(function(a, b) { if (a.Locator > b.Locator) return 1; if (a.Locator < b.Locator) return -1; return 0; }); - - x += ''; - for (var i in hardware.linux.memory.Memory_Device) { - var m = hardware.linux.memory.Memory_Device[i]; - if(m.Size && (m.Size == 'No Module Installed')) continue; - x += '
    '; - x += '
    ' + EscapeHtml((m.Locator ? m.Locator : 'Unknown')) + '
    '; - if (m.Size && m.Speed) { x += addDetailItem("Capacity / Speed", format("{0}, {1}", m.Size, m.Speed), s); } - else if (m.Size) { x += addDetailItem("Capacity", format("{0}", (m.Size)), s); } - if (m.PartNumber) { x += addDetailItem("Part Number", EscapeHtml((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + EscapeHtml(m.PartNumber), s); } - x += '
    '; - } - x += '
    '; - - if (x != '') { sections.push({ name: "Memory", html: x, img: 'ram64.png'}); } - } - } - - if (hardware.darwin) { - if (hardware.darwin.memory && (hardware.darwin.memory.length > 0)) { - var x = ''; - x += ''; - for (var i in hardware.darwin.memory) { - var m = hardware.darwin.memory[i]; - if(m.Size && (m.Size == 'No Module Installed')) continue; - x += '
    '; - x += '
    ' + EscapeHtml((m.DeviceLocator ? m.DeviceLocator : 'Unknown')) + '
    '; - if (m.Size && m.Speed) { x += addDetailItem("Capacity / Speed", format("{0}, {1}", m.Size, m.Speed), s); } - else if (m.Size) { x += addDetailItem("Capacity", format("{0}", (m.Size)), s); } - if (m.PartNumber) { x += addDetailItem("Part Number", EscapeHtml((m.Manufacturer && m.Manufacturer != '')?(m.Manufacturer + ', '):'') + EscapeHtml(m.PartNumber), s); } - x += '
    '; - } - x += '
    '; - if (x != '') { sections.push({ name: "Memory", html: x, img: 'ram64.png'}); } - } - } - // Storage if (hardware.identifiers && hardware.identifiers.storage_devices) { var x = ''; @@ -12426,10 +11320,6 @@ if (typeof m.Size == 'number') { x += addDetailItem("Capacity", format("{0} Mb", Math.floor(m.Size / 1024 / 1024)), s); } if (typeof m.Size == 'string') { x += addDetailItem("Capacity", EscapeHtml(m.Size), s); } } - if(hardware.windows && hardware.windows.drives && m.Model){ - const foundObject = hardware.windows.drives.find(obj => obj['Model'] === m.Model); - if(foundObject && foundObject.Status) x += addDetailItem("Status", EscapeHtml(foundObject.Status), s); - } x += '
    '; } } @@ -12438,101 +11328,6 @@ if (x != '') { sections.push({ name: "Storage", html: x, img: 'storage64.png'}); } } - // Volumes and Bitlocker - if (hardware.windows && hardware.windows.volumes) { - var x = ''; - for (var i in hardware.windows.volumes) { - var m = hardware.windows.volumes[i]; - x += '
    '; - x += '
    ' + i + ':' + (((m.name == null) || (m.name == '')) ? '' : (' - ' + EscapeHtml(m.name))) + '
    '; - if (m.size) { - var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.size} ${sizes[j]}` : `${(m.size / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - x += addDetailItem("Capacity", EscapeHtml(fsize), s); - } - if (m.sizeremaining) { - var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.sizeremaining)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.sizeremaining} ${sizes[j]}` : `${(m.sizeremaining / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s); - } - if (m.type) { - var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : '')); - x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s); - } - - if (m.protectionStatus || m.volumeStatus) { - var bitlockerState = []; - if (m.protectionStatus) bitlockerState.push("Enabled"); - if (m.volumeStatus && m.volumeStatus == 'FullyDecrypted') bitlockerState.push("Fully Decrypted"); - if (m.volumeStatus && m.volumeStatus == 'EncryptionInProgress') bitlockerState.push("Encryption In Progress"); - if (m.volumeStatus && m.volumeStatus == 'FullyEncrypted') bitlockerState.push("Fully Encrypted"); - bitlockerState = bitlockerState.join(' - '); - if (m.recoveryPassword) { bitlockerState += addKeyLink('', 'deviceDetailsShowBitlockerInfo(\"' + encodeURIComponentEx(i) + '\",\"' + encodeURIComponentEx(m.identifier) + '\",\"' + encodeURIComponentEx(m.recoveryPassword) + '\")'); } - x += addDetailItem("BitLocker", bitlockerState, s); - } - x += '
    '; - } - if (x != '') { sections.push({ name: "Storage Volumes", html: '' + x + '
    ', img: 'storage64.png'}); } - } - - // Linux Volumes - if (hardware.linux && hardware.linux.volumes) { - var x = ''; - for (var i in hardware.linux.volumes) { - var m = hardware.linux.volumes[i]; - if(m.mount_point.startsWith('/var/lib/docker/overlay2')) continue; - x += '
    '; - x += '
    ' + m.mount_point + '
    '; - if (m.size) { - var sizes = ['KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.size} ${sizes[j]}` : `${(m.size / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - x += addDetailItem("Capacity", EscapeHtml(fsize), s); - } - if (m.available) { - if (Math.abs(m.available) == 0) { - var fsize = `0 KB`; - } else { - var sizes = ['KB', 'MB', 'GB', 'TB']; - var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10); - var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`); - } - x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s); - } - if (m.type) { - var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : '')); - x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s); - } - x += '
    '; - } - if (x != '') { sections.push({ name: "Storage Volumes", html: '' + x + '
    ', img: 'storage64.png'}); } - } - - // MacOS Volumes - if (hardware.darwin && hardware.darwin.volumes) { - var x = ''; - for (var i in hardware.darwin.volumes) { - var m = hardware.darwin.volumes[i]; - if(m.mount_point.startsWith('/var/lib/docker/overlay2')) continue; - x += '
    '; - x += '
    ' + m.mount_point + '
    '; - if (m.size) { - x += addDetailItem("Capacity", EscapeHtml(m.size), s); - } - if (m.available) { - x += addDetailItem("Capacity Remaining", EscapeHtml(m.available), s); - } - if (m.type) { - var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : '')); - x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s); - } - x += '
    '; - } - if (x != '') { sections.push({ name: "Storage Volumes", html: '' + x + '
    ', img: 'storage64.png'}); } - } - // Render the sections var x = ''; for (var i in sections) { @@ -12553,13 +11348,6 @@ } } - function deviceDetailsShowBitlockerInfo(drive, identifier, password) { - if (xxdialogMode) return false; - var x = '

    ' + "Identifier" + '

    ' + (identifier ? decodeURIComponent(identifier) : "Unknown") + '

    '; - x += '

    ' + "Recovery Password" + '

    ' + (password ? decodeURIComponent(password) : "Unknown") + '

    '; - setDialogMode(2, decodeURIComponent(drive) + ': ' + "BitLocker Information", 1, null, x, ''); - } - // // CONSOLE // @@ -12744,19 +11532,7 @@ if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'default' }); } // Upload default core else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'clear' }); } // Clear the core else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file - else { - var htmlValue = ''; - setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", htmlValue)); - } + else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '')); } } function p15uploadCoreEx() { @@ -12781,12 +11557,6 @@ } else if (Q('d3coreMode').value == 7) { // Upload a tiny core meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type:'tiny' }); - } else if (Q('d3coreMode').value == 8) { - // Restart MeshAgent service - meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' }); - } else if (Q('d3coreMode').value == 9) { - // Update mesh agent - meshserver.send({ action: 'updateAgents', nodeids: [ consoleNode._id ] }); } } @@ -12861,7 +11631,7 @@ function account_manageImageEx2(b, userid) { // Send updated image, or 0 if we pressed the delete button - meshserver.send({ action: 'updateUserImage', userid: userid, image: (b == 2)?0:Q('p2canvas').toDataURL(Q('p2file').files[0].type) }); + meshserver.send({ action: 'updateUserImage', userid: userid, image: (b == 2)?0:Q('p2canvas').toDataURL('image/jpeg', 0.8) }); //meshserver.send({ action: 'updateUserImage', image: (b == 2)?0:Q('p2canvas').toDataURL('image/png', 0.8) }); } @@ -12870,7 +11640,7 @@ var x; if (userinfo.phone != null) { x = ' - - - - - - - -
    '; - x += '
    ' + "Verified phone number" + '
    ' + EscapeHtml(userinfo.phone) + '
    '; + x += '
    ' + "Verified phone number" + '
    ' + userinfo.phone + '
    '; x += '
    '; setDialogMode(2, "Phone Notifications", 3, account_managePhoneRemove, x); account_managePhoneRemoveValidate(); @@ -12892,63 +11662,6 @@ function account_managePhoneRemove() { if (Q('d2delPhone').checked) { meshserver.send({ action: 'removePhone' }); } } function account_managePhoneRemoveValidate() { QE('idx_dlgOkButton', Q('d2delPhone').checked); } - function account_manageMessaging() { - if (xxdialogMode || ((features2 & 0x02000000) == 0)) return; - var x; - if (userinfo.msghandle != null) { - x = ' - - - - - - - -
    '; - x += '
    ' + "Verified handle" + '
    ' + EscapeHtml(userinfo.msghandle) + '
    '; - x += '
    '; - setDialogMode(2, "Messaging Notifications", 3, account_manageMessagingRemove, x); - account_managePhoneRemoveValidate(); - } else { - x = ' - - - - - - - - -
    - - - -
    - - - - - -
    - - - -
    -
    - - - -
    -
    - - - - -
    - -
    '; - x += '' + "Enter your messaging service and handle. Once verified, this server can send you login verification and other notifications." + '

    '; - var y = ''; - x += '
    ' + "Service" + '' + y; - x += '
    ' + "Handle" + ''; - x += '
    '; - if (serverinfo.discordUrl) { x += ''; } - x += ''; - x += ''; - console.log(serverinfo.userMsgNftyUrl); - x += ''; - x += ''; - setDialogMode(2, "Messaging Notifications", 3, account_manageMessagingAdd, x, 'verifyMessaging'); - Q('d2handleinput').focus(); - account_manageMessagingValidate(); - } - } - - function account_manageMessagingValidate(x) { - if (serverinfo.discordUrl) { QV('d2discordurl', Q('d2serviceselect').value == 4); } - QV('d2callmebotinfo', Q('d2serviceselect').value == 16); - QV('d2pushoverinfo', Q('d2serviceselect').value == 32); - QV('d2ntfyinfo', Q('d2serviceselect').value == 64); - QV('d2slackinfo', Q('d2serviceselect').value == 256); - if (Q('d2serviceselect').value == 4) { Q('d2handleinput')['placeholder'] = "Username:0000"; } - else if (Q('d2serviceselect').value == 8) { Q('d2handleinput')['placeholder'] = "username@server.com"; } - else if (Q('d2serviceselect').value == 16) { Q('d2handleinput')['placeholder'] = "https://api.callmebot.com/..."; } - else if (Q('d2serviceselect').value == 32) { Q('d2handleinput')['placeholder'] = "User key"; } - else if (Q('d2serviceselect').value == 64) { Q('d2handleinput')['placeholder'] = "Topic"; } - else if (Q('d2serviceselect').value == 128) { Q('d2handleinput')['placeholder'] = "username@sample.com"; } - else if (Q('d2serviceselect').value == 256) { Q('d2handleinput')['placeholder'] = "https://hooks.slack.com/..."; } - else { Q('d2handleinput')['placeholder'] = "Username"; } - var ok = (Q('d2handleinput').value.length > 0); QE('idx_dlgOkButton', ok); if ((x == 1) && ok) { dialogclose(1); } - } - function account_manageMessagingAdd() { if (Q('d2handleinput').value.length == 0) return; QE('d2handleinput', false); meshserver.send({ action: 'verifyMessaging', service: Q('d2serviceselect').value, handle: Q('d2handleinput').value }); } - function account_manageMessagingConfirm(b, tag) { meshserver.send({ action: 'confirmMessaging', code: Q('d2phoneCodeInput').value, cookie: tag }); } - function account_manageMessagingRemove() { if (Q('d2delPhone').checked) { meshserver.send({ action: 'removeMessaging' }); } } - function account_manageAuthEmail() { if (xxdialogMode || ((features & 0x00800000) == 0)) return; var emailU2Fenabled = ((userinfo.otpekey == 1) && (userinfo.email != null) && (userinfo.emailVerified == true)); @@ -12957,25 +11670,6 @@ }, "When enabled, on each login, you will be given the option to receive a login token to you email account for added security." + '

    '); } - function account_manageAuthDuo() { - if (xxdialogMode || ((features2 & 0x20000000) == 0)) return; - var duoU2Fenabled = ((userinfo.otpduo == 1)); - if (duoU2Fenabled == false) { - setDialogMode(2, "Duo Authentication", 3, function () { - window.location.href = '/add-duo?rurl=' + encodeURIComponentEx(window.location.href) + ((urlargs.key)?('&key=' + urlargs.key):''); - }, "Confirm enabling of Duo 2FA login security. Once enabled you will be given the option to use Duo at login for added security. Click ok to go thru the steps to enable Duo." + '

    '); - } else { - setDialogMode(2, "Duo Authentication", 3, function () { - meshserver.send({ action: 'otpduo', enabled: false }); - }, '

    ' + '

    '); - QE('idx_dlgOkButton', false); - } - } - - function account_manageAuthDuoConfirm() { - QE('idx_dlgOkButton', Q('duo2facheck').checked); - } - function account_manageAuthApp() { if (xxdialogMode || ((features & 4096) == 0)) return; if (userinfo.otpsecret == 1) { account_removeOtp(); } else { account_addOtp(); } @@ -13473,7 +12167,7 @@ function server_showRestoreDlg() { if (xxdialogMode) return false; - var x = "Restore the server using a backup," + ' ' + "this will delete the existing server data." + ' ' + "Only do this if you know what you are doing." + '

    '; + var x = "Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing." + '

    '; x += '
    '; x += ''; x += '

    '; @@ -13511,7 +12205,7 @@ function server_showErrorsDlg() { if (xxdialogMode) return false; - setDialogMode(2, "Server Errors", 1, null, "Loading...", 'MeshCentralServerErrors'); + setDialogMode(2, "MeshCentral Errors", 1, null, "Loading...", 'MeshCentralServerErrors'); meshserver.send({ action: 'servererrors' }); return false; } @@ -13519,14 +12213,6 @@ function server_showErrorsDlgEx() { meshserver.send({ action: 'serverclearerrorlog' }); } function d2CopyServerErrorsToClip() { saveAs(new Blob([Q('d2ServerErrorsLogPre').innerText], { type: 'application/octet-stream' }), "servererrors.txt"); } - function server_showConfigDlg() { - if (xxdialogMode) return false; - setDialogMode(2, "Server Configuration", 1, null, "Loading...", 'MeshCentralServerConfig'); - meshserver.send({ action: 'serverconfig' }); - return false; - } - function d2CopyServerConfigToClip() { saveAs(new Blob([Q('d2ServerConfigPre').innerText], { type: 'application/octet-stream' }), "config.json"); } - // // MY MESHS // @@ -13622,14 +12308,8 @@ if (meshNotify & 4) { meshNotifyStr.push("Disconnect"); } if (meshNotify & 8) { meshNotifyStr.push("Intel® AMT"); } if ((features2 & 0x00004000) && (userinfo.emailVerified)) { - var xx = 0; - if (meshNotify & 16) { xx++; } if (meshNotify & 32) { xx++; } if (meshNotify & 64) { xx++; } - if (xx > 0) { meshNotifyStr.push(format("Email ({0})", xx)); } - } - if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) { - var xx = 0; - if (meshNotify & 128) { xx++; } if (meshNotify & 256) { xx++; } if (meshNotify & 512) { xx++; } - if (xx > 0) { meshNotifyStr.push(format("Messaging ({0})", xx)); } + if (meshNotify & 16) { meshNotifyStr.push("Email Connect"); } + if (meshNotify & 32) { meshNotifyStr.push("Email Disconnect"); } } if (meshNotifyStr.length == 0) { meshNotifyStr.push('' + "None" + ''); } x += addHtmlValue("Notifications", addLink(meshNotifyStr.join(', '), 'p20editMeshNotify()')); @@ -13671,7 +12351,7 @@ if (usergroups != null) { var userGroupCount = 0, newUserGroup = false; for (var i in usergroups) { - if ((usergroups[i].membershipType != null) || (usergroups[i]._id.split('/')[1] != currentMesh._id.split('/')[1])) continue; + if (usergroups[i]._id.split('/')[1] != currentMesh._id.split('/')[1]) continue; userGroupCount++; if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { newUserGroup = true; } } @@ -13681,7 +12361,6 @@ //if (meshrights & 4) { } if (currentMesh.mtype == 1) { - if (meshrights & 1) { x += ' ' + "Import" + ''; } /* if ((features & 1) == 0) { // If not WAN-Only x += ' ' + "Install local" + ''; @@ -13742,7 +12421,7 @@ var dshare = deviceShares[i], trash = ''; if (dshare.url != null) { trash += ' '; } trash += ''; - var type = ''; if (dshare.p <= 7) { type = ['', "Terminal", "Desktop", "Desktop + Terminal", "Files", "Terminal + Files", "Desktop + Files", "Desktop + Terminal + Files"][dshare.p]; } else if (dshare.p == 8) { type = "HTTP/" + dshare.port; } else if (dshare.p == 16) { type = "HTTPS/" + dshare.port; } + var type = ['', "Terminal", "Desktop", "Desktop + Terminal", "Files", "Terminal + Files", "Desktop + Files", "Desktop + Terminal + Files"][dshare.p]; var details = type; if ((dshare.startTime != null) && (dshare.expireTime != null)) { details = format("{0}, {1} to {2}", type, printFlexDateTime(new Date(dshare.startTime)), printFlexDateTime(new Date(dshare.expireTime))); } if ((dshare.startTime != null) && (dshare.duration != null)) { @@ -13879,7 +12558,7 @@ p20editMeshAmtChange(); // Set the current Intel AMT policy - if (currentMesh.amt && ((currentMesh.amt.type == 2) || (currentMesh.amt.type == 3))) { + if (currentMesh.amt && (currentMesh.amt.type == 2) || (currentMesh.amt.type == 3)) { Q('dp20amtpolicypass').value = currentMesh.amt.password; if ((currentMesh.amt.type == 2) || (currentMesh.amt.type == 3)) { if (currentMesh.amt.badpass != null) { Q('dp20amtbadpass').value = currentMesh.amt.badpass; } @@ -13905,7 +12584,7 @@ x += addHtmlValue("Unknown password", ''); x += '
    '; if ((features & 0x400) == 0) { x += addHtmlValue('' + "CIRA setup" + '', ''); } - x += ' ' + "* 8-16 characters, 1 upper, 1 lower, 1 numeric, 1 non-alpha numeric." + ''; + x += ' ' + "* 8 characters, 1 upper, 1 lower, 1 numeric, 1 non-alpha numeric." + ''; if ((currentMesh.mtype == 2) && (ptype == 2)) { x += ' ' + "This policy will not impact devices with Intel® AMT in ACM mode." + ''; } } if (ptype == 0) { x = '
    ' + "When this policy is selected, Intel® AMT is not managed by this server. Intel AMT can still be used by manually activating and configuring it." + '
    '; } @@ -14144,7 +12823,7 @@ if (selected == null) { var ousergroups = getOrderedList(usergroups, 'name'); for (var i in ousergroups) { - if ((ousergroups[i].membershipType != null) || (currentNode._id.split('/')[1] != ousergroups[i]._id.split('/')[1])) continue; + if (currentNode._id.split('/')[1] != ousergroups[i]._id.split('/')[1]) continue; if ((currentNode.links == null) || (currentNode.links[ousergroups[i]._id] == null)) { y += ''; } } } else { @@ -14186,14 +12865,14 @@ var urights = -1, meshRightsActive = ((userid != 4) && (userid != 5) && (userid != 6) && (userid != 7)); - x += '
    '; + x += '
    '; if (meshRightsActive) { x += '
    '; x += '
    '; x += '
    '; x += '
    '; } - x += '
    '; + x += '
    '; x += '
    '; x += '
    '; if (serverinfo.guestdevicesharing !== false) { x += '
    '; } @@ -14211,7 +12890,6 @@ x += '
    '; x += '
    '; x += '
    '; - x += '
    '; x += '
    '; if (userid == null) { @@ -14289,7 +12967,6 @@ if (urights & 262144) { Q('p20resetoff').checked = true; } if ((urights & 524288) && (serverinfo.guestdevicesharing !== false)) { Q('p20guestshare').checked = true; } if (urights & 1048576) { Q('p20details').checked = true; } - if (urights & 2097152) { Q('p20relay').checked = true; } } p20validateAddMeshUserDialog(userid); @@ -14338,7 +13015,6 @@ Q('p20resetoff').checked = ((devrights & 262144) != 0); if (serverinfo.guestdevicesharing !== false) { Q('p20guestshare').checked = ((devrights & 524288) != 0); } Q('p20details').checked = ((devrights & 1048576) != 0); - Q('p20relay').checked = ((devrights & 2097152) != 0); ok = (nodeid != ''); } @@ -14420,7 +13096,6 @@ QE('p20commands', nc); QE('p20resetoff', nc); QE('p20details', nc); - QE('p20relay', nc); } function p20showAddMeshUserDialogEx(b, t) { @@ -14450,7 +13125,6 @@ if (Q('p20resetoff').checked == true) meshadmin += 262144; if ((serverinfo.guestdevicesharing !== false) && (Q('p20guestshare').checked == true) && (Q('p20remoteview').checked || (!Q('p20remoteview').checked && !Q('p20remotelimitedinput').checked))) meshadmin += 524288; if (Q('p20details').checked == true) meshadmin += 1048576; - if (Q('p20relay').checked == true) meshadmin += 2097152; } // Clean up incorrect rights. If Remote Control is not selected, remove flags that don't make sense. @@ -14536,7 +13210,6 @@ if ((meshrights & 262144) != 0) r.push("Reset/Off"); if ((meshrights & 524288) != 0) r.push("Sharing"); if ((meshrights & 1048576) != 0) r.push("Details"); - if ((meshrights & 2097152) != 0) r.push("Relay"); } if (r.length == 0) { r.push("No Rights"); } var uname = xuserid.split('/')[2]; @@ -14601,7 +13274,7 @@ var x = "Invitation codes can be used by anyone to join devices to this device group using the following public link:" + '

    '; x += '
    '; x += addHtmlValue("Invite Codes", currentMesh.invite.codes.join(', ')); - x += addHtmlValue("Installation Type", ["Background and interactive", "Interactive only", "Background only"][currentMesh.invite.flags & 3]); + x += addHtmlValue("Installation Type", ["Background and interactive", "Background only", "Interactive only"][currentMesh.invite.flags & 3]); setDialogMode(2, "Invite Codes", 1, null, x); } } @@ -14643,13 +13316,6 @@ x += '
    ' + "Email Notifications" + '
    '; x += '
    '; x += '
    '; - x += '
    '; - } - if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) { - x += '
    ' + "Messaging Notifications" + '
    '; - x += '
    '; - x += '
    '; - x += '
    '; } setDialogMode(2, "Notification Settings", 3, p20editMeshNotifyEx, x, emailNotify); Q('p20notifyIntelDeviceConnect').checked = (meshNotify & 2); @@ -14658,12 +13324,6 @@ if (emailNotify) { Q('p20enotifyIntelDeviceConnect').checked = (meshNotify & 16); Q('p20enotifyIntelDeviceDisconnect').checked = (meshNotify & 32); - Q('p20enotifyIntelDeviceHelp').checked = (meshNotify & 64); - } - if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) { - Q('p20emsgDeviceConnect').checked = (meshNotify & 128); - Q('p20emsgDeviceDisconnect').checked = (meshNotify & 256); - Q('p20emsgDeviceHelp').checked = (meshNotify & 512); } return false; } @@ -14676,12 +13336,6 @@ if (emailNotify) { meshNotify += Q('p20enotifyIntelDeviceConnect').checked ? 16 : 0; meshNotify += Q('p20enotifyIntelDeviceDisconnect').checked ? 32 : 0; - meshNotify += Q('p20enotifyIntelDeviceHelp').checked ? 64 : 0; - } - if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) { - meshNotify += Q('p20emsgDeviceConnect').checked ? 128 : 0; - meshNotify += Q('p20emsgDeviceDisconnect').checked ? 256 : 0; - meshNotify += Q('p20emsgDeviceHelp').checked ? 512 : 0; } meshserver.send({ action: 'changemeshnotify', meshid: currentMesh._id, notify: meshNotify }); } @@ -14691,25 +13345,43 @@ // function setupMeshSummaryStats() { + var draw = Chart.controllers.doughnut.prototype.draw; + Chart.controllers.doughnut = Chart.controllers.doughnut.extend({ + draw: function() { + draw.apply(this, arguments); + var ctx = this.chart.chart.ctx; + var _fill = ctx.fill; + ctx.fill = function() { + ctx.save(); + ctx.shadowColor = 'blue'; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 2; + ctx.shadowOffsetY = 2; + _fill.apply(this, arguments) + ctx.restore(); + } + } + }); + window.meshPowerChart = new Chart(document.getElementById('meshPowerChart').getContext('2d'), { type: 'doughnut', data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#40D', '#60B', '#809', '#A07', '#C05'] }] }, - options: { shadowColor: 'blue', responsive: true, plugins: { legend: { display: false } }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } + options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } }); window.meshOsChart = new Chart(document.getElementById('meshOsChart').getContext('2d'), { type: 'doughnut', data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#30E', '#40D', '#50C', '#60B', '#70A', '#809', '#908', '#A07', '#B06', '#C05'] }] }, - options: { responsive: true, plugins: { legend: { display: false } }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } + options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } }); window.meshConnChart = new Chart(document.getElementById('meshConnChart').getContext('2d'), { type: 'doughnut', data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#40D', '#60B', '#809', '#A07', '#C05'] }], labels: ["Not Connected", "Agent", "Intel® AMT", "Agent + Intel® AMT"] }, - options: { responsive: true, plugins: { legend: { display: false } }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } + options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } }); window.meshSecurityChart = new Chart(document.getElementById('meshSecurityChart').getContext('2d'), { type: 'doughnut', data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#40D', '#60B', '#809', '#A07', '#C05'] }], labels: ["OK", "Anti-virus not active", "No automatic update", "Firewall not active", "Multiple Issues"] }, - options: { responsive: true, plugins: { legend: { display: false } }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } + options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true }, layout: { padding: { left: 10, right: 10, top: 10, bottom: 10 } } } }); } @@ -14861,7 +13533,7 @@ fullPath += ' / ' + filetreelocation[i]; if ((folderdepth == 1)) { var sp = filetreelocation[i].split('/'); - publicPath = window.location.origin + domainUrl + sp[0] + 'files/' + sp[2]; + publicPath = (("" + window.location).split('?')[0]) + sp[0] + 'files/' + sp[2]; //if (filetreelocation[i] === userinfo._id) { filetreelinkpath += 'self'; } else { filetreelinkpath += (sp[0] + '/' + sp[2]); } filetreelinkpath += filetreelocation[i]; } else { @@ -14982,11 +13654,10 @@ function p5setActions() { var cc = getFileSelCount(), tc = getFileCount(), sfc = getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders) QE('p5DeleteFileButton', (cc > 0) && (filetreelocation.length > 0)); - QE('p5ViewFileButton', (cc == 1) && (sfc == 1) && (filetreelocation.length > 0)); QE('p5NewFolderButton', filetreelocation.length > 0); QE('p5UploadButton', filetreelocation.length > 0); - QE('p5DownloadButton', (cc > 0) && (cc == sfc) && (filetreelocation.length > 0)); QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0)); + //QE('p5ViewFileButton', (cc == 1) && (sfc == 1) && (filetreelocation.length > 0)); QE('p5SelectAllButton', tc > 0); Q('p5SelectAllButton').value = (cc > 0 ? "Select None" : "Select All"); QE('p5CutButton', (sfc > 0) && (cc == sfc)); @@ -15012,7 +13683,6 @@ var isFilenameValid = (function(){ var x1=/^[^\\/:\*\?"<>\|]+$/, x2=/^\./, x3=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname){ return x1.test(fname)&&!x2.test(fname)&&!x3.test(fname)&&(fname[0] != '.'); } })(); function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); p5updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } - function p5GetFileInfo(name) { var filetreex = filetree; for (var i in filetreelocation) { if ((filetreex.f != null) && (filetreex.f[filetreelocation[i]] != null)) { filetreex = filetreex.f[filetreelocation[i]]; } } return filetreex.f[name]; } function p5updateUploadDialogOk() { // Check if these are files we can upload, remove all folders. var xallfiles = Q('p5uploadinput').files, files = []; @@ -15040,20 +13710,27 @@ } } } + /* function p5viewfile() { var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { - var f = p5GetFileInfo(checkboxes[i].value); if (f == null) return; - if (f.s <= 204800) { meshserver.send({ action: 'fileoperation', fileop: 'get', path: filetreelocation, file: checkboxes[i].value, tag: 'edit' }); } else { messagebox("File Editor", "Only files less than 200k can be edited."); } - return; + console.log(filetreelocation.join('/') + '/' + checkboxes[i].value); // TODO: Download and show this file + break; } } } + */ + var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); - for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '3')) { p5clipboard.push(checkboxes[i].value); } } + for (var i = 0; i < checkboxes.length; i++) { + if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '3')) { + console.log('yy', checkboxes[i].value); + p5clipboard.push(checkboxes[i].value); + } + } p5updateClipview(); } function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confirm {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0?'copy':'move'), p5clipboard.length, ((p5clipboard.length > 1)?'s':'')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); } @@ -15155,16 +13832,6 @@ } } - function p5downloadButton() { - var checkboxes = document.getElementsByName('fc'); - for (var i = 0; i < checkboxes.length; i++) { - if (checkboxes[i].checked) { - var link = 'downloadfile.ashx?link=' + encodeURIComponentEx(filetreelinkpath + '/' + checkboxes[i].value); - downloadFile(link); - } - } - } - /* function p5fileCatchAllInputChanged(e) { p5fileDragLeave(e); @@ -15332,14 +13999,6 @@ 151: "Started Web-VNC session \"{0}\".", // Not in use yet 152: "No longer a relay for \"{0}\".", 153: "Is a relay for \"{0}\".", - 154: "Account changed to sync with LDAP data.", - 155: "Denied user login from {0}, {1}, {2}", - 156: "Verified messaging account of user {0}", - 157: "Removed messaging account of user {0}", - 158: "Displaying alert box, title=\"{0}\", message=\"{1}\"", - 159: "Device Powered On", - 160: "Enabled Duo two-factor authentication", - 161: "Disabled Duo two-factor authentication" }; var eventsShortMessageId = { @@ -15425,11 +14084,7 @@ } function refreshEvents() { - if (p3filterevents.value != "") { - meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value), filter: p3filterevents.value }); - } else { - meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) }); - } + meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) }); } function p3showReportDialog() { @@ -15631,10 +14286,9 @@ if (userdomain != '') { username += ', ' + userdomain + ''; } } - if ((user.otpsecret > 0) || (user.otphkeys > 0) || ((user.otpekey == 1) && (features & 0x00800000)) || (user.otpduo == 1) || ((user.phone != null) && (features & 0x04000000))) { username += ' '; } + if ((user.otpsecret > 0) || (user.otphkeys > 0) || ((user.otpekey == 1) && (features & 0x00800000)) || ((user.phone != null) && (features & 0x04000000))) { username += ' '; } if (user.phone != null) { username += ' '; } if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { username += ' '; } - if ((user.msghandle != null) && (features2 & 0x02000000)) { username += ' '; } x += '
    '; x += '
    '; x += '
    '; @@ -15761,17 +14415,7 @@ function altUserChat(e, userid, name, i) { if (xxdialogMode) return; haltEvent(e); - var url = serverinfo.altmessenging[i].url; - var ruserid = decodeURIComponent(userid); - var userid1 = encodeURIComponentEx(ruserid.split('/')[2]); // userid - var userid2 = encodeURIComponentEx(ruserid.split('/').join('-')); // user-domain-userid - var userid3 = userid1, userid4 = userid2; - var ruser = users[ruserid]; - if ((ruser != null) && (ruser.realname != null)) { - userid3 = encodeURIComponentEx(ruser.realname.split(' ').join('')); // real name with no empty spaces - userid4 = encodeURIComponentEx(ruser.realname.split(' ').join('-')); // real name with - instead of spaces - } - url = url.split('{0}').join(userid1).split('{1}').join(userid2).split('{2}').join(userid3).split('{3}').join(userid4); + var url = serverinfo.altmessenging[i].url.split('{0}').join(userid.split('/').join('-')); if (urlargs.key) { url += '&key=' + urlargs.key; } safeNewWindow(url, 'altmessenger:' + userid); meshserver.send({ action: 'notifyuser', userid: decodeURIComponent(userid), msg: serverinfo.altmessenging[i].name, msgid: 11, url: url }); @@ -15788,15 +14432,6 @@ function showSendSMSValidate() { QE('idx_dlgOkButton', Q('d2smsText').value.length > 0); } function showSendSMSEx(b, tag) { if (Q('d2smsText').value.length > 0) { meshserver.send({ action: 'smsuser', userid: decodeURIComponent(tag), msg: Q('d2smsText').value }); } } - function showSendMessage(userid) { - if (xxdialogMode) return; - setDialogMode(2, "Send Message", 3, showSendMessageEx, '', userid); - Q('d2smsText').focus(); - showSendSMSValidate(); - } - - function showSendMessageEx(b, tag) { if (Q('d2smsText').value.length > 0) { meshserver.send({ action: 'msguser', userid: decodeURIComponent(tag), msg: Q('d2smsText').value }); } } - function showSendEmail(userid) { if (xxdialogMode) return; var x = ''; @@ -15848,12 +14483,7 @@ function p4batchAccountCreate() { if (xxdialogMode) return; - var x = "Create many accounts at once by importing a JSON or CSV file" + '

    '; - x += "JSON file format is as follows:" + '
    '; - x += '
    [\r\n {"user":"x1","pass":"x","email":"x1@x"},\r\n {"user":"x2","pass":"x","resetNextLogin":true}\r\n]

    '; - x += "CSV file format is as follows:" + '
    '; - x += '
    user,pass,email,resetNextLogin\r\nx1,x,x1@x,\r\nx2,x,,true\r\n

    '; - x += ''; + var x = "Create many accounts at once by importing a JSON file with the following format:" + '
    [\r\n {"user":"x1","pass":"x","email":"x1@x"},\r\n {"user":"x2","pass":"x","resetNextLogin":true}\r\n]
    '; setDialogMode(2, "User Account Import", 3, p4batchAccountCreateEx, x); QE('idx_dlgOkButton', false); } @@ -15866,60 +14496,17 @@ var fr = new FileReader(); fr.onload = function (r) { var j = null; - if (Q('d4importFile').value.endsWith('.csv')) { - const csvData = r.target.result; - const lines = csvData.split('\n'); - const headers = lines[0].trim().split(','); - const jsonArray = []; - for (let i = 1; i < lines.length; i++) { - const currentLine = lines[i].trim(); - if (currentLine === "") continue; // Skip blank lines - const lineArray = currentLine.split(','); - // Check if any non-empty field exists - let hasNonEmptyField = false; - for (let j = 0; j < lineArray.length; j++) { - if (lineArray[j].trim() !== "") { - hasNonEmptyField = true; - break; - } - } - // If no non-empty field exists, skip adding this object - if (!hasNonEmptyField) continue; - const obj = {}; - for (let j = 0; j < headers.length; j++) { - // Only include columns with non-empty headers and non-empty values - const value = lineArray[j].trim(); - if (headers[j].trim() !== "" && value !== "") { - // Convert values "true" to true - obj[headers[j]] = value.toLowerCase() === "true" ? true : value; - } - } - jsonArray.push(obj); + try { j = JSON.parse(r.target.result); } catch (ex) { setDialogMode(2, "User Account Import", 1, null, format("Invalid JSON file: {0}.", ex)); return; } + if ((j != null) && (Array.isArray(j))) { + var ok = true; + for (var i in j) { + if ((typeof j[i].user != 'string') || (j[i].user.length < 1) || (j[i].user.length > 64)) { ok = false; } + if ((typeof j[i].pass != 'string') || (j[i].pass.length < 1) || (j[i].pass.length > 256)) { ok = false; } + if (checkPasswordRequirements(j[i].pass, passRequirements) == false) { ok = false; } + if ((j[i].email != null) && ((typeof j[i].email != 'string') || (j[i].email.length < 1) || (j[i].email.length > 128))) { ok = false; } } - j = jsonArray; - if ((j != null) && (Array.isArray(j))) { - var ok = true; - for (var i in j) { - if ((typeof j[i].user != 'string') || (j[i].user.length < 1) || (j[i].user.length > 64)) { ok = false; } - if ((typeof j[i].pass != 'string') || (j[i].pass.length < 1) || (j[i].pass.length > 256)) { ok = false; } - if (checkPasswordRequirements(j[i].pass, passRequirements) == false) { ok = false; } - if ((j[i].email != null) && ((typeof j[i].email != 'string') || (j[i].email.length < 1) || (j[i].email.length > 128))) { ok = false; } - } - if (ok == false) { setDialogMode(2, "User Account Import", 1, null, "Invalid CSV file format."); } else { meshserver.send({ action: 'adduserbatch', users: j }); } - } else { setDialogMode(2, "User Account Import", 1, null, "Invalid CSV file format."); } - } else { - try { j = JSON.parse(r.target.result); } catch (ex) { setDialogMode(2, "User Account Import", 1, null, format("Invalid JSON file: {0}.", ex)); return; } - if ((j != null) && (Array.isArray(j))) { - var ok = true; - for (var i in j) { - if ((typeof j[i].user != 'string') || (j[i].user.length < 1) || (j[i].user.length > 64)) { ok = false; } - if ((typeof j[i].pass != 'string') || (j[i].pass.length < 1) || (j[i].pass.length > 256)) { ok = false; } - if (checkPasswordRequirements(j[i].pass, passRequirements) == false) { ok = false; } - if ((j[i].email != null) && ((typeof j[i].email != 'string') || (j[i].email.length < 1) || (j[i].email.length > 128))) { ok = false; } - } - if (ok == false) { setDialogMode(2, "User Account Import", 1, null, "Invalid JSON file format."); } else { meshserver.send({ action: 'adduserbatch', users: j }); } - } else { setDialogMode(2, "User Account Import", 1, null, "Invalid JSON file format."); } - } + if (ok == false) { setDialogMode(2, "User Account Import", 1, null, "Invalid JSON file format."); } else { meshserver.send({ action: 'adduserbatch', users: j }); } + } else { setDialogMode(2, "User Account Import", 1, null, "Invalid JSON file format."); } }; fr.readAsText(Q('d4importFile').files[0]); } @@ -15933,7 +14520,7 @@ } function p4downloadUserInfoCSV() { - var csv = "id,name,email,creation,lastlogin,groups,authfactors,siteadmin,useradmin,locked" + '\r\n'; + var csv = "id, name, email, creation, lastlogin, groups, authfactors, siteadmin, useradmin, locked" + '\r\n'; for (var i in users) { var multiFactor = false, factors = []; if ((users[i].otpsecret > 0) || (users[i].otphkeys > 0)) { @@ -16346,7 +14933,7 @@ // Add user group name var gname = EscapeHtml(group.name); if (gname.length == 0) { gname = '' + "None" + ''; } - if ((currentUserGroup.membershipType == null) && ((userinfo.siteadmin & 256) != 0)) { gname = '' + gname + ' '; } + if ((userinfo.siteadmin & 256) != 0) { gname = '' + gname + ' '; } QH('p51groupName', gname); var usercount = 0, meshcount = 0, devicecount = 0; @@ -16367,11 +14954,8 @@ x += addDeviceAttribute("Domain", (d != '')?EscapeHtml(d):('' + "Default" + '')); x += addDeviceAttribute("Group Identifier", EscapeHtml(group._id)); } - if (currentUserGroup.membershipType != null) { - x += addDeviceAttribute("Group Type", EscapeHtml(currentUserGroup.membershipType)); - } if ((userinfo.siteadmin & 256) != 0) { - x += addDeviceAttribute("Description", '' + desc + ' '); + x += addDeviceAttribute("Description", '' + desc + ' '); } else { x += addDeviceAttribute("Description", desc); } @@ -16415,7 +14999,7 @@ QH('p51group', x); x = '
    '; - if ((currentUserGroup.membershipType == null) && ((userinfo.siteadmin & 256) != 0)) { + if ((userinfo.siteadmin & 256) != 0) { x += ' ' + "Add Users" + ''; } x += ''; @@ -16433,8 +15017,7 @@ // Display all users for this user group for (var i in sortedusers) { - var trash = ''; - if (currentUserGroup.membershipType == null) { trash = ''; } + var trash = ''; var username = EscapeHtml(decodeURIComponent(sortedusers[i].name)); if (users != null) { username = '' + username + ''; } x += ''; @@ -16493,7 +15076,7 @@ if (count == 1) { x += ''; } x += '
    ' + "Group Members" + '
     ' + username + '
    ' + trash + '
     ' + "No devices in common" + '
    '; - if (((currentUserGroup.membershipType == null) || (usercount == 0)) && ((userinfo.siteadmin & 256) != 0)) { + if ((userinfo.siteadmin & 256) != 0) { x += ''; } @@ -16548,9 +15131,9 @@ meshserver.send({ action: 'removemeshuser', meshid: meshid, userid: currentUserGroup._id }); } - function p51editgroup(focus, nameReadOnly) { + function p51editgroup(focus) { if (xxdialogMode) return; - var x = addHtmlValue("Name", ''); + var x = addHtmlValue("Name", ''); x += addHtmlValue("Description", '
    '); setDialogMode(2, "Edit User Group", 3, p51editgroupEx, x); Q('dp51name').value = currentUserGroup.name; @@ -16709,6 +15292,7 @@ if (shortuserid.startsWith('~twitter:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/twitter64.png'; } else if (shortuserid.startsWith('~google:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/google64.png'; } else if (shortuserid.startsWith('~github:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/github64.png'; } + else if (shortuserid.startsWith('~reddit:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/reddit64.png'; } else if (shortuserid.startsWith('~azure:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/azure64.png'; } else if (shortuserid.startsWith('~oidc:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/oidc64.png'; } else if (shortuserid.startsWith('~jumpcloud:')) { QV('p30userAuthServiceLogo', true); Q('p30userAuthServiceLogo').src = 'images/login/jumpcloud64.png'; } @@ -16740,19 +15324,15 @@ var emailLink = ''; if (user.email) { emailLink = ' '; } if (((user.siteadmin != 0xFFFFFFFF) || (userinfo.siteadmin == 0xFFFFFFFF))) { // If we are not site admin, we can't change a admin email or real name - x += addDeviceAttribute("Email", '' + everify + email + emailLink + ' '); - x += addDeviceAttribute("Real Name", '' + realname + ' '); + x += addDeviceAttribute("Email", everify + email + emailLink + ' '); + x += addDeviceAttribute("Real Name", realname + ' '); } else { x += addDeviceAttribute("Email", everify + email + emailLink); x += addDeviceAttribute("Real Name", realname); } if ((features & 0x02000000) || (user.phone != null)) { // If SMS is enabled on the server or user has a phone number - x += addDeviceAttribute("Phone Number", '' + (user.phone?user.phone:('' + "None" + '')) + ' '); - } - - if ((features2 & 0x02000000) || (user.msghandle != null)) { // If user messaging is enabled on the server or user has a messaging handle - x += addDeviceAttribute("Messaging", ' ' + (user.msghandle?user.msghandle:('' + "None" + '')) + ' '); + x += addDeviceAttribute("Phone Number", (user.phone?user.phone:('' + "None" + '')) + ' '); } // Display features @@ -16775,7 +15355,7 @@ if (userFeatures == '') { userFeatures = '' + "None" + ''; } x += addDeviceAttribute("Features", addLink(userFeatures, 'p20edituserfeatures()')); - x += addDeviceAttribute("Server Rights", '' + premsg + msg.join(', ') + ' '); + x += addDeviceAttribute("Server Rights", premsg + msg.join(', ') + ' '); if (user.quota) x += addDeviceAttribute("Server Quota", EscapeHtml(parseInt(user.quota) / 1024) + ' k'); x += addDeviceAttribute("Creation", printDateTime(new Date(user.creation * 1000))); if (user.login) x += addDeviceAttribute("Last Login", printDateTime(new Date(user.login * 1000))); @@ -16814,17 +15394,15 @@ } var multiFactor = 0; - if ((user.otpsecret > 0) || (user.otphkeys > 0) || (user.otpekey > 0) || (user.otpduo > 0)) { + if ((user.otpsecret > 0) || (user.otphkeys > 0) || (user.otpekey > 0)) { multiFactor = 1; var factors = []; if (user.otpsecret > 0) { factors.push("Authentication App"); } if (user.otphkeys > 0) { factors.push("Security Key"); } if (user.otpekey > 0) { factors.push("Email"); } - if (user.otpduo > 0) { factors.push("Duo"); } if (user.otpkeys > 0) { factors.push("Backup Codes"); } if (user.otpdev > 0) { factors.push("Device Push"); } if ((user.phone != null) && (features & 0x04000000)) { factors.push("SMS"); } - if ((user.msghandle != null) && (features2 & 0x04000000)) { factors.push("Messaging"); } x += addDeviceAttribute("Security", ' ' + factors.join(', ')); } @@ -16833,19 +15411,11 @@ // Add action buttons x += ''; if (user.phone && (features & 0x02000000)) { x += ''; } - if (user.msghandle && (features2 & 0x02000000)) { x += ''; } if ((typeof user.email == 'string') && (user.emailVerified === true) && (features & 0x00000040)) { x += ''; } if (!self && ((activeSessions > 0) || ((features2 & 8) && (user.webpush)))) { x += ''; x += ''; - if ((activeSessions > 0) && (serverinfo != null) && (serverinfo.altmessenging != null)) { - for (var i in serverinfo.altmessenging) { - var am = serverinfo.altmessenging[i]; - if ((am.type == null) || (am.type == 'user')) { - x += ''; - } - } - } + if ((activeSessions > 0) && (serverinfo != null) && (serverinfo.altmessenging != null)) { for (var i in serverinfo.altmessenging) { x += ''; } } } // Setup the panel @@ -16859,7 +15429,7 @@ // Show bottom buttons x = '
    '; - if (userAdminRights && (userinfo._id != user._id)) { x += '' + "Delete User" + ''; } + if (userAdminRights) { x += '' + "Delete User" + ''; } x += '
    '; // If user admin rights and not SSPI/LDAP and UserID does not start with ~, show change password if (userAdminRights && ((features & 0x00080000) == 0) && (user._id.split('/')[2][0] != '~')) { @@ -16899,83 +15469,6 @@ p30editPhoneValidate(); } - function p30editMessaging() { - if (xxdialogMode) return; - var x = ''; } } @@ -17268,7 +15761,7 @@ if (xxdialogMode || (usergroups == null)) return; var y = ''; for (var i in usergroups) { - if ((usergroups[i].membershipType != null) || (usergroups[i]._id.split('/')[1] != currentUser._id.split('/')[1])) continue; + if (usergroups[i]._id.split('/')[1] != currentUser._id.split('/')[1]) continue; if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += ''; } } var x = addHtmlValue("User Group", '
    '); @@ -17354,11 +15847,7 @@ } function refreshUsersEvents() { - if (p31filterevents.value != "") { - meshserver.send({ action: 'events', limit: parseInt(p31limitdropdown.value), userid: currentUser._id, filter: p31filterevents.value }); - } else { - meshserver.send({ action: 'events', limit: parseInt(p31limitdropdown.value), userid: currentUser._id }); - } + meshserver.send({ action: 'events', limit: parseInt(p31limitdropdown.value), userid: currentUser._id }); } @@ -17374,10 +15863,6 @@ if (p52recordings == null) { x += '
    ' + "Loading..." + '
    '; - } else if (typeof p52recordings == 'number') { - if (p52recordings == 1) { x += '
    ' + "Server is unable to read from the recordings folder." + '
    '; } - else if (p52recordings == 2) { x += '
    ' + "Server is unable to get recordings from the database." + '
    '; } - else { x += '
    ' + "An unknown error occured." + '
    '; } } else if (p52recordings.length == 0) { x += '
    ' + "No recordings." + '
    '; } else { @@ -17498,7 +15983,6 @@ // function d3init() { - d3fileoptions = { dialog: 1, filter: 'd3filter', files: 'd3serverfiles', folderup: 'p3FolderUp', currentFolder: 'p3CurrentFolder', func: d3setActions }; Q('d3localFile').value = ''; Q('d3localFile').accept = Q('d3filter').value; d3modechange(); @@ -17513,11 +15997,10 @@ var d3filetreelinkpath; var d3filetreelocation = []; - var d3fileoptions = null; + function d3updatefiles() { - if (d3fileoptions == null) return; - if ((d3fileoptions.filter == 'd3filter') && (Q('d3uploadMode').value == 1)) return; - var html1 = '', html2 = '', filetreex = filetree, folderdepth = 1, publicPath = null, lastFolderName = ''; + if (Q('d3uploadMode').value == 1) return; + var html1 = '', html2 = '', filetreex = filetree, folderdepth = 1, publicPath = null; // Navigate to path location, build the paths at the same time var d3filetreelocation2 = [], oldlinkpath = d3filetreelinkpath, checkedBoxes = [], checkboxes = document.getElementsByName('fc'); @@ -17529,13 +16012,12 @@ d3filetreelocation2.push(d3filetreelocation[i]); if ((folderdepth == 1)) { var sp = d3filetreelocation[i].split('/'); - publicPath = window.location.origin + domainUrl + sp[0] + 'files/' + sp[2]; + publicPath = window.location + sp[0] + 'files/' + sp[2]; if (d3filetreelocation[i] === userinfo._id) { d3filetreelinkpath += 'self'; } else { d3filetreelinkpath += (sp[0] + '/' + sp[2]); } } else { if (d3filetreelinkpath != '') { d3filetreelinkpath += '/' + d3filetreelocation[i]; if (folderdepth > 2) { publicPath += '/' + d3filetreelocation[i]; } } } filetreex = filetreex.f[d3filetreelocation[i]]; - lastFolderName = filetreex.n; folderdepth++; } else { break; @@ -17547,8 +16029,7 @@ var filetreexx = p5sort_files(filetreex.f); // File filter - var fileFilter = ''; - if (d3fileoptions.filter) { fileFilter = Q(d3fileoptions.filter).value }; + var fileFilter = Q('d3filter').value // Display all files and folders at this location for (var i in filetreexx) { @@ -17576,24 +16057,19 @@ if (f.t < 3) { html1 += h; } else { html2 += h; } } - if (d3fileoptions.currentFolder) { QH(d3fileoptions.currentFolder, lastFolderName); } - QH(d3fileoptions.files, html1 + html2); - QE(d3fileoptions.folderup, d3filetreelocation.length > 0); - if (d3fileoptions.func) { d3fileoptions.func(); } + QH('d3serverfiles', html1 + html2); + QE('p3FolderUp', d3filetreelocation.length > 0); + d3setActions(); } function d3folderset(x) { d3filetreelocation.push(decodeURIComponent(x)); d3updatefiles(); return false; } function d3folderup(x) { if (x == null) { d3filetreelocation.pop(); } else { while (d3filetreelocation.length > x) { d3filetreelocation.pop(); } } d3updatefiles(); } function d3getFileSel() { var cc = []; var checkboxes = document.getElementsByName('fcx'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { cc.push(checkboxes[i].value) } } return cc; } function d3setActions() { - if (d3fileoptions.dialog == 1) { - var mode = Q('d3uploadMode').value; - if (mode == 1) { - QE('idx_dlgOkButton', Q('d3localFile').value.length > 0); - } else { - QE('idx_dlgOkButton', d3getFileSel().length == 1); - } - } else if (d3fileoptions.dialog == 2) { + var mode = Q('d3uploadMode').value; + if (mode == 1) { + QE('idx_dlgOkButton', Q('d3localFile').value.length > 0); + } else { QE('idx_dlgOkButton', d3getFileSel().length == 1); } } @@ -17610,7 +16086,6 @@ var y = '', x = '', settings = JSON.parse(getstore('_ReportSettings', '{}')); var options = { 1 : "Remote Sessions", 2 : "User Traffic Usage", 3 : "User Logins" } - if (userinfo.siteadmin == 0xFFFFFFFF) { options[4] = "Database Records"; } for (var i in options) { y += ''; } x += addHtmlValue("Type", ''); @@ -17635,13 +16110,11 @@ x += addHtmlValue("Device Group", ''); x += ''; - x += ''; x += '
    '; - x += '' + "Messaging account for this user."; - var y = ''; - x += '
    ' + "Service" + '' + y; - x += '
    ' + "Handle" + ''; - x += '
    '; - if (serverinfo.discordUrl) { x += '' } - x += ''; - x += ''; - x += ''; - x += ''; - setDialogMode(2, "Messaging Notifications", 3, p30editMessagingEx, x, 'verifyMessaging'); - Q('d2handleinput').focus(); - if (currentUser.msghandle) { - if (currentUser.msghandle.startsWith('telegram:') && ((serverinfo.userMsgProviders & 1) != 0)) { Q('d2serviceselect').value = 1; Q('d2handleinput').value = currentUser.msghandle.substring(10); } - if (currentUser.msghandle.startsWith('discord:') && ((serverinfo.userMsgProviders & 4) != 0)) { Q('d2serviceselect').value = 4; Q('d2handleinput').value = currentUser.msghandle.substring(8); } - if (currentUser.msghandle.startsWith('xmpp:') && ((serverinfo.userMsgProviders & 8) != 0)) { Q('d2serviceselect').value = 8; Q('d2handleinput').value = currentUser.msghandle.substring(5); } - if (currentUser.msghandle.startsWith('callmebot:') && ((serverinfo.userMsgProviders & 16) != 0)) { - Q('d2serviceselect').value = 16; - var toData = currentUser.msghandle.substring(10).split('|'); - if ((toData[0] == 'signal') && (toData.length == 3)) { Q('d2handleinput').value = 'https://api.callmebot.com/signal/send.php?phone=' + decodeURIComponent(toData[1]) + '&apikey=' + decodeURIComponent(toData[2]); } - if ((toData[0] == 'whatsapp') && (toData.length == 3)) { Q('d2handleinput').value = 'https://api.callmebot.com/whatsapp.php?phone=' + decodeURIComponent(toData[1]) + '&apikey=' + decodeURIComponent(toData[2]); } - if ((toData[0] == 'facebook') && (toData.length == 2)) { Q('d2handleinput').value = 'https://api.callmebot.com/facebook/send.php?apikey=' + decodeURIComponent(toData[1]); } - } - if (currentUser.msghandle.startsWith('pushover:') && ((serverinfo.userMsgProviders & 32) != 0)) { Q('d2serviceselect').value = 32; Q('d2handleinput').value = currentUser.msghandle.substring(9); } - if (currentUser.msghandle.startsWith('ntfy:') && ((serverinfo.userMsgProviders & 64) != 0)) { Q('d2serviceselect').value = 64; Q('d2handleinput').value = currentUser.msghandle.substring(5); } - if (currentUser.msghandle.startsWith('zulip:') && ((serverinfo.userMsgProviders & 128) != 0)) { Q('d2serviceselect').value = 128; Q('d2handleinput').value = currentUser.msghandle.substring(6); } - if (currentUser.msghandle.startsWith('slack:') && ((serverinfo.userMsgProviders & 256) != 0)) { Q('d2serviceselect').value = 256; Q('d2handleinput').value = currentUser.msghandle.substring(6); } - } - p30editMessagingValidate(); - } - - function p30editMessagingValidate(x) { - QE('d2handleinput', Q('d2serviceselect').value != 0); - if (serverinfo.discordUrl) { QV('d2discordurl', Q('d2serviceselect').value == 4); } - QV('d2callmebotinfo', Q('d2serviceselect').value == 16); - QV('d2pushoverinfo', Q('d2serviceselect').value == 32); - QV('d2ntfyinfo', Q('d2serviceselect').value == 64); - QV('d2slackinfo', Q('d2serviceselect').value == 256); - if (Q('d2serviceselect').value == 0) { Q('d2handleinput')['placeholder'] = ''; } - else if (Q('d2serviceselect').value == 4) { Q('d2handleinput')['placeholder'] = "Username:0000"; } - else if (Q('d2serviceselect').value == 8) { Q('d2handleinput')['placeholder'] = "username@server.com"; } - else if (Q('d2serviceselect').value == 16) { Q('d2handleinput')['placeholder'] = "https://api.callmebot.com/..."; } - else if (Q('d2serviceselect').value == 32) { Q('d2handleinput')['placeholder'] = "User key"; } - else if (Q('d2serviceselect').value == 64) { Q('d2handleinput')['placeholder'] = "Topic"; } - else if (Q('d2serviceselect').value == 128) { Q('d2handleinput')['placeholder'] = "username@sample.com"; } - else if (Q('d2serviceselect').value == 256) { Q('d2handleinput')['placeholder'] = "https://hooks.slack.com/..."; } - else { Q('d2handleinput')['placeholder'] = "Username"; } - if (x == 1) { dialogclose(1); } - } - - // Send to the server the user's messaging account - function p30editMessagingEx() { - var handle = null; - if ((Q('d2handleinput').value == '') || (Q('d2serviceselect').value == 0)) { handle = ''; } - else if (Q('d2serviceselect').value == 1) { handle = 'telegram:@' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 4) { handle = 'discord:' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 8) { handle = 'xmpp:' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 16) { handle = 'callmebot:' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 32) { handle = 'pushover:' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 64) { handle = 'ntfy:' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 128) { handle = 'zulip:' + Q('d2handleinput').value; } - else if (Q('d2serviceselect').value == 256) { handle = 'slack:' + Q('d2handleinput').value; } - if (handle != null) { meshserver.send({ action: 'edituser', id: currentUser._id, msghandle: handle }); } - } - function p20edituserfeatures() { if (xxdialogMode) return; var flags = (currentUser.flags)?currentUser.flags:0, x = ''; // Flags: 1 = Account Image, 2 = Session Recording @@ -17175,7 +15668,7 @@ if ((userinfo.siteadmin & 256) != 0) { var userGroupCount = 0, newUserGroup = false; for (var i in usergroups) { - if ((usergroups[i].membershipType != null) || (usergroups[i]._id.split('/')[1] != currentUser._id.split('/')[1])) continue; + if (usergroups[i]._id.split('/')[1] != currentUser._id.split('/')[1]) continue; userGroupCount++; if ((currentUser.links == null) || (currentUser.links[i] == null)) { newUserGroup = true; } } @@ -17193,7 +15686,7 @@ groupname = EscapeHtml(group.name); if (usergroups != null) { groupname = '' + groupname + ''; } } - if ((group.membershipType == null) && ((userinfo.siteadmin & 256) != 0)) { trash = ''; } + if ((userinfo.siteadmin & 256) != 0) { trash = ''; } x += '
     ' + groupname + '
    ' + trash + '
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
     
    -
    -
    -
    - - - - - - - - - - - - - - - - - -
    - - - - -
     
    -
    -
    - - -
    - -
    - - - - -
    - - - -
    No device groups.
    -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - diff --git a/views/login-mobile.handlebars b/views/login-mobile.handlebars index fc38a02e..dbef92ab 100644 --- a/views/login-mobile.handlebars +++ b/views/login-mobile.handlebars @@ -63,15 +63,15 @@ - + - + - +
    Username:
    Password:
    @@ -88,10 +88,9 @@ + - - - + @@ -132,14 +131,6 @@
    Creation Token:
    Security Check:
    @@ -149,7 +140,6 @@

    Back to login - @@ -326,7 +316,6 @@ var newAccount = '{{{newAccount}}}'; var passhint = '{{{passhint}}}'; var newAccountPass = parseInt('{{{newAccountPass}}}'); - var newAccountCaptcha = '{{{newAccountCaptcha}}}'; var emailCheck = '{{{emailcheck}}}'; var features = parseInt('{{{features}}}'); var passRequirements = '{{{passRequirements}}}'; @@ -345,7 +334,7 @@ // Display the right server message var messageid = parseInt('{{{messageid}}}'); var okmessages = ['', "If valid, reset mail sent.", "Email sent.", "Email verification required, check your mailbox and click the confirmation link.", "SMS sent."]; - var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later.", "Server under maintenance.", "Unable to send device notification.", "Invalid security check."]; + var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later."]; if (messageid > 0) { var msg = ''; if ((messageid < 100) && (messageid < okmessages.length)) { msg = okmessages[messageid]; } @@ -356,19 +345,6 @@ } } - // Display flash error Messages - var flashErrors = JSON.parse('{{{flashErrors}}}'); - if (flashErrors && (flashErrors.length > 0)) { - var msg = ''; - for (i = 0; i < flashErrors.length; i++) { - if (flashErrors[i]) { - msg += '' + flashErrors[i] + '

    '; - } - } - QH('message1', msg); - QV('message1', true); - } - // If URL arguments are provided, add them to form posts if (window.location.href.indexOf('?') > 0) { var urlargs = window.location.href.substring(window.location.href.indexOf('?')); @@ -411,10 +387,9 @@ if (authStrategies.indexOf('twitter') >= 0) { QV('auth-twitter', true); } if (authStrategies.indexOf('google') >= 0) { QV('auth-google', true); } if (authStrategies.indexOf('github') >= 0) { QV('auth-github', true); } + if (authStrategies.indexOf('reddit') >= 0) { QV('auth-reddit', true); } if (authStrategies.indexOf('azure') >= 0) { QV('auth-azure', true); } if (authStrategies.indexOf('oidc') >= 0) { QV('auth-oidc', true); } - if (authStrategies.indexOf('oidc-azure') >= 0) { QV('auth-oidc-azure', true); } - if (authStrategies.indexOf('oidc-google') >= 0) { QV('auth-oidc-google', true); } if (authStrategies.indexOf('jumpcloud') >= 0) { QV('auth-jumpcloud', true); } if (authStrategies.indexOf('intel') >= 0) { QV('auth-intel', true); } if (authStrategies.indexOf('saml') >= 0) { QV('auth-saml', true); } @@ -422,13 +397,12 @@ window.onresize = center; center(); + validateLogin(); validateCreate(); if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); } QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link. if ((passRequirements.hint === true) && (passhint != null) && (passhint.length > 0)) { QV('showPassHintLink', true); } QV('newAccountPass', (newAccountPass == 1)); - QV('newAccountCaptcha', (newAccountCaptcha != '')); - QV('newAccountCaptchaImg', (newAccountCaptcha != '')); QV('resetAccountDiv', (emailCheck == 'true')); QV('hrAccountDiv', (emailCheck == 'true') || (newAccountPass == 1)); @@ -573,14 +547,13 @@ } function validateLogin(box, e) { - setTimeout(function(){ - setDialogMode(0); - if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } } - if (e != null) { haltEvent(e); } - }, 100); + var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0)); + QE('loginButton', ok); + setDialogMode(0); + if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } } + if (e != null) { haltEvent(e); } } - function validateCreate(box,e) { setDialogMode(0); var ok = false; @@ -619,9 +592,8 @@ if (box == 2) { Q('apassword1').focus(); } if (box == 3) { Q('apassword2').focus(); } if (box == 4) { Q('apasswordhint').focus(); } - if (box == 5) { if (newAccountPass == 1) { Q('anewaccountpass').focus(); } else { box = 6; } } - if (box == 6) { if (newAccountCaptcha != '') { Q('anewaccountcaptcha').focus(); } else { box = 7; } } - if (box == 7) { Q('createButton').click(); } + if (box == 5) { if (newAccountPass == 1) { Q('anewaccountpass').focus(); } else { Q('createButton').click(); } } + if (box == 6) { Q('createButton').click(); } } if (e != null) { haltEvent(e); } } @@ -816,4 +788,4 @@ - + \ No newline at end of file diff --git a/views/login.handlebars b/views/login.handlebars index 2c237789..e364cd78 100644 --- a/views/login.handlebars +++ b/views/login.handlebars @@ -7,7 +7,6 @@ - @@ -55,15 +54,15 @@ - + - + - +
    Username:
    Password:
    @@ -81,10 +80,9 @@ + - - @@ -124,14 +122,6 @@
    Creation Token:
    Security Check:
    @@ -141,7 +131,6 @@

    Back to login -
    @@ -84,10 +83,9 @@ -
    - +
    - +
    - +
    Creation Token:
    Security Check:
    @@ -164,7 +153,6 @@

    Back to login -
    @@ -385,7 +368,6 @@ var loginMode = '{{{loginmode}}}'; var newAccount = '{{{newAccount}}}'; var newAccountPass = parseInt('{{{newAccountPass}}}'); - var newAccountCaptcha = '{{{newAccountCaptcha}}}'; var emailCheck = '{{{emailcheck}}}'; var passRequirements = '{{{passRequirements}}}'; var hardwareKeyChallenge = decodeURIComponent('{{{hkey}}}'); @@ -395,10 +377,8 @@ var welcomeText = decodeURIComponent('{{{welcometext}}}'); var currentpanel = 0; var publicKeyCredentialRequestOptions = null; - var otpduo = (decodeURIComponent('{{{otpduo}}}') === 'true'); var otpemail = (decodeURIComponent('{{{otpemail}}}') === 'true'); var otpsms = (decodeURIComponent('{{{otpsms}}}') === 'true'); - var otpmsg = (decodeURIComponent('{{{otpmsg}}}') === 'true'); var otppush = (decodeURIComponent('{{{otppush}}}') === 'true'); var autofido = (decodeURIComponent('{{{autofido}}}') === 'true'); var twoFactorCookieDays = parseInt('{{{twoFactorCookieDays}}}'); @@ -406,13 +386,9 @@ var tokenTimeout = parseInt('{{{tokenTimeout}}}'); var websocket = null; var formSubmitted = false; - var serverLangs = '{{{renderLanguages}}}'.split(','); - var loclist = { 'af': "Afrikaans", 'sq': "Albanian", 'ar': "Arabic (Standard)", 'ar-dz': "Arabic (Algeria)", 'ar-bh': "Arabic (Bahrain)", 'ar-eg': "Arabic (Egypt)", 'ar-iq': "Arabic (Iraq)", 'ar-jo': "Arabic (Jordan)", 'ar-kw': "Arabic (Kuwait)", 'ar-lb': "Arabic (Lebanon)", 'ar-ly': "Arabic (Libya)", 'ar-ma': "Arabic (Morocco)", 'ar-om': "Arabic (Oman)", 'ar-qa': "Arabic (Qatar)", 'ar-sa': "Arabic (Saudi Arabia)", 'ar-sy': "Arabic (Syria)", 'ar-tn': "Arabic (Tunisia)", 'ar-ae': "Arabic (U.A.E.)", 'ar-ye': "Arabic (Yemen)", 'an': "Aragonese", 'hy': "Armenian", 'as': "Assamese", 'ast': "Asturian", 'az': "Azerbaijani", 'eu': "Basque", 'bg': "Bulgarian", 'be': "Belarusian", 'bn': "Bengali", 'bs': "Bosnian", 'br': "Breton", 'my': "Burmese", 'ca': "Catalan", 'ch': "Chamorro", 'ce': "Chechen", 'zh': "Chinese", 'zh-hk': "Chinese (Hong Kong)", 'zh-cn': "Chinese (PRC)", 'zh-sg': "Chinese (Singapore)", 'zh-tw': "Chinese (Taiwan)", 'cv': "Chuvash", 'co': "Corsican", 'cr': "Cree", 'hr': "Croatian", 'cs': "Czech", 'da': "Danish", 'nl': "Dutch (Standard)", 'nl-be': "Dutch (Belgian)", 'en': "English", 'en-au': "English (Australia)", 'en-bz': "English (Belize)", 'en-ca': "English (Canada)", 'en-ie': "English (Ireland)", 'en-jm': "English (Jamaica)", 'en-nz': "English (New Zealand)", 'en-ph': "English (Philippines)", 'en-za': "English (South Africa)", 'en-tt': "English (Trinidad & Tobago)", 'en-gb': "English (United Kingdom)", 'en-us': "English (United States)", 'en-zw': "English (Zimbabwe)", 'eo': "Esperanto", 'et': "Estonian", 'fo': "Faeroese", 'fa': "Farsi (Persian)", 'fj': "Fijian", 'fi': "Finnish", 'fr': "French (Standard)", 'fr-be': "French (Belgium)", 'fr-ca': "French (Canada)", 'fr-fr': "French (France)", 'fr-lu': "French (Luxembourg)", 'fr-mc': "French (Monaco)", 'fr-ch': "French (Switzerland)", 'fy': "Frisian", 'fur': "Friulian", 'gd': "Gaelic (Scots)", 'gd-ie': "Gaelic (Irish)", 'gl': "Galacian", 'ka': "Georgian", 'de': "German (Standard)", 'de-at': "German (Austria)", 'de-de': "German (Germany)", 'de-li': "German (Liechtenstein)", 'de-lu': "German (Luxembourg)", 'de-ch': "German (Switzerland)", 'el': "Greek", 'gu': "Gujurati", 'ht': "Haitian", 'he': "Hebrew", 'hi': "Hindi", 'hu': "Hungarian", 'is': "Icelandic", 'id': "Indonesian", 'iu': "Inuktitut", 'ga': "Irish", 'it': "Italian (Standard)", 'it-ch': "Italian (Switzerland)", 'ja': "Japanese", 'kn': "Kannada", 'ks': "Kashmiri", 'kk': "Kazakh", 'km': "Khmer", 'ky': "Kirghiz", 'tlh': "Klingon", 'ko': "Korean", 'ko-kp': "Korean (North Korea)", 'ko-kr': "Korean (South Korea)", 'la': "Latin", 'lv': "Latvian", 'lt': "Lithuanian", 'lb': "Luxembourgish", 'mk': "FYRO Macedonian", 'ms': "Malay", 'ml': "Malayalam", 'mt': "Maltese", 'mi': "Maori", 'mr': "Marathi", 'mo': "Moldavian", 'nv': "Navajo", 'ng': "Ndonga", 'ne': "Nepali", 'no': "Norwegian", 'nb': "Norwegian (Bokmal)", 'nn': "Norwegian (Nynorsk)", 'oc': "Occitan", 'or': "Oriya", 'om': "Oromo", 'fa-ir': "Persian/Iran", 'pl': "Polish", 'pt': "Portuguese", 'pt-br': "Portuguese (Brazil)", 'pa': "Punjabi", 'pa-in': "Punjabi (India)", 'pa-pk': "Punjabi (Pakistan)", 'qu': "Quechua", 'rm': "Rhaeto-Romanic", 'ro': "Romanian", 'ro-mo': "Romanian (Moldavia)", 'ru': "Russian", 'ru-mo': "Russian (Moldavia)", 'sz': "Sami (Lappish)", 'sg': "Sango", 'sa': "Sanskrit", 'sc': "Sardinian", 'sd': "Sindhi", 'si': "Singhalese", 'sr': "Serbian", 'sk': "Slovak", 'sl': "Slovenian", 'so': "Somani", 'sb': "Sorbian", 'es': "Spanish", 'es-ar': "Spanish (Argentina)", 'es-bo': "Spanish (Bolivia)", 'es-cl': "Spanish (Chile)", 'es-co': "Spanish (Colombia)", 'es-cr': "Spanish (Costa Rica)", 'es-do': "Spanish (Dominican Republic)", 'es-ec': "Spanish (Ecuador)", 'es-sv': "Spanish (El Salvador)", 'es-gt': "Spanish (Guatemala)", 'es-hn': "Spanish (Honduras)", 'es-mx': "Spanish (Mexico)", 'es-ni': "Spanish (Nicaragua)", 'es-pa': "Spanish (Panama)", 'es-py': "Spanish (Paraguay)", 'es-pe': "Spanish (Peru)", 'es-pr': "Spanish (Puerto Rico)", 'es-es': "Spanish (Spain)", 'es-uy': "Spanish (Uruguay)", 'es-ve': "Spanish (Venezuela)", 'sx': "Sutu", 'sw': "Swahili", 'sv': "Swedish", 'sv-fi': "Swedish (Finland)", 'sv-sv': "Swedish (Sweden)", 'ta': "Tamil", 'tt': "Tatar", 'te': "Teluga", 'th': "Thai", 'tig': "Tigre", 'ts': "Tsonga", 'tn': "Tswana", 'tr': "Turkish", 'tk': "Turkmen", 'uk': "Ukrainian", 'hsb': "Upper Sorbian", 'ur': "Urdu", 've': "Venda", 'vi': "Vietnamese", 'vo': "Volapuk", 'wa': "Walloon", 'cy': "Welsh", 'xh': "Xhosa", 'ji': "Yiddish", 'zu': "Zulu" }; - var loclistex = { 'zh-chs': "Chinese (Simplified)", 'zh-cht': "Chinese (Traditional)" }; - var showLanguageSelect = '{{{showLanguageSelect}}}'; function startup() { - if (decodeURIComponent('{{{loginpicture}}}') == 'true') { Q('loginPicture').src = 'loginlogo.png'; } + if (decodeURIComponent('{{{loginpicture}}}') == 'true') { Q('loginPicture').src = "loginlogo.png"; } QV('welcomeTextRow', welcomeText != ''); QH('welcomeText', welcomeText); @@ -428,8 +404,8 @@ // Display the right server message var i; var messageid = parseInt('{{{messageid}}}'); - var okmessages = ['', "If valid, reset mail sent.", "Email sent.", "Email verification required, check your mailbox and click the confirmation link.", "SMS sent.", "Sending notification...", "Message sent."]; - var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later.", "Server under maintenance.", "Unable to send device notification.", "Invalid security check."]; + var okmessages = ['', "If valid, reset mail sent.", "Email sent.", "Email verification required, check your mailbox and click the confirmation link.", "SMS sent.", "Sending notification..."]; + var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later.", "Server under maintenance.", "Unable to send device notification."]; if (messageid > 0) { var msg = ''; if ((messageid < 100) && (messageid < okmessages.length)) { msg = okmessages[messageid]; } @@ -440,36 +416,10 @@ } } - // Display flash error Messages - var flashErrors = JSON.parse('{{{flashErrors}}}'); - if (flashErrors && (flashErrors.length > 0)) { - var msg = ''; - for (i = 0; i < flashErrors.length; i++) { - if (flashErrors[i]) { - msg += '' + flashErrors[i] + '

    '; - } - } - QH('message1', msg); - QV('message1', true); - } - // Fix links if a loginKey if used var urlargs = parseUriArgs(); //if (urlargs.key) { Q('termsLinkFooter').href += '?key=' + urlargs.key; } - // Show Language Select Box if needed - if (showLanguageSelect === 'top' || showLanguageSelect === 'bottom') { - var x = ' +
    - -   + +    
    @@ -217,13 +217,6 @@
    -
    - - - - - -

    Agent Remote Desktop

    @@ -347,16 +340,6 @@ setupTerminal(); setupFiles(); - // Set the file editor - d4EditWrapVal = Number(getstore('editorWrap', 0)); - d4EditSizeVal = Number(getstore('editorSize', 0)); - d4EditEncodingVal = Number(getstore('editorEncoding', 0)); - d4EditLineBreakVal = Number(getstore('editorLineBreak', 0)); - d4ToggleWrap(true); - d4ToggleSize(true); - d4ToggleEncoding(true); - d4ToggleLineBreak(true); - // Set the document title if (nodeName.length > 0) { document.title += ' - ' + nodeName; } @@ -410,7 +393,7 @@ } function deskAdjust() { - if ((xxcurrentView == 12) && (terminal != null) && (xtermfit != null)) { xtermfit.fit(); } // Terminal + if ((xxcurrentView == 12) && (terminal != null) && (xtermfit != null)) { xtermfit.fit(); } // Terminal QS('fileArea4')['height'] = 'calc(100vh - ' + (90 + Q('fileArea2').clientHeight) + 'px)'; // Files var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var deskH = Q('Desk').height, deskW = Q('Desk').width; @@ -497,9 +480,6 @@ QE('DeskWD', deskState == 3); QV('deskkeys', viewOnly != 1); QE('deskkeys', deskState == 3); - QV('DeskTimer', deskState == 3); - QV('DeskLatency', deskState == 3); - QS('DeskLatency').display = (deskState == 3 ? 'inline-block' : 'none'); // Display this only if we have Chat & Notify permissions QV('DeskSaveImageButton', (deskState == 3) && (Q('Desk')['toBlob'] != null)); @@ -556,7 +536,7 @@ } else if ((data.action == 'present') && (webRtcDesktop == null)) { // Setup WebRTC channel webRtcDesktop = { platform: data.platform }; - var configuration = null; //{ "iceServers": [ { 'urls': 'stun:stun.cloudflare.com:3478' }, { 'urls': 'stun:stun.l.google.com:19302' } ] }; + var configuration = null; //{ "iceServers": [ { 'urls': 'stun:stun.services.mozilla.com' }, { 'urls': 'stun:stun.l.google.com:19302' } ] }; if (typeof RTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new RTCPeerConnection(configuration); } else if (typeof webkitRTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new webkitRTCPeerConnection(configuration); } @@ -644,7 +624,7 @@ desktop.m.onDisplayinfo = deskDisplayInfo; desktop.m.onScreenSizeChange = deskAdjust; desktop.Start(null); - desktop.latency.callback = function (ms) { /* console.log('latency', ms); */ updateSessionTime(); }; + desktop.latency.callback = function (ms) { console.log('latency', ms); updateSessionTime(); }; desktop.contype = 1; } } else { @@ -756,26 +736,14 @@ // Desktop var latencyStr = '', seconds = 0; if (desktop && desktop.startTime) { - if (desktop.latency && (desktop.latency.current >= 0)) { latencyStr = format('{0} ms', desktop.latency.current); } + if (desktop.latency && (desktop.latency.current >= 0)) { latencyStr = format('{0} ms, ', desktop.latency.current); } seconds = Math.floor((new Date() - desktop.startTime) / 1000); - QH('DeskTimer', zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2)); - QH('DeskLatency', latencyStr); + QH('DeskTimer', latencyStr + zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2)); } else { QH('DeskTimer', ''); - QH('DeskLatency', ''); } - // Terminal - seconds = 0; - if (terminal && terminal.startTime) { - if (terminal.latency && (terminal.latency.current >= 0)) { latencyStr = format('{0} ms, ', terminal.latency.current); } - seconds = Math.floor((new Date() - terminal.startTime) / 1000); - QH('TermTimer', latencyStr + zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2)); - } else { - QH('TermTimer', ''); - } - - if ((desktop == null) && (terminal == null)) { clearInterval(updateSessionTimer); updateSessionTimer = null; } + if (desktop == null) { clearInterval(updateSessionTimer); updateSessionTimer = null; } } function showDesktopSettings() { @@ -829,7 +797,6 @@ // Enter browser fullscreen function enterBrowserFullscreen(elem) { - if (navigator.keyboard && navigator.keyboard.lock) { navigator.keyboard.lock(); } if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } @@ -842,7 +809,6 @@ else if (document.msExitFullscreen) { document.msExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } - if (navigator.keyboard && navigator.keyboard.unlock) { navigator.keyboard.unlock(); } } // Return true if the browser is fullscreen. This is a delayed method that will return true/false late. Not very useful. @@ -922,7 +888,6 @@ // Remote desktop special key combos for Windows function deskSendKeys() { - Q('DeskWD').blur(); if (xxdialogMode || desktop == null || desktop.State != 3) return; var ks = Q('deskkeys').value; if (ks == 0) { // WIN+Down arrow @@ -1408,6 +1373,20 @@ updateTerminalButtons(); } + function updateSessionTime() { + // Terminal + var latencyStr = '', seconds = 0; + if (terminal && terminal.startTime) { + if (terminal.latency && (terminal.latency.current >= 0)) { latencyStr = format('{0} ms, ', terminal.latency.current); } + seconds = Math.floor((new Date() - terminal.startTime) / 1000); + QH('TermTimer', latencyStr + zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2)); + } else { + QH('TermTimer', ''); + } + + if (terminal == null) { clearInterval(updateSessionTimer); updateSessionTimer = null; } + } + // DEBUG var autoConnectTerminalTimer = null; function autoConnectTerminal(e) { if (autoConnectTerminalTimer == null) { autoConnectTerminalTimer = setInterval(connectTerminal, 100); } else { clearInterval(autoConnectTerminalTimer); autoConnectTerminalTimer = null; } } @@ -1426,13 +1405,7 @@ return obj; } - function tunnelUpdate(data) { - if (xterm.writeUtf8) { - if (typeof data == 'string') { xterm.writeUtf8(data); } else { xterm.writeUtf8(new Uint8Array(data)); } - } else { - if (typeof data == 'string') { xterm.write(data); } else { xterm.write(new Uint8Array(data)); } - } - } + function tunnelUpdate(data) { if (typeof data == 'string') { xterm.writeUtf8(data); } else { xterm.writeUtf8(new Uint8Array(data)); } } // Send the new terminal size to the agent function xTermSendResize() { @@ -1594,7 +1567,7 @@ // // Files - // + // function setupFiles() { // Setup the files tab @@ -1929,7 +1902,7 @@ function p13zipFiles() { var inputFiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { inputFiles.push(p13filetree.dir[checkboxes[i].value].n); } } - setDialogMode(2, "Zip Filename", 3, p13zipFilesEx, '', { action: 'zip -r', path: p13filetreelocation.join('/'), files: inputFiles }); + setDialogMode(2, "Zip Filename", 3, p13zipFilesEx, '', { action: 'zip', path: p13filetreelocation.join('/'), files: inputFiles }); focusTextBox('p13renameinput'); p13fileNameCheck(); } @@ -2047,8 +2020,6 @@ if (gdownloadFile.tag == 'viewer') { // View the file in the dialog box setDialogMode(4, EscapeHtml(gdownloadFile.file), 3, p13editSaveBack, null, gdownloadFile.file); - QV('d4EncodingButton', true); - QV('d4LineBreakButton', true); QS('dialog').width = 'auto'; QS('dialog').bottom = '80px'; QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px'; @@ -2065,9 +2036,6 @@ var d4EditWrapVal = 0; var d4EditSizeVal = 0; - var d4EditEncodingVal = 0; - var d4EditLineBreakVal = 0; - function d4ToggleWrap(update) { if (!update) { d4EditWrapVal = ++d4EditWrapVal % 2; } Q('d4WrapButton').value = ["Wrap: ON", "Wrap: OFF"][d4EditWrapVal]; @@ -2083,38 +2051,8 @@ putstore('editorSize', d4EditSizeVal); } - function d4ToggleEncoding(update) { - if (!update) { - d4EditEncodingVal = ++d4EditEncodingVal % 2; - if (d4EditEncodingVal == 1) { - Q('d4editorarea').value = decode_utf8(Q('d4editorarea').value); - } else { - Q('d4editorarea').value = encode_utf8(Q('d4editorarea').value); - } - } - Q('d4EncodingButton').value = ["Encoding: RAW","Encoding: UTF8"][d4EditEncodingVal]; - putstore('editorEncoding', d4EditEncodingVal); - } - - function d4ToggleLineBreak(update) { - if (!update) { - d4EditLineBreakVal = ++d4EditLineBreakVal % 3; - } - Q('d4LineBreakButton').value = ["Line Break: Windows (CR LF)","Line Break: Linux (LF)","Line Break: Mac (CR)"][d4EditLineBreakVal]; - putstore('editorLineBreak', d4EditLineBreakVal); - } - function p13editSaveBack(b, tag) { - var data; - var value = Q('d4editorarea').value; - value = d4EditLineBreakVal === 0 ? value.replace(/\r?\n|\r/g, '\r\n') : // Windows - d4EditLineBreakVal === 2 ? value.replace(/\r\n|\n/g, '\r') : // Mac - value.replace(/\r\n|\r/g, '\n'); // Linux - if (d4EditEncodingVal == 1) { - data = new TextEncoder().encode(value); // UTF8 encoding - } else { - data = new TextEncoder().encode(decode_utf8(value)); // RAW encoding - } + var data = new TextEncoder().encode(Q('d4editorarea').value); p13uploadFileContinue(1, [{ name: tag, size: data.byteLength, type: 'text/plain', xdata: data }]); } @@ -2245,7 +2183,7 @@ if (start >= data.byteLength) { files.sendText(JSON.stringify({ action: 'uploaddone', reqid: uploadFile.xfilePtr })); } else { - var end = uploadFile.xptr + 65536; + var end = uploadFile.xptr + 16384; if (end > data.byteLength) { if (dataPriming == true) { return; } end = data.byteLength; } var dataslice = new Uint8Array(data.slice(start, end)) if ((dataslice[0] == 123) || (dataslice[0] == 0)) { @@ -2312,27 +2250,6 @@ xxcurrentView = x; } - function putstore(name, val) { - try { - if ((typeof (localStorage) === 'undefined') || (localStorage.getItem(name) == val)) return; - if (val == null) { localStorage.removeItem(name); } else { localStorage.setItem(name, val); } - } catch (ex) { } - if (name[0] != '_') { - var s = {}; - try { - for (var i = 0, len = localStorage.length; i < len; ++i) { - var k = localStorage.key(i); - if (k[0] != '_') { - s[k] = localStorage.getItem(k); - if ((k != 'desktopsettings') && (k != 'stars') && (k != 'deskKeyShortcuts') && (k != 'deskStrings') && (k != 'cmdopt') && (typeof s[k] == 'string') && (s[k].length > 64)) { delete s[k]; } - } - } - } catch (ex) {} - // meshserver.send({ action: 'userWebState', state: JSON.stringify(s) }); - } - } - - function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } } function messagebox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t, 1); } function statusbox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t); } function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; } @@ -2366,4 +2283,4 @@ start(); - + \ No newline at end of file diff --git a/views/ssh.handlebars b/views/ssh.handlebars index e3924656..407e0489 100644 --- a/views/ssh.handlebars +++ b/views/ssh.handlebars @@ -37,12 +37,14 @@ -
    +
    -
    -
    +
    +
    +
    +
    ' + d.fileSplit[1].toLowerCase() + '' + d.fileSplit[2] + 'Delete
    Mesh Agents'; + response += '
    Mesh Agents'; res.send(response); return; } @@ -5862,9 +5318,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var response = 'Mesh Agents Cores'; response += ''; for (var i in parent.defaultMeshCores) { - response += ''; + response += ''; } - response += '
    NameSizeCompDecompressed Hash SHA384
    ' + i.split(' ').join(' ') + '' + parent.defaultMeshCores[i].length + (req.query.key ? ('?key=' + encodeURIComponent(req.query.key)) : '') + '' + parent.defaultMeshCoresDeflate[i].length + '' + Buffer.from(parent.defaultMeshCoresHash[i], 'binary').toString('hex') + '
    ' + i.split(' ').join(' ') + '' + parent.defaultMeshCores[i].length + (req.query.key ? ('?key=' + req.query.key) : '') + '' + parent.defaultMeshCoresDeflate[i].length + '' + Buffer.from(parent.defaultMeshCoresHash[i], 'binary').toString('hex') + '
    Mesh Agents'; + response += '
    Mesh Agents'; res.send(response); return; } @@ -5873,7 +5329,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Download mesh core var bin = parent.defaultMeshCores[req.query.dlcore]; if ((bin == null) || (bin.length < 5)) { try { res.sendStatus(404); } catch (ex) { } return; } - setContentDispositionHeader(res, 'application/octet-stream', encodeURIComponent(req.query.dlcore) + '.js', null, 'meshcore.js'); + setContentDispositionHeader(res, 'application/octet-stream', req.query.dlcore + '.js', null, 'meshcore.js'); res.send(bin.slice(4)); return; } @@ -5896,52 +5352,30 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var agentinfo = obj.parent.meshAgentBinaries[agentid]; if (domain.meshAgentBinaries && domain.meshAgentBinaries[agentid]) { argentInfo = domain.meshAgentBinaries[agentid]; } response += '
    ' + agentinfo.id + '' + agentinfo.desc.split(' ').join(' ') + '' + agentinfo.rname + ''; + response += '' + agentinfo.rname + ''; if ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0))) { - if ((agentid == 3) || (agentid == 4)) { response += ', PDB'; } + if ((agentid == 3) || (agentid == 4)) { response += ', PDB'; } } - if (agentinfo.zdata != null) { response += ', ZIP'; } + if (agentinfo.zdata != null) { response += ', ZIP'; } response += '' + agentinfo.size + '' + agentinfo.hashhex + '' + agentinfo.rname.replace('agent', 'cmd') + '
    ' + agentinfo.rname.replace('agent', 'cmd') + '
    '; - response += 'MeshCores '; - if (coreDumpsAllowed) { response += 'MeshAgent Crash Dumps'; } + response += 'MeshCores '; + if (coreDumpsAllowed) { response += 'MeshAgent Crash Dumps'; } response += ''; res.send(response); return; } }; - // generate the server url - obj.generateBaseURL = function (domain, req) { - var serverName = obj.getWebServerName(domain, req); - var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified - var xdomain = (domain.dns == null) ? domain.id : ''; - if (xdomain != '') xdomain += '/'; - return ('https://' + serverName + ':' + httpsPort + '/' + xdomain); - } - // Get the web server hostname. This may change if using a domain with a DNS name. - obj.getWebServerName = function (domain, req) { + obj.getWebServerName = function (domain) { if (domain.dns != null) return domain.dns; - if ((obj.certificates.CommonName == 'un-configured') && (req != null) && (req.headers != null) && (typeof req.headers.host == 'string')) { return req.headers.host.split(':')[0]; } return obj.certificates.CommonName; } - // Return true if this is an allowed HTTP request origin hostname. - obj.CheckWebServerOriginName = function (domain, req) { - if (domain.allowedorigin === true) return true; // Ignore origin - if (typeof req.headers.origin != 'string') return true; // No origin in the header, this is a desktop app - const originUrl = require('url').parse(req.headers.origin, true); - if (typeof originUrl.hostname != 'string') return false; // Origin hostname is not valid - if (Array.isArray(domain.allowedorigin)) return (domain.allowedorigin.indexOf(originUrl.hostname) >= 0); // Check if this is an allowed origin from an explicit list - if (obj.isTrustedCert(domain) === false) return true; // This server does not have a trusted certificate. - if (domain.dns != null) return (domain.dns == originUrl.hostname); // Match the domain DNS - return (obj.certificates.CommonName == originUrl.hostname); // Match the default server name - } - // Create a OSX mesh agent installer obj.handleMeshOsxAgentRequest = function (req, res) { const domain = getDomain(req, res); @@ -5974,7 +5408,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var serveridhex = Buffer.from(obj.agentCertificateHashBase64.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase(); // Get the agent connection server name - var serverName = obj.getWebServerName(domain, req); + var serverName = obj.getWebServerName(domain); if (typeof obj.args.agentaliasdns == 'string') { serverName = obj.args.agentaliasdns; } // Build the agent connection URL. If we are using a sub-domain or one with a DNS, we need to craft the URL correctly. @@ -5988,7 +5422,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF meshsettings += 'MeshServer=local\r\n'; if ((obj.args.localdiscovery != null) && (typeof obj.args.localdiscovery.key == 'string') && (obj.args.localdiscovery.key.length > 0)) { meshsettings += 'DiscoveryKey=' + obj.args.localdiscovery.key + '\r\n'; } } - if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + encodeURIComponent(req.query.tag) + '\r\n'; } + if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + req.query.tag + '\r\n'; } if ((req.query.installflags != null) && (req.query.installflags != 0) && (parseInt(req.query.installflags) == req.query.installflags)) { meshsettings += 'InstallFlags=' + parseInt(req.query.installflags) + '\r\n'; } if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; } if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } } @@ -6009,36 +5443,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var archive = require('archiver')('zip', { level: 5 }); // Sets the compression method. archive.on('error', function (err) { throw err; }); - // Customize the mesh agent file name - var meshfilename = 'MeshAgent-' + mesh.name + '.zip'; - var meshexecutablename = 'meshagent'; - var meshmpkgname = 'MeshAgent.mpkg'; - if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.filename == 'string')) { - meshfilename = meshfilename.split('MeshAgent').join(domain.agentcustomization.filename); - meshexecutablename = meshexecutablename.split('meshagent').join(domain.agentcustomization.filename); - meshmpkgname = meshmpkgname.split('MeshAgent').join(domain.agentcustomization.filename); - } - - // Customise the mesh agent display name - var meshdisplayname = 'Mesh Agent'; - if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.displayname == 'string')) { - meshdisplayname = meshdisplayname.split('Mesh Agent').join(domain.agentcustomization.displayname); - } - - // Customise the mesh agent service name - var meshservicename = 'meshagent'; - if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.servicename == 'string')) { - meshservicename = meshservicename.split('meshagent').join(domain.agentcustomization.servicename); - } - - // Customise the mesh agent company name - var meshcompanyname = 'meshagent'; - if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.companyname == 'string')) { - meshcompanyname = meshcompanyname.split('meshagent').join(domain.agentcustomization.companyname); - } - // Set the agent download including the mesh name. - setContentDispositionHeader(res, 'application/octet-stream', meshfilename, null, 'MeshAgent.zip'); + setContentDispositionHeader(res, 'application/octet-stream', 'MeshAgent-' + mesh.name + '.zip', null, 'MeshAgent.zip'); archive.pipe(res); // Opens the "MeshAgentOSXPackager.zip" @@ -6057,34 +5463,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF readStream.on('data', function (data) { if (readStream.xxdata) { readStream.xxdata += data; } else { readStream.xxdata = data; } }); readStream.on('end', function () { var meshname = mesh.name.split(']').join('').split('[').join(''); // We can't have ']]' in the string since it will terminate the CDATA. - var welcomemsg = 'Welcome to the MeshCentral agent for MacOS\n\nThis installer will install the mesh agent for "' + meshname + '" and allow the administrator to remotely monitor and control this computer over the internet. For more information, go to https://meshcentral.com.\n\nThis software is provided under Apache 2.0 license.\n'; + var welcomemsg = 'Welcome to the MeshCentral agent for MacOS\n\nThis installer will install the mesh agent for "' + meshname + '" and allow the administrator to remotely monitor and control this computer over the internet. For more information, go to https://www.meshcommander.com/meshcentral2.\n\nThis software is provided under Apache 2.0 license.\n'; var installsize = Math.floor((argentInfo.size + meshsettings.length) / 1024); - archive.append(readStream.xxdata.toString().split('###DISPLAYNAME###').join(meshdisplayname).split('###WELCOMEMSG###').join(welcomemsg).split('###INSTALLSIZE###').join(installsize), { name: entry.fileName.replace('MeshAgent.mpkg',meshmpkgname) }); + archive.append(readStream.xxdata.toString().split('###WELCOMEMSG###').join(welcomemsg).split('###INSTALLSIZE###').join(installsize), { name: entry.fileName }); zipfile.readEntry(); }); }); - } else if (entry.fileName == 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64_LaunchAgent.plist' || - entry.fileName == 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64_LaunchDaemon.plist' || - entry.fileName == 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/Info.plist' || - entry.fileName == 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/Resources/postflight' || - entry.fileName == 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/Resources/Postflight.sh' || - entry.fileName == 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/Uninstall.command' || - entry.fileName == 'MeshAgent.mpkg/Uninstall.command') { - // This is a special file entry, we need to fix it. - zipfile.openReadStream(entry, function (err, readStream) { - readStream.on('data', function (data) { if (readStream.xxdata) { readStream.xxdata += data; } else { readStream.xxdata = data; } }); - readStream.on('end', function () { - var options = { name: entry.fileName.replace('MeshAgent.mpkg',meshmpkgname) }; - if (entry.fileName.endsWith('postflight') || entry.fileName.endsWith('Uninstall.command')) { options.mode = 493; } - archive.append(readStream.xxdata.toString().split('###SERVICENAME###').join(meshservicename).split('###COMPANYNAME###').join(meshcompanyname).split('###EXECUTABLENAME###').join(meshexecutablename), options); - zipfile.readEntry(); - }); - }); } else { // Normal file entry zipfile.openReadStream(entry, function (err, readStream) { if (err) { throw err; } - var options = { name: entry.fileName.replace('MeshAgent.mpkg',meshmpkgname) }; + var options = { name: entry.fileName }; if (entry.fileName.endsWith('postflight') || entry.fileName.endsWith('Uninstall.command')) { options.mode = 493; } archive.append(readStream, options); readStream.on('end', function () { zipfile.readEntry(); }); @@ -6093,8 +5482,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } }); zipfile.on('end', function () { - archive.file(argentInfo.path, { name: 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.bin'.replace('MeshAgent.mpkg',meshmpkgname) }); - archive.append(meshsettings, { name: 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.msh'.replace('MeshAgent.mpkg',meshmpkgname) }); + archive.file(argentInfo.path, { name: 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.bin' }); + archive.append(meshsettings, { name: 'MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.msh' }); archive.finalize(); }); }); @@ -6122,7 +5511,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var serveridhex = Buffer.from(obj.agentCertificateHashBase64.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase(); // Get the agent connection server name - var serverName = obj.getWebServerName(domain, req); + var serverName = obj.getWebServerName(domain); if (typeof obj.args.agentaliasdns == 'string') { serverName = obj.args.agentaliasdns; } // Build the agent connection URL. If we are using a sub-domain or one with a DNS, we need to craft the URL correctly. @@ -6136,7 +5525,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF meshsettings += 'MeshServer=local\r\n'; if ((obj.args.localdiscovery != null) && (typeof obj.args.localdiscovery.key == 'string') && (obj.args.localdiscovery.key.length > 0)) { meshsettings += 'DiscoveryKey=' + obj.args.localdiscovery.key + '\r\n'; } } - if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + encodeURIComponent(req.query.tag) + '\r\n'; } + if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + req.query.tag + '\r\n'; } if ((req.query.installflags != null) && (req.query.installflags != 0) && (parseInt(req.query.installflags) == req.query.installflags)) { meshsettings += 'InstallFlags=' + parseInt(req.query.installflags) + '\r\n'; } if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; } if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } } @@ -6274,47 +5663,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Setup the HTTP server without TLS obj.expressWs = require('express-ws')(obj.app, null, { wsOptions: { perMessageDeflate: (args.wscompression === true) } }); } else { - var ciphers = [ - 'TLS_AES_256_GCM_SHA384', - 'TLS_AES_128_GCM_SHA256', - 'TLS_AES_128_CCM_8_SHA256', - 'TLS_AES_128_CCM_SHA256', - 'TLS_CHACHA20_POLY1305_SHA256', - 'ECDHE-RSA-AES256-GCM-SHA384', - 'ECDHE-ECDSA-AES256-GCM-SHA384', - 'ECDHE-RSA-AES128-GCM-SHA256', - 'ECDHE-ECDSA-AES128-GCM-SHA256', - 'DHE-RSA-AES128-GCM-SHA256', - 'ECDHE-RSA-CHACHA20-POLY1305', // TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8) - 'ECDHE-ARIA128-GCM-SHA256', - 'ECDHE-ARIA256-GCM-SHA384', - 'ECDHE-RSA-AES128-SHA256', // SSLlabs considers this cipher suite weak, but it's needed for older browers. - 'ECDHE-RSA-AES256-SHA384', // SSLlabs considers this cipher suite weak, but it's needed for older browers. - '!aNULL', - '!eNULL', - '!EXPORT', - '!DES', - '!RC4', - '!MD5', - '!PSK', - '!SRP', - '!CAMELLIA' - ].join(':'); - - if (obj.useNodeDefaultTLSCiphers) { - ciphers = require("tls").DEFAULT_CIPHERS; - } - - if (obj.tlsCiphers) { - ciphers = obj.tlsCiphers; - if (Array.isArray(obj.tlsCiphers)) { - ciphers = obj.tlsCiphers.join(":"); - } - } - // Setup the HTTP server with TLS, use only TLS 1.2 and higher with perfect forward secrecy (PFS). //const tlsOptions = { cert: obj.certificates.web.cert, key: obj.certificates.web.key, ca: obj.certificates.web.ca, rejectUnauthorized: true, ciphers: "HIGH:!aNULL:!eNULL:!EXPORT:!RSA:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA", secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE | constants.SSL_OP_NO_TLSv1 | constants.SSL_OP_NO_TLSv1_1 }; // This does not work with TLS 1.3 - const tlsOptions = { cert: obj.certificates.web.cert, key: obj.certificates.web.key, ca: obj.certificates.web.ca, rejectUnauthorized: true, ciphers: ciphers, secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE | constants.SSL_OP_NO_TLSv1 | constants.SSL_OP_NO_TLSv1_1 }; + const tlsOptions = { cert: obj.certificates.web.cert, key: obj.certificates.web.key, ca: obj.certificates.web.ca, rejectUnauthorized: true, ciphers: "HIGH:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_AES_128_CCM_SHA256:TLS_CHACHA20_POLY1305_SHA256", secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE | constants.SSL_OP_NO_TLSv1 | constants.SSL_OP_NO_TLSv1_1 }; if (obj.tlsSniCredentials != null) { tlsOptions.SNICallback = TlsSniCallback; } // We have multiple web server certificate used depending on the domain name obj.tlsServer = require('https').createServer(tlsOptions, obj.app); obj.tlsServer.on('secureConnection', function () { /*console.log('tlsServer secureConnection');*/ }); @@ -6350,7 +5701,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } // Setup middleware - obj.app.engine('handlebars', obj.exphbs.engine({ defaultLayout: false })); + obj.app.engine('handlebars', obj.exphbs({ defaultLayout: false })); obj.app.set('view engine', 'handlebars'); if (obj.args.trustedproxy) { // Reverse proxy should add the "X-Forwarded-*" headers @@ -6362,7 +5713,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF require('dns').lookup(obj.args.trustedproxy[0], function (err, address, family) { if (err == null) { obj.app.set('trust proxy', address); obj.args.trustedproxy = [address]; } }); } } - } + } else if (typeof obj.args.tlsoffload == 'object') { // Reverse proxy should add the "X-Forwarded-*" headers try { @@ -6374,46 +5725,19 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } } } - - // Setup a keygrip instance with higher default security, default hash is SHA1, we want to bump that up with SHA384 - // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances - // If args.sessionkey is a string, use it as a single key, but args.sessionkey can also be used as an array of keys. - const keygrip = require('keygrip')((typeof obj.args.sessionkey == 'string') ? [obj.args.sessionkey] : obj.args.sessionkey, 'sha384', 'base64'); - - // Setup the cookie session - const sessionOptions = { + obj.app.use(obj.bodyParser.urlencoded({ extended: false })); + var sessionOptions = { name: 'xid', // Recommended security practice to not use the default cookie name httpOnly: true, - keys: keygrip, + keys: [obj.args.sessionkey], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances secure: (obj.args.tlsoffload == null), // Use this cookie only over TLS (Check this: https://expressjs.com/en/guide/behind-proxies.html) - sameSite: (obj.args.sessionsamesite ? obj.args.sessionsamesite : 'lax') + sameSite: obj.args.sessionsamesite } - if (obj.args.sessiontime != null) { sessionOptions.maxAge = (obj.args.sessiontime * 60000); } // sessiontime is minutes - obj.app.use(require('cookie-session')(sessionOptions)); - obj.app.use(function (request, response, next) { // Patch for passport 0.6.0 - https://github.com/jaredhanson/passport/issues/904 - if (request.session && !request.session.regenerate) { - request.session.regenerate = function (cb) { - cb() - } - } - if (request.session && !request.session.save) { - request.session.save = function (cb) { - cb() - } - } - next() - }); - - // Handle all incoming web sockets, see if some need to be handled as web relays - obj.app.ws('/*', function (ws, req, next) { - // Global error catcher - ws.on('error', function (err) { parent.debug('web', 'GENERAL WSERR: ' + err); console.log(err); }); - if ((obj.webRelayRouter != null) && (obj.args.relaydns.indexOf(req.hostname) >= 0)) { handleWebRelayWebSocket(ws, req); return; } - return next(); - }); + if (obj.args.sessiontime != null) { sessionOptions.maxAge = (obj.args.sessiontime * 60 * 1000); } + obj.app.use(obj.session(sessionOptions)); // Add HTTP security headers to all responses - obj.app.use(async function (req, res, next) { + obj.app.use(function (req, res, next) { // Check if a session is destroyed if (typeof req.session.userid == 'string') { if (typeof req.session.x == 'string') { @@ -6430,8 +5754,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } // Remove legacy values from the session to keep the session as small as possible - delete req.session.u2f; delete req.session.domainid; + delete req.session.u2fchallenge delete req.session.nowInMinutes; delete req.session.tokenuserid; delete req.session.tokenusername; @@ -6511,16 +5835,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF req.clientIp = ipex; } - // If this is a web relay connection, handle it here. - if ((obj.webRelayRouter != null) && (obj.args.relaydns.indexOf(req.hostname) >= 0)) { - if (['GET', 'POST', 'PUT', 'HEAD', 'DELETE', 'OPTIONS'].indexOf(req.method) >= 0) { return obj.webRelayRouter(req, res); } else { res.sendStatus(404); return; } - } - // Get the domain for this request const domain = req.xdomain = getDomain(req); parent.debug('webrequest', '(' + req.clientIp + ') ' + req.url); - // Skip the rest if this is an agent connection + // Skip the rest is this is an agent connection if ((req.url.indexOf('/meshrelay.ashx/.websocket') >= 0) || (req.url.indexOf('/agent.ashx/.websocket') >= 0) || (req.url.indexOf('/localrelay.ashx/.websocket') >= 0)) { next(); return; } // Setup security headers @@ -6536,12 +5855,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF if ((xforwardedhost != null) && (xforwardedhost != req.headers.host)) { extraFrameSrc += ' https://' + xforwardedhost + ':' + parent.webrelayserver.port; } } - // Finish setup security headers const headers = { 'Referrer-Policy': 'no-referrer', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', - 'Content-Security-Policy': "default-src 'none'; font-src 'self' fonts.gstatic.com data:; script-src 'self' 'unsafe-inline' " + extraScriptSrc + "; connect-src 'self'" + geourl + selfurl + "; img-src 'self' blob: data:" + geourl + " data:; style-src 'self' 'unsafe-inline' fonts.googleapis.com; frame-src 'self' blob: mcrouter:" + extraFrameSrc + "; media-src 'self'; form-action 'self'; manifest-src 'self'" + 'Content-Security-Policy': "default-src 'none'; font-src 'self'; script-src 'self' 'unsafe-inline'" + extraScriptSrc + "; connect-src 'self'" + geourl + selfurl + "; img-src 'self' blob: data:" + geourl + " data:; style-src 'self' 'unsafe-inline'; frame-src 'self' mcrouter:" + extraFrameSrc + "; media-src 'self'; form-action 'self'" }; if (req.headers['user-agent'] && (req.headers['user-agent'].indexOf('Chrome') >= 0)) { headers['Permissions-Policy'] = 'interest-cohort=()'; } // Remove Google's FLoC Network, only send this if Chrome browser if ((parent.config.settings.allowframing !== true) && (typeof parent.config.settings.allowframing !== 'string')) { headers['X-Frame-Options'] = 'sameorigin'; } @@ -6559,9 +5877,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Extend the session time by forcing a change to the session every minute. if (req.session.userid != null) { req.session.t = Math.floor(Date.now() / 60e3); } else { delete req.session.t; } - // Check CrowdSec Bounser if configured - if ((parent.crowdSecBounser != null) && (req.headers['upgrade'] != 'websocket') && (req.session.userid == null)) { if ((await parent.crowdSecBounser.process(domain, req, res, next)) == true) { return; } } - // Debugging code, this will stop the agent from crashing if two responses are made to the same request. const render = res.render; const send = res.send; @@ -6578,7 +5893,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var errlogpath = null; if (typeof parent.args.mesherrorlogpath == 'string') { errlogpath = parent.path.join(parent.args.mesherrorlogpath, 'mesherrors.txt'); } else { errlogpath = parent.getConfigFilePath('mesherrors.txt'); } parent.fs.appendFileSync(errlogpath, new Date().toLocaleString() + ': ' + `Error in res.send | ${err.code} | ${err.message} | ${res.stack}` + '\r\n'); - } catch (ex) { parent.debug('error', 'Unable to write to mesherrors.txt.'); } + } catch (ex) { console.log('ERROR: Unable to write to mesherrors.txt.'); } } }; @@ -6619,132 +5934,578 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF }); } - // Setup all sharing domains and check if auth strategies need setup - var setupSSO = false + // Setup all sharing domains for (var i in parent.config.domains) { if ((parent.config.domains[i].dns == null) && (parent.config.domains[i].share != null)) { obj.app.use(parent.config.domains[i].url, obj.express.static(parent.config.domains[i].share)); } - if (typeof parent.config.domains[i].authstrategies == 'object') { setupSSO = true }; } - if (setupSSO) { - setupAllDomainAuthStrategies().then(() => finalizeWebserver()); - } else { - finalizeWebserver() - } - - // Setup all domain auth strategy passport.js - async function setupAllDomainAuthStrategies() { - for (var i in parent.config.domains) { - if (parent.config.domains[i].dns != null) { - if (typeof parent.config.domains[''].authstrategies != 'object') { parent.config.domains[''].authstrategies = { 'authStrategyFlags': 0 }; } - parent.config.domains[''].authstrategies.authStrategyFlags |= await setupDomainAuthStrategy(parent.config.domains[i]); - } else { - if (typeof parent.config.domains[i].authstrategies != 'object') { parent.config.domains[i].authstrategies = { 'authStrategyFlags': 0 }; } - parent.config.domains[i].authstrategies.authStrategyFlags |= await setupDomainAuthStrategy(parent.config.domains[i]); - } + // Setup all HTTP handlers + if (parent.multiServer != null) { obj.app.ws('/meshserver.ashx', function (ws, req) { parent.multiServer.CreatePeerInServer(parent.multiServer, ws, req, obj.args.tlsoffload == null); }); } + for (var i in parent.config.domains) { + if ((parent.config.domains[i].dns != null) || (parent.config.domains[i].share != null)) { continue; } // This is a subdomain with a DNS name, no added HTTP bindings needed. + var domain = parent.config.domains[i]; + var url = domain.url; + if (typeof domain.rootredirect == 'string') { + // Root page redirects the user to a different URL + obj.app.get(url, handleRootRedirect); + } else { + // Present the login page as the root page + obj.app.get(url, handleRootRequest); + obj.app.post(url, handleRootPostRequest); } - } - function setupHTTPHandlers() { - // Setup all HTTP handlers - if (parent.pluginHandler != null) { - parent.pluginHandler.callHook('hook_setupHttpHandlers', obj, parent); - } - if (parent.multiServer != null) { obj.app.ws('/meshserver.ashx', function (ws, req) { parent.multiServer.CreatePeerInServer(parent.multiServer, ws, req, obj.args.tlsoffload == null); }); } - for (var i in parent.config.domains) { - if ((parent.config.domains[i].dns != null) || (parent.config.domains[i].share != null)) { continue; } // This is a subdomain with a DNS name, no added HTTP bindings needed. - var domain = parent.config.domains[i]; - var url = domain.url; - if (typeof domain.rootredirect == 'string') { - // Root page redirects the user to a different URL - obj.app.get(url, handleRootRedirect); - } else { - // Present the login page as the root page - obj.app.get(url, handleRootRequest); - obj.app.post(url, obj.bodyParser.urlencoded({ extended: false }), handleRootPostRequest); - } - obj.app.get(url + 'refresh.ashx', function (req, res) { res.sendStatus(200); }); - if ((domain.myserver !== false) && ((domain.myserver == null) || (domain.myserver.backup === true))) { obj.app.get(url + 'backup.zip', handleBackupRequest); } - if ((domain.myserver !== false) && ((domain.myserver == null) || (domain.myserver.restore === true))) { obj.app.post(url + 'restoreserver.ashx', obj.bodyParser.urlencoded({ extended: false }), handleRestoreRequest); } - obj.app.get(url + 'terms', handleTermsRequest); - obj.app.get(url + 'xterm', handleXTermRequest); - obj.app.get(url + 'login', handleRootRequest); - obj.app.post(url + 'login', obj.bodyParser.urlencoded({ extended: false }), handleRootPostRequest); - obj.app.post(url + 'tokenlogin', obj.bodyParser.urlencoded({ extended: false }), handleLoginRequest); - obj.app.get(url + 'logout', handleLogoutRequest); - obj.app.get(url + 'MeshServerRootCert.cer', handleRootCertRequest); - obj.app.get(url + 'manifest.json', handleManifestRequest); - obj.app.post(url + 'changepassword', obj.bodyParser.urlencoded({ extended: false }), handlePasswordChangeRequest); - obj.app.post(url + 'deleteaccount', obj.bodyParser.urlencoded({ extended: false }), handleDeleteAccountRequest); - obj.app.post(url + 'createaccount', obj.bodyParser.urlencoded({ extended: false }), handleCreateAccountRequest); - obj.app.post(url + 'resetpassword', obj.bodyParser.urlencoded({ extended: false }), handleResetPasswordRequest); - obj.app.post(url + 'resetaccount', obj.bodyParser.urlencoded({ extended: false }), handleResetAccountRequest); - obj.app.get(url + 'checkmail', handleCheckMailRequest); - obj.app.get(url + 'agentinvite', handleAgentInviteRequest); - obj.app.get(url + 'userimage.ashx', handleUserImageRequest); - obj.app.post(url + 'amtevents.ashx', obj.bodyParser.urlencoded({ extended: false }), obj.handleAmtEventRequest); - obj.app.get(url + 'meshagents', obj.handleMeshAgentRequest); - obj.app.get(url + 'messenger', handleMessengerRequest); - obj.app.get(url + 'messenger.png', handleMessengerImageRequest); - obj.app.get(url + 'meshosxagent', obj.handleMeshOsxAgentRequest); - obj.app.get(url + 'meshsettings', obj.handleMeshSettingsRequest); - obj.app.get(url + 'devicepowerevents.ashx', obj.handleDevicePowerEvents); - obj.app.get(url + 'downloadfile.ashx', handleDownloadFile); - obj.app.get(url + 'commander.ashx', handleMeshCommander); - obj.app.post(url + 'uploadfile.ashx', obj.bodyParser.urlencoded({ extended: false }), handleUploadFile); - obj.app.post(url + 'uploadfilebatch.ashx', obj.bodyParser.urlencoded({ extended: false }), handleUploadFileBatch); - obj.app.post(url + 'uploadmeshcorefile.ashx', obj.bodyParser.urlencoded({ extended: false }), handleUploadMeshCoreFile); - obj.app.post(url + 'oneclickrecovery.ashx', obj.bodyParser.urlencoded({ extended: false }), handleOneClickRecoveryFile); - obj.app.get(url + 'userfiles/*', handleDownloadUserFiles); - obj.app.ws(url + 'echo.ashx', handleEchoWebSocket); - obj.app.ws(url + '2fahold.ashx', handle2faHoldWebSocket); - obj.app.ws(url + 'apf.ashx', function (ws, req) { obj.parent.mpsserver.onWebSocketConnection(ws, req); }) - obj.app.get(url + 'webrelay.ashx', function (req, res) { res.send('Websocket connection expected'); }); - obj.app.get(url + 'health.ashx', function (req, res) { res.send('ok'); }); // TODO: Perform more server checking. - obj.app.ws(url + 'webrelay.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, handleRelayWebSocket); }); - obj.app.ws(url + 'webider.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, function (ws1, req1, domain, user, cookie, authData) { obj.meshIderHandler.CreateAmtIderSession(obj, obj.db, ws1, req1, obj.args, domain, user); }); }); - obj.app.ws(url + 'control.ashx', function (ws, req) { - getWebsocketArgs(ws, req, function (ws, req) { - const domain = getDomain(req); - if (obj.CheckWebServerOriginName(domain, req) == false) { - try { ws.send(JSON.stringify({ action: 'close', cause: 'invalidorigin', msg: 'invalidorigin' })); } catch (ex) { } - try { ws.close(); } catch (ex) { } - return; - } - if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { // Check 3FA URL key - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'nokey' })); } catch (ex) { } - try { ws.close(); } catch (ex) { } - return; - } - PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { - if (user == null) { // User is not authenticated, perform inner server authentication - if (req.headers['x-meshauth'] === '*') { - PerformWSSessionInnerAuth(ws, req, domain, function (ws1, req1, domain, user) { obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws1, req1, obj.args, domain, user, authData); }); // User is authenticated - } else { - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'noauth' })); } catch (ex) { } - try { ws.close(); } catch (ex) { } // user is not authenticated and inner authentication was not requested, disconnect now. - } + obj.app.get(url + 'refresh.ashx', function (req, res) { res.sendStatus(200); }); + if ((domain.myserver !== false) && ((domain.myserver == null) || (domain.myserver.backup === true))) { obj.app.get(url + 'backup.zip', handleBackupRequest); } + if ((domain.myserver !== false) && ((domain.myserver == null) || (domain.myserver.restore === true))) { obj.app.post(url + 'restoreserver.ashx', handleRestoreRequest); } + obj.app.get(url + 'terms', handleTermsRequest); + obj.app.get(url + 'xterm', handleXTermRequest); + obj.app.get(url + 'login', handleRootRequest); + obj.app.post(url + 'login', handleRootPostRequest); + obj.app.post(url + 'tokenlogin', handleLoginRequest); + obj.app.get(url + 'logout', handleLogoutRequest); + obj.app.get(url + 'MeshServerRootCert.cer', handleRootCertRequest); + obj.app.post(url + 'changepassword', handlePasswordChangeRequest); + obj.app.post(url + 'deleteaccount', handleDeleteAccountRequest); + obj.app.post(url + 'createaccount', handleCreateAccountRequest); + obj.app.post(url + 'resetpassword', handleResetPasswordRequest); + obj.app.post(url + 'resetaccount', handleResetAccountRequest); + obj.app.get(url + 'checkmail', handleCheckMailRequest); + obj.app.get(url + 'agentinvite', handleAgentInviteRequest); + obj.app.get(url + 'userimage.ashx', handleUserImageRequest); + obj.app.post(url + 'amtevents.ashx', obj.handleAmtEventRequest); + obj.app.get(url + 'meshagents', obj.handleMeshAgentRequest); + obj.app.get(url + 'messenger', handleMessengerRequest); + obj.app.get(url + 'messenger.png', handleMessengerImageRequest); + obj.app.get(url + 'meshosxagent', obj.handleMeshOsxAgentRequest); + obj.app.get(url + 'meshsettings', obj.handleMeshSettingsRequest); + obj.app.get(url + 'devicepowerevents.ashx', obj.handleDevicePowerEvents); + obj.app.get(url + 'downloadfile.ashx', handleDownloadFile); + obj.app.post(url + 'uploadfile.ashx', handleUploadFile); + obj.app.post(url + 'uploadfilebatch.ashx', handleUploadFileBatch); + obj.app.post(url + 'uploadmeshcorefile.ashx', handleUploadMeshCoreFile); + obj.app.post(url + 'oneclickrecovery.ashx', handleOneClickRecoveryFile); + obj.app.get(url + 'userfiles/*', handleDownloadUserFiles); + obj.app.ws(url + 'echo.ashx', handleEchoWebSocket); + obj.app.ws(url + '2fahold.ashx', handle2faHoldWebSocket); + obj.app.ws(url + 'apf.ashx', function (ws, req) { obj.parent.mpsserver.onWebSocketConnection(ws, req); }) + obj.app.get(url + 'webrelay.ashx', function (req, res) { res.send('Websocket connection expected'); }); + obj.app.get(url + 'health.ashx', function (req, res) { res.send('ok'); }); // TODO: Perform more server checking. + obj.app.ws(url + 'webrelay.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, handleRelayWebSocket); }); + obj.app.ws(url + 'webider.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, function (ws1, req1, domain, user, cookie, authData) { obj.meshIderHandler.CreateAmtIderSession(obj, obj.db, ws1, req1, obj.args, domain, user); }); }); + obj.app.ws(url + 'control.ashx', function (ws, req) { + getWebsocketArgs(ws, req, function (ws, req) { + const domain = getDomain(req); + if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { ws.close(); return; } // Check 3FA URL key + PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { + if (user == null) { // User is not authenticated, perform inner server authentication + if (req.headers['x-meshauth'] === '*') { + PerformWSSessionInnerAuth(ws, req, domain, function (ws1, req1, domain, user) { obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws1, req1, obj.args, domain, user, authData); }); // User is authenticated } else { - obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws1, req1, obj.args, domain, user, authData); // User is authenticated + try { ws.close(); } catch (ex) { } // user is not authenticated and inner authentication was not requested, disconnect now. } - }); + } else { + obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws1, req1, obj.args, domain, user, authData); // User is authenticated + } }); }); - obj.app.ws(url + 'devicefile.ashx', function (ws, req) { obj.meshDeviceFileHandler.CreateMeshDeviceFile(obj, ws, null, req, domain); }); - obj.app.get(url + 'devicefile.ashx', handleDeviceFile); - obj.app.get(url + 'agentdownload.ashx', handleAgentDownloadFile); - obj.app.get(url + 'logo.png', handleLogoRequest); - obj.app.get(url + 'loginlogo.png', handleLoginLogoRequest); - obj.app.get(url + 'pwalogo.png', handlePWALogoRequest); - obj.app.post(url + 'translations', obj.bodyParser.urlencoded({ extended: false }), handleTranslationsRequest); - obj.app.get(url + 'welcome.jpg', handleWelcomeImageRequest); - obj.app.get(url + 'welcome.png', handleWelcomeImageRequest); - obj.app.get(url + 'recordings.ashx', handleGetRecordings); - obj.app.ws(url + 'recordings.ashx', handleGetRecordingsWebSocket); - obj.app.get(url + 'player.htm', handlePlayerRequest); - obj.app.get(url + 'player', handlePlayerRequest); - obj.app.get(url + 'sharing', handleSharingRequest); - obj.app.ws(url + 'agenttransfer.ashx', handleAgentFileTransfer); // Setup agent to/from server file transfer handler - obj.app.ws(url + 'meshrelay.ashx', function (ws, req) { + }); + obj.app.ws(url + 'devicefile.ashx', function (ws, req) { obj.meshDeviceFileHandler.CreateMeshDeviceFile(obj, ws, null, req, domain); }); + obj.app.get(url + 'devicefile.ashx', handleDeviceFile); + obj.app.get(url + 'agentdownload.ashx', handleAgentDownloadFile); + obj.app.get(url + 'logo.png', handleLogoRequest); + obj.app.get(url + 'loginlogo.png', handleLoginLogoRequest); + obj.app.post(url + 'translations', handleTranslationsRequest); + obj.app.get(url + 'welcome.jpg', handleWelcomeImageRequest); + obj.app.get(url + 'welcome.png', handleWelcomeImageRequest); + obj.app.get(url + 'recordings.ashx', handleGetRecordings); + obj.app.ws(url + 'recordings.ashx', handleGetRecordingsWebSocket); + obj.app.get(url + 'player.htm', handlePlayerRequest); + obj.app.get(url + 'player', handlePlayerRequest); + obj.app.get(url + 'sharing', handleSharingRequest); + obj.app.ws(url + 'agenttransfer.ashx', handleAgentFileTransfer); // Setup agent to/from server file transfer handler + obj.app.ws(url + 'meshrelay.ashx', function (ws, req) { + PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { + if (((parent.config.settings.desktopmultiplex === true) || (domain.desktopmultiplex === true)) && (req.query.p == 2)) { + obj.meshDesktopMultiplexHandler.CreateMeshRelay(obj, ws1, req1, domain, user, cookie); // Desktop multiplexor 1-to-n + } else { + obj.meshRelayHandler.CreateMeshRelay(obj, ws1, req1, domain, user, cookie); // Normal relay 1-to-1 + } + }); + }); + if (obj.args.wanonly != true) { // If the server is not in WAN mode, allow server relayed connections. + obj.app.ws(url + 'localrelay.ashx', function (ws, req) { + PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { + if ((user == null) || (cookie == null)) { + try { ws1.close(); } catch (ex) { } + } else { + obj.meshRelayHandler.CreateLocalRelay(obj, ws1, req1, domain, user, cookie); // Local relay + } + }); + }); + } + if (domain.agentinvitecodes == true) { + obj.app.get(url + 'invite', handleInviteRequest); + obj.app.post(url + 'invite', handleInviteRequest); + } + if (parent.pluginHandler != null) { + obj.app.get(url + 'pluginadmin.ashx', obj.handlePluginAdminReq); + obj.app.post(url + 'pluginadmin.ashx', obj.handlePluginAdminPostReq); + obj.app.get(url + 'pluginHandler.js', obj.handlePluginJS); + } + + // Setup IP-KVM relay if supported + if (domain.ipkvm) { + obj.app.ws(url + 'ipkvm.ashx/*', function (ws, req) { + const domain = getDomain(req); + if (domain == null) { parent.debug('web', 'ipkvm: failed domain checks.'); try { ws.close(); } catch (ex) { } return; } + parent.ipKvmManager.handleIpKvmWebSocket(domain, ws, req); + }); + obj.app.get(url + 'ipkvm.ashx/*', function (req, res, next) { + const domain = getDomain(req); + if (domain == null) return; + parent.ipKvmManager.handleIpKvmGet(domain, req, res, next); + }); + } + + // Setup RDP unless indicated as disabled + if (domain.mstsc !== false) { + obj.app.get(url + 'mstsc.html', function (req, res) { handleMSTSCRequest(req, res, 'mstsc'); }); + obj.app.ws(url + 'mstscrelay.ashx', function (ws, req) { + const domain = getDomain(req); + if (domain == null) { parent.debug('web', 'mstsc: failed checks.'); try { ws.close(); } catch (e) { } return; } + // If no user is logged in and we have a default user, set it now. + if ((req.session.userid == null) && (typeof obj.args.user == 'string') && (obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()])) { req.session.userid = 'user/' + domain.id + '/' + obj.args.user.toLowerCase(); } + try { require('./apprelays.js').CreateMstscRelay(obj, obj.db, ws, req, obj.args, domain); } catch (ex) { console.log(ex); } + }); + } + + // Setup SSH if needed + if (domain.ssh === true) { + obj.app.get(url + 'ssh.html', function (req, res) { handleMSTSCRequest(req, res, 'ssh'); }); + obj.app.ws(url + 'sshrelay.ashx', function (ws, req) { + const domain = getDomain(req); + if (domain == null) { parent.debug('web', 'ssh: failed checks.'); try { ws.close(); } catch (e) { } return; } + // If no user is logged in and we have a default user, set it now. + if ((req.session.userid == null) && (typeof obj.args.user == 'string') && (obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()])) { req.session.userid = 'user/' + domain.id + '/' + obj.args.user.toLowerCase(); } + try { require('./apprelays.js').CreateSshRelay(obj, obj.db, ws, req, obj.args, domain); } catch (ex) { console.log(ex); } + }); + obj.app.ws(url + 'sshterminalrelay.ashx', function (ws, req) { + PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { + require('./apprelays.js').CreateSshTerminalRelay(obj, obj.db, ws1, req1, domain, user, cookie, obj.args); + }); + }); + obj.app.ws(url + 'sshfilesrelay.ashx', function (ws, req) { + PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { + require('./apprelays.js').CreateSshFilesRelay(obj, obj.db, ws1, req1, domain, user, cookie, obj.args); + }); + }); + } + + // Setup firebase push only server + if ((obj.parent.firebase != null) && (obj.parent.config.firebase)) { + if (obj.parent.config.firebase.pushrelayserver) { parent.debug('email', 'Firebase-pushrelay-handler'); obj.app.post(url + 'firebaserelay.aspx', handleFirebasePushOnlyRelayRequest); } + if (obj.parent.config.firebase.relayserver) { parent.debug('email', 'Firebase-relay-handler'); obj.app.ws(url + 'firebaserelay.aspx', handleFirebaseRelayRequest); } + } + + // Setup auth strategies using passport if needed + if (typeof domain.authstrategies == 'object') { + const passport = domain.passport = require('passport'); + passport.serializeUser(function (user, done) { done(null, user.sid); }); + passport.deserializeUser(function (sid, done) { done(null, { sid: sid }); }); + obj.app.use(passport.initialize()); + //obj.app.use(passport.session()); + + // Twitter + if ((typeof domain.authstrategies.twitter == 'object') && (typeof domain.authstrategies.twitter.clientid == 'string') && (typeof domain.authstrategies.twitter.clientsecret == 'string')) { + const TwitterStrategy = require('passport-twitter'); + var options = { consumerKey: domain.authstrategies.twitter.clientid, consumerSecret: domain.authstrategies.twitter.clientsecret }; + if (typeof domain.authstrategies.twitter.callbackurl == 'string') { options.callbackURL = domain.authstrategies.twitter.callbackurl; } else { options.callbackURL = url + 'auth-twitter-callback'; } + parent.debug('web', 'Adding Twitter SSO with options: ' + JSON.stringify(options)); + passport.use('twitter-' + domain.id, new TwitterStrategy(options, + function (token, tokenSecret, profile, cb) { + parent.debug('web', 'Twitter profile: ' + JSON.stringify(profile)); + var user = { sid: '~twitter:' + profile.id, name: profile.displayName, strategy: 'twitter' }; + if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; } + return cb(null, user); + } + )); + obj.app.get(url + 'auth-twitter', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('twitter-' + domain.id)(req, res, function (err) { console.log('c1', err, req.session); next(); }); + }); + obj.app.get(url + 'auth-twitter-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + if ((Object.keys(req.session).length == 0) && (req.query.nmr == null)) { + // This is an empty session likely due to the 302 redirection, redirect again (this is a bit of a hack). + var url = req.url; + if (url.indexOf('?') >= 0) { url += '&nmr=1'; } else { url += '?nmr=1'; } // Add this to the URL to prevent redirect loop. + res.set('Content-Type', 'text/html'); + res.end(''); + } else { + domain.passport.authenticate('twitter-' + domain.id, { failureRedirect: '/' })(req, res, function (err) { if (err != null) { console.log(err); } next(); }); + } + }, handleStrategyLogin); + } + + // Google + if ((typeof domain.authstrategies.google == 'object') && (typeof domain.authstrategies.google.clientid == 'string') && (typeof domain.authstrategies.google.clientsecret == 'string')) { + const GoogleStrategy = require('passport-google-oauth20'); + var options = { clientID: domain.authstrategies.google.clientid, clientSecret: domain.authstrategies.google.clientsecret }; + if (typeof domain.authstrategies.google.callbackurl == 'string') { options.callbackURL = domain.authstrategies.google.callbackurl; } else { options.callbackURL = url + 'auth-google-callback'; } + parent.debug('web', 'Adding Google SSO with options: ' + JSON.stringify(options)); + passport.use('google-' + domain.id, new GoogleStrategy(options, + function (token, tokenSecret, profile, cb) { + parent.debug('web', 'Google profile: ' + JSON.stringify(profile)); + var user = { sid: '~google:' + profile.id, name: profile.displayName, strategy: 'google' }; + if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string') && (profile.emails[0].verified == true)) { user.email = profile.emails[0].value; } + return cb(null, user); + } + )); + obj.app.get(url + 'auth-google', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('google-' + domain.id, { scope: ['profile', 'email'] })(req, res, next); + }); + obj.app.get(url + 'auth-google-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('google-' + domain.id, { failureRedirect: '/' })(req, res, function (err) { if (err != null) { console.log(err); } next(); }); + }, handleStrategyLogin); + } + + // Github + if ((typeof domain.authstrategies.github == 'object') && (typeof domain.authstrategies.github.clientid == 'string') && (typeof domain.authstrategies.github.clientsecret == 'string')) { + const GitHubStrategy = require('passport-github2'); + var options = { clientID: domain.authstrategies.github.clientid, clientSecret: domain.authstrategies.github.clientsecret }; + if (typeof domain.authstrategies.github.callbackurl == 'string') { options.callbackURL = domain.authstrategies.github.callbackurl; } else { options.callbackURL = url + 'auth-github-callback'; } + parent.debug('web', 'Adding Github SSO with options: ' + JSON.stringify(options)); + passport.use('github-' + domain.id, new GitHubStrategy(options, + function (token, tokenSecret, profile, cb) { + parent.debug('web', 'Github profile: ' + JSON.stringify(profile)); + var user = { sid: '~github:' + profile.id, name: profile.displayName, strategy: 'github' }; + if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; } + return cb(null, user); + } + )); + obj.app.get(url + 'auth-github', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('github-' + domain.id, { scope: ['user:email'] })(req, res, next); + }); + obj.app.get(url + 'auth-github-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('github-' + domain.id, { failureRedirect: '/' })(req, res, next); + }, handleStrategyLogin); + } + + // Reddit + if ((typeof domain.authstrategies.reddit == 'object') && (typeof domain.authstrategies.reddit.clientid == 'string') && (typeof domain.authstrategies.reddit.clientsecret == 'string')) { + const RedditStrategy = require('passport-reddit'); + var options = { clientID: domain.authstrategies.reddit.clientid, clientSecret: domain.authstrategies.reddit.clientsecret }; + if (typeof domain.authstrategies.reddit.callbackurl == 'string') { options.callbackURL = domain.authstrategies.reddit.callbackurl; } else { options.callbackURL = url + 'auth-reddit-callback'; } + parent.debug('web', 'Adding Reddit SSO with options: ' + JSON.stringify(options)); + passport.use('reddit-' + domain.id, new RedditStrategy.Strategy(options, + function (token, tokenSecret, profile, cb) { + parent.debug('web', 'Reddit profile: ' + JSON.stringify(profile)); + var user = { sid: '~reddit:' + profile.id, name: profile.name, strategy: 'reddit' }; + if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; } + return cb(null, user); + } + )); + obj.app.get(url + 'auth-reddit', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('reddit-' + domain.id, { state: obj.parent.encodeCookie({ 'p': 'reddit' }, obj.parent.loginCookieEncryptionKey), duration: 'permanent' })(req, res, next); + }); + obj.app.get(url + 'auth-reddit-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + if ((Object.keys(req.session).length == 0) && (req.query.nmr == null)) { + // This is an empty session likely due to the 302 redirection, redirect again (this is a bit of a hack). + var url = req.url; + if (url.indexOf('?') >= 0) { url += '&nmr=1'; } else { url += '?nmr=1'; } // Add this to the URL to prevent redirect loop. + res.set('Content-Type', 'text/html'); + res.end(''); + } else { + if (req.query.state != null) { + var c = obj.parent.decodeCookie(req.query.state, obj.parent.loginCookieEncryptionKey, 10); // 10 minute timeout + if ((c != null) && (c.p == 'reddit')) { domain.passport.authenticate('reddit-' + domain.id, { failureRedirect: '/' })(req, res, next); return; } + } + next(); + } + }, handleStrategyLogin); + } + + // Azure + if ((typeof domain.authstrategies.azure == 'object') && (typeof domain.authstrategies.azure.clientid == 'string') && (typeof domain.authstrategies.azure.clientsecret == 'string')) { + const AzureOAuth2Strategy = require('passport-azure-oauth2'); + var options = { clientID: domain.authstrategies.azure.clientid, clientSecret: domain.authstrategies.azure.clientsecret, tenant: domain.authstrategies.azure.tenantid }; + if (typeof domain.authstrategies.azure.callbackurl == 'string') { options.callbackURL = domain.authstrategies.azure.callbackurl; } else { options.callbackURL = url + 'auth-azure-callback'; } + parent.debug('web', 'Adding Azure SSO with options: ' + JSON.stringify(options)); + passport.use('azure-' + domain.id, new AzureOAuth2Strategy(options, + function (accessToken, refreshtoken, params, profile, done) { + var userex = null; + try { userex = require('jwt-simple').decode(params.id_token, "", true); } catch (ex) { } + parent.debug('web', 'Azure profile: ' + JSON.stringify(userex)); + var user = null; + if (userex != null) { + var user = { sid: '~azure:' + userex.unique_name, name: userex.name, strategy: 'azure' }; + if (typeof userex.email == 'string') { user.email = userex.email; } + } + return done(null, user); + } + )); + obj.app.get(url + 'auth-azure', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('azure-' + domain.id, { state: obj.parent.encodeCookie({ 'p': 'azure' }, obj.parent.loginCookieEncryptionKey) })(req, res, next); + }); + obj.app.get(url + 'auth-azure-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + if ((Object.keys(req.session).length == 0) && (req.query.nmr == null)) { + // This is an empty session likely due to the 302 redirection, redirect again (this is a bit of a hack). + var url = req.url; + if (url.indexOf('?') >= 0) { url += '&nmr=1'; } else { url += '?nmr=1'; } // Add this to the URL to prevent redirect loop. + res.set('Content-Type', 'text/html'); + res.end(''); + } else { + if (req.query.state != null) { + var c = obj.parent.decodeCookie(req.query.state, obj.parent.loginCookieEncryptionKey, 10); // 10 minute timeout + if ((c != null) && (c.p == 'azure')) { domain.passport.authenticate('azure-' + domain.id, { failureRedirect: '/' })(req, res, next); return; } + } + next(); + } + }, handleStrategyLogin); + } + + // Generic OpenID Connect + if ((typeof domain.authstrategies.oidc == 'object') && (typeof domain.authstrategies.oidc.clientid == 'string') && (typeof domain.authstrategies.oidc.clientsecret == 'string') && (typeof domain.authstrategies.oidc.issuer == 'string')) { + var options = { + authorizationURL: domain.authstrategies.oidc.authorizationurl, + callbackURL: domain.authstrategies.oidc.callbackurl, + clientID: domain.authstrategies.oidc.clientid, + clientSecret: domain.authstrategies.oidc.clientsecret, + issuer: domain.authstrategies.oidc.issuer, + tokenURL: domain.authstrategies.oidc.tokenurl, + userInfoURL: domain.authstrategies.oidc.userinfourl, + scope: [ 'openid profile email' ], + responseMode: 'form_post' , + state: true + }; + const OIDCStrategy = require('@mstrhakr/passport-generic-oidc'); + if (typeof domain.authstrategies.oidc.callbackurl == 'string') { options.callbackURL = domain.authstrategies.oidc.callbackurl; } else { options.callbackURL = url + 'oidc-callback'; } + parent.debug('web', 'Adding Generic OIDC SSO with options: ' + JSON.stringify(options)); + passport.use('openidconnect', new OIDCStrategy.Strategy(options, + function verify( iss, sub, profile, cb ) { + var user = { sid: '~oidc:' + profile.id, name: profile.displayName, email: profile.email, strategy: 'oidc' }; + parent.debug('AUTH', 'OIDC: Configured user: ' + JSON.stringify(user)); + return cb(null, user); + } + )); + obj.app.get(url + 'auth-oidc', domain.passport.authenticate('openidconnect')); + obj.app.get(url + 'oidc-callback', domain.passport.authenticate('openidconnect', { failureRedirect: '/login?failed-auth-attempt', failureFlash: true }), handleStrategyLogin); + } + + + // Generic SAML + if (typeof domain.authstrategies.saml == 'object') { + if ((typeof domain.authstrategies.saml.cert != 'string') || (typeof domain.authstrategies.saml.idpurl != 'string')) { + console.log('ERROR: Missing SAML configuration.'); + } else { + const certPath = obj.common.joinPath(obj.parent.datapath, domain.authstrategies.saml.cert); + var cert = obj.fs.readFileSync(certPath); + if (cert == null) { + console.log('ERROR: Unable to read SAML IdP certificate: ' + domain.authstrategies.saml.cert); + } else { + var options = { entryPoint: domain.authstrategies.saml.idpurl, issuer: 'meshcentral' }; + if (typeof domain.authstrategies.saml.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.saml.callbackurl; } else { options.callbackUrl = url + 'auth-saml-callback'; } + if (domain.authstrategies.saml.disablerequestedauthncontext != null) { options.disableRequestedAuthnContext = domain.authstrategies.saml.disablerequestedauthncontext; } + if (typeof domain.authstrategies.saml.entityid == 'string') { options.issuer = domain.authstrategies.saml.entityid; } + parent.debug('web', 'Adding SAML SSO with options: ' + JSON.stringify(options)); + options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join(''); + const SamlStrategy = require('passport-saml').Strategy; + passport.use('saml-' + domain.id, new SamlStrategy(options, + function (profile, done) { + parent.debug('web', 'SAML profile: ' + JSON.stringify(profile)); + if (typeof profile.nameID != 'string') { return done(); } + var user = { sid: '~saml:' + profile.nameID, name: profile.nameID, strategy: 'saml' }; + if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; } + if (typeof profile.email == 'string') { user.email = profile.email; } + return done(null, user); + } + )); + obj.app.get(url + 'auth-saml', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('saml-' + domain.id, { failureRedirect: '/', failureFlash: true })(req, res, next); + }); + obj.app.post(url + 'auth-saml-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('saml-' + domain.id, { failureRedirect: '/', failureFlash: true })(req, res, next); + }, handleStrategyLogin); + } + } + } + + // Intel SAML + if (typeof domain.authstrategies.intel == 'object') { + if ((typeof domain.authstrategies.intel.cert != 'string') || (typeof domain.authstrategies.intel.idpurl != 'string')) { + console.log('ERROR: Missing Intel SAML configuration.'); + } else { + var cert = obj.fs.readFileSync(obj.common.joinPath(obj.parent.datapath, domain.authstrategies.intel.cert)); + if (cert == null) { + console.log('ERROR: Unable to read Intel SAML IdP certificate: ' + domain.authstrategies.intel.cert); + } else { + var options = { entryPoint: domain.authstrategies.intel.idpurl, issuer: 'meshcentral' }; + if (typeof domain.authstrategies.intel.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.intel.callbackurl; } else { options.callbackUrl = url + 'auth-intel-callback'; } + if (domain.authstrategies.intel.disablerequestedauthncontext != null) { options.disableRequestedAuthnContext = domain.authstrategies.intel.disablerequestedauthncontext; } + if (typeof domain.authstrategies.intel.entityid == 'string') { options.issuer = domain.authstrategies.intel.entityid; } + parent.debug('web', 'Adding Intel SSO with options: ' + JSON.stringify(options)); + options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join(''); + const SamlStrategy = require('passport-saml').Strategy; + passport.use('isaml-' + domain.id, new SamlStrategy(options, + function (profile, done) { + parent.debug('web', 'Intel profile: ' + JSON.stringify(profile)); + if (typeof profile.nameID != 'string') { return done(); } + var user = { sid: '~intel:' + profile.nameID, name: profile.nameID, strategy: 'intel' }; + if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; } + else if ((typeof profile.FirstName == 'string') && (typeof profile.LastName == 'string')) { user.name = profile.FirstName + ' ' + profile.LastName; } + if (typeof profile.email == 'string') { user.email = profile.email; } + else if (typeof profile.EmailAddress == 'string') { user.email = profile.EmailAddress; } + return done(null, user); + } + )); + obj.app.get(url + 'auth-intel', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: '/', failureFlash: true })(req, res, next); + }); + obj.app.post(url + 'auth-intel-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: '/', failureFlash: true })(req, res, next); + }, handleStrategyLogin); + } + } + } + + // JumpCloud SAML + if (typeof domain.authstrategies.jumpcloud == 'object') { + if ((typeof domain.authstrategies.jumpcloud.cert != 'string') || (typeof domain.authstrategies.jumpcloud.idpurl != 'string')) { + console.log('ERROR: Missing JumpCloud SAML configuration.'); + } else { + var cert = obj.fs.readFileSync(obj.common.joinPath(obj.parent.datapath, domain.authstrategies.jumpcloud.cert)); + if (cert == null) { + console.log('ERROR: Unable to read JumpCloud IdP certificate: ' + domain.authstrategies.jumpcloud.cert); + } else { + var options = { entryPoint: domain.authstrategies.jumpcloud.idpurl, issuer: 'meshcentral' }; + if (typeof domain.authstrategies.jumpcloud.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.jumpcloud.callbackurl; } else { options.callbackUrl = url + 'auth-jumpcloud-callback'; } + if (typeof domain.authstrategies.jumpcloud.entityid == 'string') { options.issuer = domain.authstrategies.jumpcloud.entityid; } + parent.debug('web', 'Adding JumpCloud SSO with options: ' + JSON.stringify(options)); + options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join(''); + const SamlStrategy = require('passport-saml').Strategy; + passport.use('jumpcloud-' + domain.id, new SamlStrategy(options, + function (profile, done) { + parent.debug('web', 'JumpCloud profile: ' + JSON.stringify(profile)); + if (typeof profile.nameID != 'string') { return done(); } + var user = { sid: '~jumpcloud:' + profile.nameID, name: profile.nameID, strategy: 'jumpcloud' }; + if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; } + if (typeof profile.email == 'string') { user.email = profile.email; } + return done(null, user); + } + )); + obj.app.get(url + 'auth-jumpcloud', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: '/', failureFlash: true })(req, res, next); + }); + obj.app.post(url + 'auth-jumpcloud-callback', function (req, res, next) { + var domain = getDomain(req); + if (domain.passport == null) { next(); return; } + domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: '/', failureFlash: true })(req, res, next); + }, handleStrategyLogin); + } + } + } + + } + + // Server redirects + if (parent.config.domains[i].redirects) { for (var j in parent.config.domains[i].redirects) { if (j[0] != '_') { obj.app.get(url + j, obj.handleDomainRedirect); } } } + + // Server picture + obj.app.get(url + 'serverpic.ashx', function (req, res) { + // Check if we have "server.jpg" in the data folder, if so, use that. + if ((parent.configurationFiles != null) && (parent.configurationFiles['server.png'] != null)) { + res.set({ 'Content-Type': 'image/png' }); + res.send(parent.configurationFiles['server.png']); + } else { + // Check if we have "server.jpg" in the data folder, if so, use that. + var p = obj.path.join(obj.parent.datapath, 'server.png'); + if (obj.fs.existsSync(p)) { + // Use the data folder server picture + try { res.sendFile(p); } catch (ex) { res.sendStatus(404); } + } else { + var domain = getDomain(req); + if ((domain != null) && (domain.webpublicpath != null) && (obj.fs.existsSync(obj.path.join(domain.webpublicpath, 'images/server-256.png')))) { + // Use the domain server picture + try { res.sendFile(obj.path.join(domain.webpublicpath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } + } else if (parent.webPublicOverridePath && obj.fs.existsSync(obj.path.join(obj.parent.webPublicOverridePath, 'images/server-256.png'))) { + // Use the override server picture + try { res.sendFile(obj.path.join(obj.parent.webPublicOverridePath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } + } else { + // Use the default server picture + try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } + } + } + } + }); + + // Receive mesh agent connections + obj.app.ws(url + 'agent.ashx', function (ws, req) { + var domain = checkAgentIpAddress(ws, req); + if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; } + if (domain.agentkey && ((req.query.key == null) || (domain.agentkey.indexOf(req.query.key) == -1))) { return; } // If agent key is required and not provided or not valid, just hold the websocket and do nothing. + //console.log('Agent connect: ' + req.clientIp); + try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (e) { console.log(e); } + }); + + // Setup MQTT broker over websocket + if (obj.parent.mqttbroker != null) { + obj.app.ws(url + 'mqtt.ashx', function (ws, req) { + var domain = checkAgentIpAddress(ws, req); + if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; } + var serialtunnel = SerialTunnel(); + serialtunnel.xtransport = 'ws'; + serialtunnel.xdomain = domain; + serialtunnel.xip = req.clientIp; + ws.on('message', function (b) { serialtunnel.updateBuffer(Buffer.from(b, 'binary')) }); + serialtunnel.forwardwrite = function (b) { ws.send(b, 'binary') } + ws.on('close', function () { serialtunnel.emit('end'); }); + obj.parent.mqttbroker.handle(serialtunnel); // Pass socket wrapper to MQTT broker + }); + } + + // Setup any .well-known folders + var p = obj.parent.path.join(obj.parent.datapath, '.well-known' + ((parent.config.domains[i].id == '') ? '' : ('-' + parent.config.domains[i].id))); + if (obj.parent.fs.existsSync(p)) { obj.app.use(url + '.well-known', obj.express.static(p)); } + + // Setup the alternative agent-only port + if (obj.agentapp) { + // Receive mesh agent connections on alternate port + obj.agentapp.ws(url + 'agent.ashx', function (ws, req) { + var domain = checkAgentIpAddress(ws, req); + if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; } + if (domain.agentkey && ((req.query.key == null) || (domain.agentkey.indexOf(req.query.key) == -1))) { return; } // If agent key is required and not provided or not valid, just hold the websocket and do nothing. + try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (e) { console.log(e); } + }); + + // Setup mesh relay on alternative agent-only port + obj.agentapp.ws(url + 'meshrelay.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { if (((parent.config.settings.desktopmultiplex === true) || (domain.desktopmultiplex === true)) && (req.query.p == 2)) { obj.meshDesktopMultiplexHandler.CreateMeshRelay(obj, ws1, req1, domain, user, cookie); // Desktop multiplexor 1-to-n @@ -6753,1224 +6514,54 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } }); }); - if (obj.args.wanonly != true) { // If the server is not in WAN mode, allow server relayed connections. - obj.app.ws(url + 'localrelay.ashx', function (ws, req) { - PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { - if ((user == null) || (cookie == null)) { - try { ws1.close(); } catch (ex) { } - } else { - obj.meshRelayHandler.CreateLocalRelay(obj, ws1, req1, domain, user, cookie); // Local relay - } - }); - }); - } - obj.app.get(url + 'invite', handleInviteRequest); - obj.app.post(url + 'invite', obj.bodyParser.urlencoded({ extended: false }), handleInviteRequest); - - if (parent.pluginHandler != null) { - obj.app.get(url + 'pluginadmin.ashx', obj.handlePluginAdminReq); - obj.app.post(url + 'pluginadmin.ashx', obj.bodyParser.urlencoded({ extended: false }), obj.handlePluginAdminPostReq); - obj.app.get(url + 'pluginHandler.js', obj.handlePluginJS); - } - // New account CAPTCHA request - if ((domain.newaccountscaptcha != null) && (domain.newaccountscaptcha !== false)) { - obj.app.get(url + 'newAccountCaptcha.ashx', handleNewAccountCaptchaRequest); - } + // Allows agents to transfer files + obj.agentapp.ws(url + 'devicefile.ashx', function (ws, req) { obj.meshDeviceFileHandler.CreateMeshDeviceFile(obj, ws, null, req, domain); }); - // Check CrowdSec Bounser if configured - if (parent.crowdSecBounser != null) { - obj.app.get(url + 'captcha.ashx', handleCaptchaGetRequest); - obj.app.post(url + 'captcha.ashx', obj.bodyParser.urlencoded({ extended: false }), handleCaptchaPostRequest); - } + // Setup agent to/from server file transfer handler + obj.agentapp.ws(url + 'agenttransfer.ashx', handleAgentFileTransfer); // Setup agent to/from server file transfer handler - // Setup IP-KVM relay if supported - if (domain.ipkvm) { - obj.app.ws(url + 'ipkvm.ashx/*', function (ws, req) { - const domain = getDomain(req); - if (domain == null) { parent.debug('web', 'ipkvm: failed domain checks.'); try { ws.close(); } catch (ex) { } return; } - parent.ipKvmManager.handleIpKvmWebSocket(domain, ws, req); - }); - obj.app.get(url + 'ipkvm.ashx/*', function (req, res, next) { - const domain = getDomain(req); - if (domain == null) return; - parent.ipKvmManager.handleIpKvmGet(domain, req, res, next); - }); - } - - // Setup RDP unless indicated as disabled - if (domain.mstsc !== false) { - obj.app.get(url + 'mstsc.html', function (req, res) { handleMSTSCRequest(req, res, 'mstsc'); }); - obj.app.ws(url + 'mstscrelay.ashx', function (ws, req) { - const domain = getDomain(req); - if (domain == null) { parent.debug('web', 'mstsc: failed checks.'); try { ws.close(); } catch (e) { } return; } - // If no user is logged in and we have a default user, set it now. - if ((req.session.userid == null) && (typeof obj.args.user == 'string') && (obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()])) { req.session.userid = 'user/' + domain.id + '/' + obj.args.user.toLowerCase(); } - try { require('./apprelays.js').CreateMstscRelay(obj, obj.db, ws, req, obj.args, domain); } catch (ex) { console.log(ex); } - }); - } - - // Setup SSH if needed - if (domain.ssh === true) { - obj.app.get(url + 'ssh.html', function (req, res) { handleMSTSCRequest(req, res, 'ssh'); }); - obj.app.ws(url + 'sshrelay.ashx', function (ws, req) { - const domain = getDomain(req); - if (domain == null) { parent.debug('web', 'ssh: failed checks.'); try { ws.close(); } catch (e) { } return; } - // If no user is logged in and we have a default user, set it now. - if ((req.session.userid == null) && (typeof obj.args.user == 'string') && (obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()])) { req.session.userid = 'user/' + domain.id + '/' + obj.args.user.toLowerCase(); } - try { require('./apprelays.js').CreateSshRelay(obj, obj.db, ws, req, obj.args, domain); } catch (ex) { console.log(ex); } - }); - obj.app.ws(url + 'sshterminalrelay.ashx', function (ws, req) { - PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { - require('./apprelays.js').CreateSshTerminalRelay(obj, obj.db, ws1, req1, domain, user, cookie, obj.args); - }); - }); - obj.app.ws(url + 'sshfilesrelay.ashx', function (ws, req) { - PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { - require('./apprelays.js').CreateSshFilesRelay(obj, obj.db, ws1, req1, domain, user, cookie, obj.args); - }); - }); - } - - // Setup firebase push only server - if ((obj.parent.firebase != null) && (obj.parent.config.firebase)) { - if (obj.parent.config.firebase.pushrelayserver) { parent.debug('email', 'Firebase-pushrelay-handler'); obj.app.post(url + 'firebaserelay.aspx', obj.bodyParser.urlencoded({ extended: false }), handleFirebasePushOnlyRelayRequest); } - if (obj.parent.config.firebase.relayserver) { parent.debug('email', 'Firebase-relay-handler'); obj.app.ws(url + 'firebaserelay.aspx', handleFirebaseRelayRequest); } - } - - // Setup auth strategies using passport if needed - if (typeof domain.authstrategies == 'object') { - parent.authLog('setupHTTPHandlers', `Setting up authentication strategies login and callback URLs for ${domain.id == '' ? 'root' : '"' + domain.id + '"'} domain.`); - // Twitter - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.twitter) != 0) { - obj.app.get(url + 'auth-twitter', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('twitter-' + domain.id)(req, res, function (err) { console.log('c1', err, req.session); next(); }); - }); - obj.app.get(url + 'auth-twitter-callback', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - if ((Object.keys(req.session).length == 0) && (req.query.nmr == null)) { - // This is an empty session likely due to the 302 redirection, redirect again (this is a bit of a hack). - var url = req.url; - if (url.indexOf('?') >= 0) { url += '&nmr=1'; } else { url += '?nmr=1'; } // Add this to the URL to prevent redirect loop. - res.set('Content-Type', 'text/html'); - res.end(''); - } else { - domain.passport.authenticate('twitter-' + domain.id, { failureRedirect: domain.url })(req, res, function (err) { if (err != null) { console.log(err); } next(); }); - } - }, handleStrategyLogin); - } - - // Google - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.google) != 0) { - obj.app.get(url + 'auth-google', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('google-' + domain.id, { scope: ['profile', 'email'] })(req, res, next); - }); - obj.app.get(url + 'auth-google-callback', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('google-' + domain.id, { failureRedirect: domain.url })(req, res, function (err) { if (err != null) { console.log(err); } next(); }); - }, handleStrategyLogin); - } - - // GitHub - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.github) != 0) { - obj.app.get(url + 'auth-github', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('github-' + domain.id, { scope: ['user:email'] })(req, res, next); - }); - obj.app.get(url + 'auth-github-callback', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('github-' + domain.id, { failureRedirect: domain.url })(req, res, next); - }, handleStrategyLogin); - } - - // Azure - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.azure) != 0) { - obj.app.get(url + 'auth-azure', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('azure-' + domain.id, { state: obj.parent.encodeCookie({ 'p': 'azure' }, obj.parent.loginCookieEncryptionKey) })(req, res, next); - }); - obj.app.get(url + 'auth-azure-callback', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - if ((Object.keys(req.session).length == 0) && (req.query.nmr == null)) { - // This is an empty session likely due to the 302 redirection, redirect again (this is a bit of a hack). - var url = req.url; - if (url.indexOf('?') >= 0) { url += '&nmr=1'; } else { url += '?nmr=1'; } // Add this to the URL to prevent redirect loop. - res.set('Content-Type', 'text/html'); - res.end(''); - } else { - if (req.query.state != null) { - var c = obj.parent.decodeCookie(req.query.state, obj.parent.loginCookieEncryptionKey, 10); // 10 minute timeout - if ((c != null) && (c.p == 'azure')) { domain.passport.authenticate('azure-' + domain.id, { failureRedirect: domain.url })(req, res, next); return; } - } - next(); - } - }, handleStrategyLogin); - } - - // Setup OpenID Connect URLs - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.oidc) != 0) { - let authURL = url + 'auth-oidc' - parent.authLog('setupHTTPHandlers', `OIDC: Authorization URL: ${authURL}`); - obj.app.get(authURL, function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate(`oidc-${domain.id}`, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }); - let redirectPath; - if (typeof domain.authstrategies.oidc.client.redirect_uri == 'string') { - redirectPath = (new URL(domain.authstrategies.oidc.client.redirect_uri)).pathname; - } else if (Array.isArray(domain.authstrategies.oidc.client.redirect_uris)) { - redirectPath = (new URL(domain.authstrategies.oidc.client.redirect_uris[0])).pathname; - } else { - redirectPath = url + 'auth-oidc-callback'; - } - parent.authLog('setupHTTPHandlers', `OIDC: Callback URL: ${redirectPath}`); - obj.app.get(redirectPath, obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - if (req.session && req.session.userid) { next(); return; } // already logged in so dont authenticate just carry on - if (req.session && req.session['oidc-' + domain.id]) { // we have a request to login so do authenticate - domain.passport.authenticate(`oidc-${domain.id}`, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - } else { // no idea so carry on - next(); return; - } - }, handleStrategyLogin); - } - - // Generic SAML - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.saml) != 0) { - obj.app.get(url + 'auth-saml', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - //set RelayState when queries are passed - if (Object.keys(req.query).length != 0){ - req.query.RelayState = encodeURIComponent(`${req.protocol}://${req.hostname}${req.originalUrl}`.replace('auth-saml/','')) - } - domain.passport.authenticate('saml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }); - obj.app.post(url + 'auth-saml-callback', obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('saml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }, handleStrategyLogin); - } - - // Intel SAML - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.intelSaml) != 0) { - obj.app.get(url + 'auth-intel', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }); - obj.app.post(url + 'auth-intel-callback', obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }, handleStrategyLogin); - } - - // JumpCloud SAML - if ((domain.authstrategies.authStrategyFlags & domainAuthStrategyConsts.jumpCloudSaml) != 0) { - obj.app.get(url + 'auth-jumpcloud', function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }); - obj.app.post(url + 'auth-jumpcloud-callback', obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) { - var domain = getDomain(req); - if (domain.passport == null) { next(); return; } - domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next); - }, handleStrategyLogin); - } - } - - // Setup Duo HTTP handlers if supported - if ((typeof domain.duo2factor == 'object') && (typeof domain.duo2factor.integrationkey == 'string') && (typeof domain.duo2factor.secretkey == 'string') && (typeof domain.duo2factor.apihostname == 'string')) { - // Duo authentication handler - obj.app.get(url + 'auth-duo', function (req, res){ - var domain = getDomain(req); - const sec = parent.decryptSessionData(req.session.e); - if ((req.query.state !== sec.duostate) || (req.query.duo_code == null)) { - // The state returned from Duo is not the same as what was in the session, so must fail - parent.debug('web', 'handleRootRequest: Duo 2FA state failed.'); - req.session.loginmode = 1; - req.session.messageid = 117; // Invalid security check - res.redirect(domain.url + getQueryPortion(req)); // redirect back to main page - return; - } else { - // User credentials are stored in session, just check again and get userid - obj.authenticate(sec.tuser, sec.tpass, domain, function (err, userid, passhint, loginOptions) { - if ((userid != null) && (err == null)) { - // Login data correct, now exchange authorization code for 2FA - const duo = require('@duosecurity/duo_universal'); - const client = new duo.Client({ - clientId: domain.duo2factor.integrationkey, - clientSecret: domain.duo2factor.secretkey, - apiHost: domain.duo2factor.apihostname, - redirectUrl: obj.generateBaseURL(domain, req) + 'auth-duo' + (domain.loginkey != null ? ('?key=' + domain.loginkey) : '') - }); - client.exchangeAuthorizationCodeFor2FAResult(req.query.duo_code, userid.split('/')[2]).then(function (data) { - const sec = parent.decryptSessionData(req.session.e); - if ((sec != null) && (sec.duoconfig == 1)) { - // Duo 2FA exchange success - parent.debug('web', 'handleRootRequest: Duo 2FA configuration success.'); - - // Enable Duo for this user - var user = obj.users[userid]; - if (user.otpduo == null) { - user.otpduo = {}; - db.SetUser(user); - - // Notify change - var targets = ['*', 'server-users', user._id]; - if (user.groups) { for (var i in user.groups) { targets.push('server-users:' + i); } } - var event = { etype: 'user', userid: user._id, username: user.name, account: obj.CloneSafeUser(user), action: 'accountchange', msgid: 160, msg: "Enabled duo two-factor authentication.", domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. - parent.DispatchEvent(targets, obj, event); - } - - // Clear the Duo state - delete sec.duostate; - delete sec.duoconfig; - req.session.e = parent.encryptSessionData(sec); - - var url = req.session.duorurl; - delete req.session.duorurl; - res.redirect(url ? url : domain.url); // Redirect back to the user's original page - } else { - // Duo 2FA exchange success - parent.debug('web', 'handleRootRequest: Duo 2FA authorization success.'); - req.session.userid = userid; - delete req.session.currentNode; - req.session.ip = req.clientIp; // Bind this session to the IP address of the request - setSessionRandom(req); - - // Clear the Duo state - delete sec.duostate; - req.session.e = parent.encryptSessionData(sec); - - obj.parent.authLog('https', 'Accepted Duo authentication for ' + userid + ' from ' + req.clientIp + ':' + req.connection.remotePort, { useragent: req.headers['user-agent'], sessionid: req.session.x }); - res.redirect(domain.url + getQueryPortion(req)); - } - }).catch(function (err) { - console.log('err', err); - const sec = parent.decryptSessionData(req.session.e); - if ((sec != null) && (sec.duoconfig == 1)) { - // Duo 2FA exchange success - parent.debug('web', 'handleRootRequest: Duo 2FA configuration failed.'); - - // Clear the Duo state - delete sec.duostate; - delete sec.duoconfig; - req.session.e = parent.encryptSessionData(sec); - - var url = req.session.duorurl; - delete req.session.duorurl; - res.redirect(url ? url : domain.url); // Redirect back to the user's original page - } else { - // Duo 2FA exchange failed - parent.debug('web', 'handleRootRequest: Duo 2FA authorization failed.'); - - // Clear the Duo state - delete sec.duostate; - req.session.e = parent.encryptSessionData(sec); - - req.session.loginmode = 1; - req.session.messageid = 117; // Invalid security check - res.redirect(domain.url + getQueryPortion(req)); - } - }); - } else { - // Login failed - parent.debug('web', 'handleRootRequest: login authorization failed when returning from Duo 2FA.'); - req.session.loginmode = 1; - res.redirect(domain.url + getQueryPortion(req)); // redirect back to main page - return; - } - }); - } - }); - - // Configure Duo handler - obj.app.get(url + 'add-duo', function (req, res) { - var domain = getDomain(req); - const sec = parent.decryptSessionData(req.session.e); - - if (req.session.userid == null) { - res.sendStatus(404); - } else { - // Redirect to Duo here - const duo = require('@duosecurity/duo_universal'); - const client = new duo.Client({ - clientId: domain.duo2factor.integrationkey, - clientSecret: domain.duo2factor.secretkey, - apiHost: domain.duo2factor.apihostname, - redirectUrl: obj.generateBaseURL(domain, req) + 'auth-duo' + (domain.loginkey != null ? ('&key=' + domain.loginkey) : '') - }); - - // Setup the Duo configuration - if (req.query.rurl) { req.session.duorurl = req.query.rurl; } // Set Duo return URL - const sec = parent.decryptSessionData(req.session.e); - sec.duostate = client.generateState(); - sec.duoconfig = 1; - req.session.e = parent.encryptSessionData(sec); - parent.debug('web', 'Redirecting user ' + req.session.userid + ' to Duo for configuration'); - res.redirect(client.createAuthUrl(req.session.userid.split('/')[2], sec.duostate)); - } - }); - } - - // Server redirects - if (parent.config.domains[i].redirects) { for (var j in parent.config.domains[i].redirects) { if (j[0] != '_') { obj.app.get(url + j, obj.handleDomainRedirect); } } } - - // Server picture - obj.app.get(url + 'serverpic.ashx', function (req, res) { - // Check if we have "server.jpg" in the data folder, if so, use that. - if ((parent.configurationFiles != null) && (parent.configurationFiles['server.png'] != null)) { - res.set({ 'Content-Type': 'image/png' }); - res.send(parent.configurationFiles['server.png']); - } else { - // Check if we have "server.jpg" in the data folder, if so, use that. - var p = obj.path.join(obj.parent.datapath, 'server.png'); - if (obj.fs.existsSync(p)) { - // Use the data folder server picture - try { res.sendFile(p); } catch (ex) { res.sendStatus(404); } - } else { - var domain = getDomain(req); - if ((domain != null) && (domain.webpublicpath != null) && (obj.fs.existsSync(obj.path.join(domain.webpublicpath, 'images/server-256.png')))) { - // Use the domain server picture - try { res.sendFile(obj.path.join(domain.webpublicpath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } - } else if (parent.webPublicOverridePath && obj.fs.existsSync(obj.path.join(obj.parent.webPublicOverridePath, 'images/server-256.png'))) { - // Use the override server picture - try { res.sendFile(obj.path.join(obj.parent.webPublicOverridePath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } - } else { - // Use the default server picture - try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } - } - } - } - }); - - // Receive mesh agent connections - obj.app.ws(url + 'agent.ashx', function (ws, req) { - var domain = checkAgentIpAddress(ws, req); - if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; } - if (domain.agentkey && ((req.query.key == null) || (domain.agentkey.indexOf(req.query.key) == -1))) { return; } // If agent key is required and not provided or not valid, just hold the websocket and do nothing. - //console.log('Agent connect: ' + req.clientIp); - try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (ex) { console.log(ex); } - }); - - // Setup MQTT broker over websocket - if (obj.parent.mqttbroker != null) { - obj.app.ws(url + 'mqtt.ashx', function (ws, req) { - var domain = checkAgentIpAddress(ws, req); - if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; } - var serialtunnel = SerialTunnel(); - serialtunnel.xtransport = 'ws'; - serialtunnel.xdomain = domain; - serialtunnel.xip = req.clientIp; - ws.on('message', function (b) { serialtunnel.updateBuffer(Buffer.from(b, 'binary')) }); - serialtunnel.forwardwrite = function (b) { ws.send(b, 'binary') } - ws.on('close', function () { serialtunnel.emit('end'); }); - obj.parent.mqttbroker.handle(serialtunnel); // Pass socket wrapper to MQTT broker - }); - } - - // Setup any .well-known folders - var p = obj.parent.path.join(obj.parent.datapath, '.well-known' + ((parent.config.domains[i].id == '') ? '' : ('-' + parent.config.domains[i].id))); - if (obj.parent.fs.existsSync(p)) { obj.app.use(url + '.well-known', obj.express.static(p)); } - - // Setup the alternative agent-only port - if (obj.agentapp) { - // Receive mesh agent connections on alternate port - obj.agentapp.ws(url + 'agent.ashx', function (ws, req) { - var domain = checkAgentIpAddress(ws, req); - if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; } - if (domain.agentkey && ((req.query.key == null) || (domain.agentkey.indexOf(req.query.key) == -1))) { return; } // If agent key is required and not provided or not valid, just hold the websocket and do nothing. - try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (e) { console.log(e); } - }); - - // Setup mesh relay on alternative agent-only port - obj.agentapp.ws(url + 'meshrelay.ashx', function (ws, req) { - PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie, authData) { - if (((parent.config.settings.desktopmultiplex === true) || (domain.desktopmultiplex === true)) && (req.query.p == 2)) { - obj.meshDesktopMultiplexHandler.CreateMeshRelay(obj, ws1, req1, domain, user, cookie); // Desktop multiplexor 1-to-n - } else { - obj.meshRelayHandler.CreateMeshRelay(obj, ws1, req1, domain, user, cookie); // Normal relay 1-to-1 - } - }); - }); - - // Allows agents to transfer files - obj.agentapp.ws(url + 'devicefile.ashx', function (ws, req) { obj.meshDeviceFileHandler.CreateMeshDeviceFile(obj, ws, null, req, domain); }); - - // Setup agent to/from server file transfer handler - obj.agentapp.ws(url + 'agenttransfer.ashx', handleAgentFileTransfer); // Setup agent to/from server file transfer handler - - // Setup agent downloads for meshcore updates - obj.agentapp.get(url + 'meshagents', obj.handleMeshAgentRequest); - - // Setup agent file downloads - obj.agentapp.get(url + 'agentdownload.ashx', handleAgentDownloadFile); - } - - // Setup web relay on this web server if needed - // We set this up when a DNS name is used as a web relay instead of a port - if (obj.args.relaydns != null) { - obj.webRelayRouter = require('express').Router(); - - // This is the magic URL that will setup the relay session - obj.webRelayRouter.get('/control-redirect.ashx', function (req, res, next) { - if (obj.args.relaydns.indexOf(req.hostname) == -1) { res.sendStatus(404); return; } - if ((req.session.userid == null) && obj.args.user && obj.users['user//' + obj.args.user.toLowerCase()]) { req.session.userid = 'user//' + obj.args.user.toLowerCase(); } // Use a default user if needed - res.set({ 'Cache-Control': 'no-store' }); - parent.debug('web', 'webRelaySetup'); - - // Decode the relay cookie - if (req.query.c == null) { res.sendStatus(404); return; } - - // Decode and check if this relay cookie is valid - var userid, domainid, domain, nodeid, addr, port, appid, webSessionId, expire, publicid; - const urlCookie = obj.parent.decodeCookie(req.query.c, parent.loginCookieEncryptionKey, 32); // Allow cookies up to 32 minutes old. The web page will renew this cookie every 30 minutes. - if (urlCookie == null) { res.sendStatus(404); return; } - - // Decode the incoming cookie - if ((urlCookie.ruserid != null) && (urlCookie.x != null)) { - if (parent.webserver.destroyedSessions[urlCookie.ruserid + '/' + urlCookie.x] != null) { res.sendStatus(404); return; } - - // This is a standard user, figure out what our web relay will be. - if (req.session.x != urlCookie.x) { req.session.x = urlCookie.x; } // Set the sessionid if missing - if (req.session.userid != urlCookie.ruserid) { req.session.userid = urlCookie.ruserid; } // Set the session userid if missing - if (req.session.z) { delete req.session.z; } // Clear the web relay guest session - userid = req.session.userid; - domainid = userid.split('/')[1]; - domain = parent.config.domains[domainid]; - nodeid = ((req.query.relayid != null) ? req.query.relayid : req.query.n); - addr = (req.query.addr != null) ? req.query.addr : '127.0.0.1'; - port = parseInt(req.query.p); - appid = parseInt(req.query.appid); - webSessionId = req.session.userid + '/' + req.session.x; - - // Check that all the required arguments are present - if ((req.session.userid == null) || (req.session.x == null) || (req.query.n == null) || (req.query.p == null) || (parent.webserver.destroyedSessions[webSessionId] != null) || ((req.query.appid != 1) && (req.query.appid != 2))) { res.redirect('/'); return; } - } else if (urlCookie.r == 8) { - // This is a guest user, figure out what our web relay will be. - userid = urlCookie.userid; - domainid = userid.split('/')[1]; - domain = parent.config.domains[domainid]; - nodeid = urlCookie.nid; - addr = (urlCookie.addr != null) ? urlCookie.addr : '127.0.0.1'; - port = urlCookie.port; - appid = (urlCookie.p == 16) ? 2 : 1; // appid: 1 = HTTP, 2 = HTTPS - webSessionId = userid + '/' + urlCookie.pid; - publicid = urlCookie.pid; - if (req.session.x) { delete req.session.x; } // Clear the web relay sessionid - if (req.session.userid) { delete req.session.userid; } // Clear the web relay userid - if (req.session.z != webSessionId) { req.session.z = webSessionId; } // Set the web relay guest session - expire = urlCookie.expire; - if ((expire != null) && (expire <= Date.now())) { parent.debug('webrelay', 'expired link'); res.sendStatus(404); return; } - } - - // No session identifier was setup, exit now - if (webSessionId == null) { res.sendStatus(404); return; } - - // Check that we have an exact session on any of the relay DNS names - var xrelaySessionId, xrelaySession, freeRelayHost, oldestRelayTime, oldestRelayHost; - for (var hostIndex in obj.args.relaydns) { - const host = obj.args.relaydns[hostIndex]; - xrelaySessionId = webSessionId + '/' + host; - xrelaySession = webRelaySessions[xrelaySessionId]; - if (xrelaySession == null) { - // We found an unused hostname, save this as it could be useful. - if (freeRelayHost == null) { freeRelayHost = host; } - } else { - // Check if we already have a relay session that matches exactly what we want - if ((xrelaySession.domain.id == domain.id) && (xrelaySession.userid == userid) && (xrelaySession.nodeid == nodeid) && (xrelaySession.addr == addr) && (xrelaySession.port == port) && (xrelaySession.appid == appid)) { - // We found an exact match, we are all setup already, redirect to root of that DNS name - if (host == req.hostname) { - // Request was made on the same host, redirect to root. - res.redirect('/'); - } else { - // Request was made to a different host - const httpport = ((args.aliasport != null) ? args.aliasport : args.port); - res.redirect('https://' + host + ((httpport != 443) ? (':' + httpport) : '') + '/'); - } - return; - } - - // Keep a record of the oldest web relay session, this could be useful. - if (oldestRelayHost == null) { - // Oldest host not set yet, set it - oldestRelayHost = host; - oldestRelayTime = xrelaySession.lastOperation; - } else { - // Check if this host is older then oldest so far - if (oldestRelayTime > xrelaySession.lastOperation) { - oldestRelayHost = host; - oldestRelayTime = xrelaySession.lastOperation; - } - } - } - } - - // Check that the user has rights to access this device - parent.webserver.GetNodeWithRights(domain, userid, nodeid, function (node, rights, visible) { - // If there is no remote control or relay rights, reject this web relay - if ((rights & 0x00200008) == 0) { res.sendStatus(404); return; } // MESHRIGHT_REMOTECONTROL or MESHRIGHT_RELAY - - // Check if there is a free relay DNS name we can use - var selectedHost = null; - if (freeRelayHost != null) { - // There is a free one, use it. - selectedHost = freeRelayHost; - } else { - // No free ones, close the oldest one - selectedHost = oldestRelayHost; - } - xrelaySessionId = webSessionId + '/' + selectedHost; - - if (selectedHost == req.hostname) { - // If this web relay session id is not free, close it now - xrelaySession = webRelaySessions[xrelaySessionId]; - if (xrelaySession != null) { xrelaySession.close(); delete webRelaySessions[xrelaySessionId]; } - - // Create a web relay session - const relaySession = require('./apprelays.js').CreateWebRelaySession(obj, db, req, args, domain, userid, nodeid, addr, port, appid, xrelaySessionId, expire, node.mtype); - relaySession.xpublicid = publicid; - relaySession.onclose = function (sessionId) { - // Remove the relay session - delete webRelaySessions[sessionId]; - // If there are not more relay sessions, clear the cleanup timer - if ((Object.keys(webRelaySessions).length == 0) && (obj.cleanupTimer != null)) { clearInterval(webRelayCleanupTimer); obj.cleanupTimer = null; } - } - - // Set the multi-tunnel session - webRelaySessions[xrelaySessionId] = relaySession; - - // Setup the cleanup timer if needed - if (obj.cleanupTimer == null) { webRelayCleanupTimer = setInterval(checkWebRelaySessionsTimeout, 10000); } - - // Redirect to root. - res.redirect('/'); - } else { - if (req.query.noredirect != null) { - // No redirects allowed, fail here. This is important to make sure there is no redirect cascades - res.sendStatus(404); - } else { - // Request was made to a different host, redirect using the full URL so an HTTP cookie can be created on the other DNS name. - const httpport = ((args.aliasport != null) ? args.aliasport : args.port); - res.redirect('https://' + selectedHost + ((httpport != 443) ? (':' + httpport) : '') + req.url + '&noredirect=1'); - } - } - }); - }); - - // Handle all incoming requests as web relays - obj.webRelayRouter.get('/*', function (req, res) { try { handleWebRelayRequest(req, res); } catch (ex) { console.log(ex); } }) - - // Handle all incoming requests as web relays - obj.webRelayRouter.post('/*', function (req, res) { try { handleWebRelayRequest(req, res); } catch (ex) { console.log(ex); } }) - - // Handle all incoming requests as web relays - obj.webRelayRouter.put('/*', function (req, res) { try { handleWebRelayRequest(req, res); } catch (ex) { console.log(ex); } }) - - // Handle all incoming requests as web relays - obj.webRelayRouter.delete('/*', function (req, res) { try { handleWebRelayRequest(req, res); } catch (ex) { console.log(ex); } }) - - // Handle all incoming requests as web relays - obj.webRelayRouter.options('/*', function (req, res) { try { handleWebRelayRequest(req, res); } catch (ex) { console.log(ex); } }) - - // Handle all incoming requests as web relays - obj.webRelayRouter.head('/*', function (req, res) { try { handleWebRelayRequest(req, res); } catch (ex) { console.log(ex); } }) - } - - // Indicates to ExpressJS that the override public folder should be used to serve static files. - obj.app.use(url, function(req, res, next){ - var domain = getDomain(req); - if (domain.webpublicpath != null) { // Use domain public path - obj.express.static(domain.webpublicpath)(req, res, next); - } else if (obj.parent.webPublicOverridePath != null) { // Use override path - obj.express.static(obj.parent.webPublicOverridePath)(req, res, next); - } else { // carry on and use default public path - next(); - } - }); - // Indicates to ExpressJS that the default public folder should be used to serve static files. - obj.app.use(url, obj.express.static(obj.parent.webPublicPath)); - - // Start regular disconnection list flush every 2 minutes. - obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000); - } - } - function finalizeWebserver() { - // Setup all HTTP handlers - setupHTTPHandlers() - - // Handle 404 error - if (obj.args.nice404 !== false) { - obj.app.use(function (req, res, next) { - parent.debug('web', '404 Error ' + req.url); - var domain = getDomain(req); - if ((domain == null) || (domain.auth == 'sspi')) { res.sendStatus(404); return; } - if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL - const cspNonce = obj.crypto.randomBytes(15).toString('base64'); - res.set({ 'Content-Security-Policy': "default-src 'none'; script-src 'self' 'nonce-" + cspNonce + "'; img-src 'self'; style-src 'self' 'nonce-" + cspNonce + "';" }); // This page supports very tight CSP policy - res.status(404).render(getRenderPage((domain.sitestyle >= 2) ? 'error4042' : 'error404', req, domain), getRenderArgs({ cspNonce: cspNonce }, req, domain)); - }); + // Setup agent downloads for meshcore updates + obj.agentapp.get(url + 'meshagents', obj.handleMeshAgentRequest); } - // Start server on a free port. - CheckListenPort(obj.args.port, obj.args.portbind, StartWebServer); + // Indicates to ExpressJS that the override public folder should be used to serve static files. + if (parent.config.domains[i].webpublicpath != null) { + // Use domain public path + obj.app.use(url, obj.express.static(parent.config.domains[i].webpublicpath)); + } else if (obj.parent.webPublicOverridePath != null) { + // Use override path + obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath)); + } - // Start on a second agent-only alternative port if needed. - if (obj.args.agentport) { CheckListenPort(obj.args.agentport, obj.args.agentportbind, StartAltWebServer); } + // Indicates to ExpressJS that the default public folder should be used to serve static files. + obj.app.use(url, obj.express.static(obj.parent.webPublicPath)); - // We are done starting the web server. - if (doneFunc) doneFunc(); - } - } - - function nice404(req, res) { - parent.debug('web', '404 Error ' + req.url); - var domain = getDomain(req); - if ((domain == null) || (domain.auth == 'sspi')) { res.sendStatus(404); return; } - if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL - if (obj.args.nice404 == false) { res.sendStatus(404); return; } - const cspNonce = obj.crypto.randomBytes(15).toString('base64'); - res.set({ 'Content-Security-Policy': "default-src 'none'; script-src 'self' 'nonce-" + cspNonce + "'; img-src 'self'; style-src 'self' 'nonce-" + cspNonce + "';" }); // This page supports very tight CSP policy - res.status(404).render(getRenderPage((domain.sitestyle >= 2) ? 'error4042' : 'error404', req, domain), getRenderArgs({ cspNonce: cspNonce }, req, domain)); - } - - // Auth strategy flags - const domainAuthStrategyConsts = { - twitter: 1, - google: 2, - github: 3, - reddit: 8, // Deprecated - azure: 16, - oidc: 32, - saml: 64, - intelSaml: 128, - jumpCloudSaml: 256 - } - - // Setup auth strategies for a domain - async function setupDomainAuthStrategy(domain) { - // Return binary flags representing all auth strategies that have been setup - let authStrategyFlags = 0; - - // Setup auth strategies using passport if needed - if (typeof domain.authstrategies != 'object') return authStrategyFlags; - - const url = domain.url - const passport = domain.passport = require('passport'); - passport.serializeUser(function (user, done) { done(null, user.sid); }); - passport.deserializeUser(function (sid, done) { done(null, { sid: sid }); }); - obj.app.use(passport.initialize()); - obj.app.use(require('connect-flash')()); - - // Twitter - if ((typeof domain.authstrategies.twitter == 'object') && (typeof domain.authstrategies.twitter.clientid == 'string') && (typeof domain.authstrategies.twitter.clientsecret == 'string')) { - const TwitterStrategy = require('passport-twitter'); - let options = { consumerKey: domain.authstrategies.twitter.clientid, consumerSecret: domain.authstrategies.twitter.clientsecret }; - if (typeof domain.authstrategies.twitter.callbackurl == 'string') { options.callbackURL = domain.authstrategies.twitter.callbackurl; } else { options.callbackURL = url + 'auth-twitter-callback'; } - parent.authLog('setupDomainAuthStrategy', 'Adding Twitter SSO with options: ' + JSON.stringify(options)); - passport.use('twitter-' + domain.id, new TwitterStrategy(options, - function (token, tokenSecret, profile, cb) { - parent.authLog('setupDomainAuthStrategy', 'Twitter profile: ' + JSON.stringify(profile)); - var user = { sid: '~twitter:' + profile.id, name: profile.displayName, strategy: 'twitter' }; - if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; } - return cb(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.twitter; + // Start regular disconnection list flush every 2 minutes. + obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000); } - // Google - if ((typeof domain.authstrategies.google == 'object') && (typeof domain.authstrategies.google.clientid == 'string') && (typeof domain.authstrategies.google.clientsecret == 'string')) { - const GoogleStrategy = require('passport-google-oauth20'); - let options = { clientID: domain.authstrategies.google.clientid, clientSecret: domain.authstrategies.google.clientsecret }; - if (typeof domain.authstrategies.google.callbackurl == 'string') { options.callbackURL = domain.authstrategies.google.callbackurl; } else { options.callbackURL = url + 'auth-google-callback'; } - parent.authLog('setupDomainAuthStrategy', 'Adding Google SSO with options: ' + JSON.stringify(options)); - passport.use('google-' + domain.id, new GoogleStrategy(options, - function (token, tokenSecret, profile, cb) { - parent.authLog('setupDomainAuthStrategy', 'Google profile: ' + JSON.stringify(profile)); - var user = { sid: '~google:' + profile.id, name: profile.displayName, strategy: 'google' }; - if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string') && (profile.emails[0].verified == true)) { user.email = profile.emails[0].value; } - return cb(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.google; + // Handle 404 error + if (obj.args.nice404 !== false) { + obj.app.use(function (req, res, next) { + parent.debug('web', '404 Error ' + req.url); + var domain = getDomain(req); + if ((domain == null) || (domain.auth == 'sspi')) { res.sendStatus(404); return; } + if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL + const cspNonce = obj.crypto.randomBytes(15).toString('base64'); + res.set({ 'Content-Security-Policy': "default-src 'none'; script-src 'self' 'nonce-" + cspNonce + "'; img-src 'self'; style-src 'self' 'nonce-" + cspNonce + "';" }); // This page supports very tight CSP policy + res.status(404).render(getRenderPage((domain.sitestyle == 2) ? 'error4042' : 'error404', req, domain), getRenderArgs({ cspNonce: cspNonce }, req, domain)); + }); } - // Github - if ((typeof domain.authstrategies.github == 'object') && (typeof domain.authstrategies.github.clientid == 'string') && (typeof domain.authstrategies.github.clientsecret == 'string')) { - const GitHubStrategy = require('passport-github2'); - let options = { clientID: domain.authstrategies.github.clientid, clientSecret: domain.authstrategies.github.clientsecret }; - if (typeof domain.authstrategies.github.callbackurl == 'string') { options.callbackURL = domain.authstrategies.github.callbackurl; } else { options.callbackURL = url + 'auth-github-callback'; } - parent.authLog('setupDomainAuthStrategy', 'Adding Github SSO with options: ' + JSON.stringify(options)); - passport.use('github-' + domain.id, new GitHubStrategy(options, - function (token, tokenSecret, profile, cb) { - parent.authLog('setupDomainAuthStrategy', 'Github profile: ' + JSON.stringify(profile)); - var user = { sid: '~github:' + profile.id, name: profile.displayName, strategy: 'github' }; - if ((typeof profile.emails == 'object') && (profile.emails[0] != null) && (typeof profile.emails[0].value == 'string')) { user.email = profile.emails[0].value; } - return cb(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.github; - } + // Start server on a free port. + CheckListenPort(obj.args.port, obj.args.portbind, StartWebServer); - // Azure - if ((typeof domain.authstrategies.azure == 'object') && (typeof domain.authstrategies.azure.clientid == 'string') && (typeof domain.authstrategies.azure.clientsecret == 'string')) { - const AzureOAuth2Strategy = require('passport-azure-oauth2'); - let options = { clientID: domain.authstrategies.azure.clientid, clientSecret: domain.authstrategies.azure.clientsecret, tenant: domain.authstrategies.azure.tenantid }; - if (typeof domain.authstrategies.azure.callbackurl == 'string') { options.callbackURL = domain.authstrategies.azure.callbackurl; } else { options.callbackURL = url + 'auth-azure-callback'; } - parent.authLog('setupDomainAuthStrategy', 'Adding Azure SSO with options: ' + JSON.stringify(options)); - passport.use('azure-' + domain.id, new AzureOAuth2Strategy(options, - function (accessToken, refreshtoken, params, profile, done) { - var userex = null; - try { userex = require('jwt-simple').decode(params.id_token, '', true); } catch (ex) { } - parent.authLog('setupDomainAuthStrategy', 'Azure profile: ' + JSON.stringify(userex)); - var user = null; - if (userex != null) { - var user = { sid: '~azure:' + userex.unique_name, name: userex.name, strategy: 'azure' }; - if (typeof userex.email == 'string') { user.email = userex.email; } - } - return done(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.azure; - } + // Start on a second agent-only alternative port if needed. + if (obj.args.agentport) { CheckListenPort(obj.args.agentport, obj.args.agentportbind, StartAltWebServer); } - // Generic SAML - if (typeof domain.authstrategies.saml == 'object') { - if ((typeof domain.authstrategies.saml.cert != 'string') || (typeof domain.authstrategies.saml.idpurl != 'string')) { - parent.debug('error', 'Missing SAML configuration.'); - } else { - const certPath = obj.common.joinPath(obj.parent.datapath, domain.authstrategies.saml.cert); - var cert = obj.fs.readFileSync(certPath); - if (cert == null) { - parent.debug('error', 'Unable to read SAML IdP certificate: ' + domain.authstrategies.saml.cert); - } else { - var options = { entryPoint: domain.authstrategies.saml.idpurl, issuer: 'meshcentral' }; - if (typeof domain.authstrategies.saml.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.saml.callbackurl; } else { options.callbackUrl = url + 'auth-saml-callback'; } - if (domain.authstrategies.saml.disablerequestedauthncontext != null) { options.disableRequestedAuthnContext = domain.authstrategies.saml.disablerequestedauthncontext; } - if (typeof domain.authstrategies.saml.entityid == 'string') { options.issuer = domain.authstrategies.saml.entityid; } - parent.authLog('setupDomainAuthStrategy', 'Adding SAML SSO with options: ' + JSON.stringify(options)); - options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join(''); - const SamlStrategy = require('passport-saml').Strategy; - passport.use('saml-' + domain.id, new SamlStrategy(options, - function (profile, done) { - parent.authLog('setupDomainAuthStrategy', 'SAML profile: ' + JSON.stringify(profile)); - if (typeof profile.nameID != 'string') { return done(); } - var user = { sid: '~saml:' + profile.nameID, name: profile.nameID, strategy: 'saml' }; - if (typeof profile.displayname == 'string') { - user.name = profile.displayname; - } else if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { - user.name = profile.firstname + ' ' + profile.lastname; - } - if (typeof profile.email == 'string') { user.email = profile.email; } - return done(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.saml - } - } - } - - // Intel SAML - if (typeof domain.authstrategies.intel == 'object') { - if ((typeof domain.authstrategies.intel.cert != 'string') || (typeof domain.authstrategies.intel.idpurl != 'string')) { - parent.debug('error', 'Missing Intel SAML configuration.'); - } else { - var cert = obj.fs.readFileSync(obj.common.joinPath(obj.parent.datapath, domain.authstrategies.intel.cert)); - if (cert == null) { - parent.debug('error', 'Unable to read Intel SAML IdP certificate: ' + domain.authstrategies.intel.cert); - } else { - var options = { entryPoint: domain.authstrategies.intel.idpurl, issuer: 'meshcentral' }; - if (typeof domain.authstrategies.intel.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.intel.callbackurl; } else { options.callbackUrl = url + 'auth-intel-callback'; } - if (domain.authstrategies.intel.disablerequestedauthncontext != null) { options.disableRequestedAuthnContext = domain.authstrategies.intel.disablerequestedauthncontext; } - if (typeof domain.authstrategies.intel.entityid == 'string') { options.issuer = domain.authstrategies.intel.entityid; } - parent.authLog('setupDomainAuthStrategy', 'Adding Intel SSO with options: ' + JSON.stringify(options)); - options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join(''); - const SamlStrategy = require('passport-saml').Strategy; - passport.use('isaml-' + domain.id, new SamlStrategy(options, - function (profile, done) { - parent.authLog('setupDomainAuthStrategy', 'Intel profile: ' + JSON.stringify(profile)); - if (typeof profile.nameID != 'string') { return done(); } - var user = { sid: '~intel:' + profile.nameID, name: profile.nameID, strategy: 'intel' }; - if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; } - else if ((typeof profile.FirstName == 'string') && (typeof profile.LastName == 'string')) { user.name = profile.FirstName + ' ' + profile.LastName; } - if (typeof profile.email == 'string') { user.email = profile.email; } - else if (typeof profile.EmailAddress == 'string') { user.email = profile.EmailAddress; } - return done(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.intelSaml - } - } - } - - // JumpCloud SAML - if (typeof domain.authstrategies.jumpcloud == 'object') { - if ((typeof domain.authstrategies.jumpcloud.cert != 'string') || (typeof domain.authstrategies.jumpcloud.idpurl != 'string')) { - parent.debug('error', 'Missing JumpCloud SAML configuration.'); - } else { - var cert = obj.fs.readFileSync(obj.common.joinPath(obj.parent.datapath, domain.authstrategies.jumpcloud.cert)); - if (cert == null) { - parent.debug('error', 'Unable to read JumpCloud IdP certificate: ' + domain.authstrategies.jumpcloud.cert); - } else { - var options = { entryPoint: domain.authstrategies.jumpcloud.idpurl, issuer: 'meshcentral' }; - if (typeof domain.authstrategies.jumpcloud.callbackurl == 'string') { options.callbackUrl = domain.authstrategies.jumpcloud.callbackurl; } else { options.callbackUrl = url + 'auth-jumpcloud-callback'; } - if (typeof domain.authstrategies.jumpcloud.entityid == 'string') { options.issuer = domain.authstrategies.jumpcloud.entityid; } - parent.authLog('setupDomainAuthStrategy', 'Adding JumpCloud SSO with options: ' + JSON.stringify(options)); - options.cert = cert.toString().split('-----BEGIN CERTIFICATE-----').join('').split('-----END CERTIFICATE-----').join(''); - const SamlStrategy = require('passport-saml').Strategy; - passport.use('jumpcloud-' + domain.id, new SamlStrategy(options, - function (profile, done) { - parent.authLog('setupDomainAuthStrategy', 'JumpCloud profile: ' + JSON.stringify(profile)); - if (typeof profile.nameID != 'string') { return done(); } - var user = { sid: '~jumpcloud:' + profile.nameID, name: profile.nameID, strategy: 'jumpcloud' }; - if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; } - if (typeof profile.email == 'string') { user.email = profile.email; } - return done(null, user); - } - )); - authStrategyFlags |= domainAuthStrategyConsts.jumpCloudSaml - } - } - } - - // Setup OpenID Connect Authentication Strategy - if (obj.common.validateObject(domain.authstrategies.oidc)) { - parent.authLog('setupDomainAuthStrategy', `OIDC: Setting up strategy for domain: ${domain.id == null ? 'default' : domain.id}`); - // Ensure required objects exist - let initStrategy = domain.authstrategies.oidc - if (typeof initStrategy.issuer == 'string') { initStrategy.issuer = { 'issuer': initStrategy.issuer } } - let strategy = migrateOldConfigs(Object.assign({ 'client': {}, 'issuer': {}, 'options': {}, 'custom': {}, 'obj': { 'openidClient': require('openid-client') } }, initStrategy)) - let preset = obj.common.validateString(strategy.custom.preset) ? strategy.custom.preset : null - if (!preset) { - if (typeof strategy.custom.tenant_id == 'string') { strategy.custom.preset = preset = 'azure' } - if (strategy.custom.customer_id || strategy.custom.identitysource || strategy.client.client_id.split('.')[2] == 'googleusercontent') { strategy.custom.preset = preset = 'google' } - } - - // Check issuer url - let presetIssuer - if (preset == 'azure') { presetIssuer = 'https://login.microsoftonline.com/' + strategy.custom.tenant_id + '/v2.0'; } - if (preset == 'google') { presetIssuer = 'https://accounts.google.com'; } - if (!obj.common.validateString(strategy.issuer.issuer)) { - if (!preset) { - let error = new Error('OIDC: Missing issuer URI.'); - parent.authLog('error', `${error.message} STRATEGY: ${JSON.stringify(strategy)}`); - throw error; - } else { - strategy.issuer.issuer = presetIssuer - parent.authLog('setupDomainAuthStrategy', `OIDC: PRESET: ${preset.toUpperCase()}: Using preset issuer: ${presetIssuer}`); - } - } else if ((typeof strategy.issuer.issuer == 'string') && (typeof strategy.custom.preset == 'string')) { - let error = new Error(`OIDC: PRESET: ${strategy.custom.preset.toUpperCase()}: PRESET OVERRIDDEN: CONFIG ISSUER: ${strategy.issuer.issuer} PRESET ISSUER: ${presetIssuer}`); - parent.authLog('setupDomainAuthStrategy', error.message); - console.warn(error) - } - - // Setup Strategy Options - strategy.custom.scope = obj.common.convertStrArray(strategy.custom.scope, ' ') - if (strategy.custom.scope.length > 1) { - strategy.options = Object.assign(strategy.options, { 'params': { 'scope': strategy.custom.scope } }) - } else { - strategy.options = Object.assign(strategy.options, { 'params': { 'scope': ['openid', 'profile', 'email'] } }) - } - if (typeof strategy.groups == 'object') { - let groupScope = strategy.groups.scope || null - if (groupScope == null) { - if (preset == 'azure') { groupScope = 'Group.Read.All' } - if (preset == 'google') { groupScope = 'https://www.googleapis.com/auth/cloud-identity.groups.readonly' } - if (typeof preset != 'string') { groupScope = 'groups' } - } - strategy.options.params.scope.push(groupScope) - } - strategy.options.params.scope = strategy.options.params.scope.join(' ') - - // Discover additional information if available, use endpoints from config if present - let issuer - try { - parent.authLog('setupDomainAuthStrategy', `OIDC: Discovering Issuer Endpoints: ${strategy.issuer.issuer}`); - issuer = await strategy.obj.openidClient.Issuer.discover(strategy.issuer.issuer); - } catch (err) { - let error = new Error('OIDC: Discovery failed.', { cause: err }); - parent.authLog('setupDomainAuthStrategy', `ERROR: ${JSON.stringify(error)} ISSUER_URI: ${strategy.issuer.issuer}`); - throw error - } - if (Object.keys(strategy.issuer).length > 1) { - parent.authLog('setupDomainAuthStrategy', `OIDC: Adding Issuer Metadata: ${JSON.stringify(strategy.issuer)}`); - issuer = new strategy.obj.openidClient.Issuer(Object.assign(issuer?.metadata, strategy.issuer)); - } - strategy.issuer = issuer?.metadata; - strategy.obj.issuer = issuer; - - var httpport = ((args.aliasport != null) ? args.aliasport : args.port); - var origin = 'https://' + (domain.dns ? domain.dns : parent.certificates.CommonName); - if (httpport != 443) { origin += ':' + httpport; } - - // Make sure redirect_uri and post_logout_redirect_uri exist before continuing - if (!strategy.client.redirect_uri) { - strategy.client.redirect_uri = origin + url + 'auth-oidc-callback'; - } - if (!strategy.client.post_logout_redirect_uri) { - strategy.client.post_logout_redirect_uri = origin + url + 'login'; - } - - // Create client and overwrite in options - let client = new issuer.Client(strategy.client) - strategy.options = Object.assign(strategy.options, { 'client': client, sessionKey: 'oidc-' + domain.id }); - strategy.client = client.metadata - strategy.obj.client = client - - // Setup strategy and save configs for later - passport.use('oidc-' + domain.id, new strategy.obj.openidClient.Strategy(strategy.options, oidcCallback)); - parent.config.domains[domain.id].authstrategies.oidc = strategy; - parent.debug('verbose', 'OIDC: Saved Configuration: ' + JSON.stringify(strategy)); - if (preset) { parent.authLog('setupDomainAuthStrategy', 'OIDC: ' + preset.toUpperCase() + ': Setup Complete'); } - else { parent.authLog('setupDomainAuthStrategy', 'OIDC: Setup Complete'); } - - authStrategyFlags |= domainAuthStrategyConsts.oidc - - function migrateOldConfigs(strategy) { - let oldConfigs = { - 'client': { - 'clientid': 'client_id', - 'clientsecret': 'client_secret', - 'callbackurl': 'redirect_uri' - }, - 'issuer': { - 'authorizationurl': 'authorization_endpoint', - 'tokenurl': 'token_endpoint', - 'userinfourl': 'userinfo_endpoint' - }, - 'custom': { - 'tenantid': 'tenant_id', - 'customerid': 'customer_id' - } - } - for (var type in oldConfigs) { - for (const [key, value] of Object.entries(oldConfigs[type])) { - if (Object.hasOwn(strategy, key)) { - if (strategy[type][value] && obj.common.validateString(strategy[type][value])) { - let error = new Error('OIDC: OLD CONFIG: Config conflict, new config overrides old config'); - parent.authLog('migrateOldConfigs', `${JSON.stringify(error)} OLD CONFIG: ${key}: ${strategy[key]} NEW CONFIG: ${value}:${strategy[type][value]}`); - } else { - parent.authLog('migrateOldConfigs', `OIDC: OLD CONFIG: Moving old config to new location. strategy.${key} => strategy.${type}.${value}`); - strategy[type][value] = strategy[key]; - } - delete strategy[key] - } - } - } - if (typeof strategy.scope == 'string') { - if (!strategy.custom.scope) { - strategy.custom.scope = strategy.scope; - strategy.options.params = { 'scope': strategy.scope }; - parent.authLog('migrateOldConfigs', `OIDC: OLD CONFIG: Moving old config to new location. strategy.scope => strategy.custom.scope`); - } else { - let error = new Error('OIDC: OLD CONFIG: Config conflict, using new config values.'); - parent.authLog('migrateOldConfigs', `${error.message} OLD CONFIG: strategy.scope: ${strategy.scope} NEW CONFIG: strategy.custom.scope:${strategy.custom.scope}`); - parent.debug('warning', error.message) - } - delete strategy.scope - } - if (strategy.groups && strategy.groups.sync && strategy.groups.sync.enabled && strategy.groups.sync.enabled === true) { - if (strategy.groups.sync.filter) { - delete strategy.groups.sync.enabled; - } else { - strategy.groups.sync = true; - } - parent.authLog('migrateOldConfigs', `OIDC: OLD CONFIG: Moving old config to new location. strategy.groups.sync.enabled => strategy.groups.sync`); - } - return strategy - } - - // Callback function must be able to grab info from API's using the access token, would prefer to use the token here. - function oidcCallback(tokenset, profile, verified) { - // Initialize user object - let user = { 'strategy': 'oidc' } - let claims = obj.common.validateObject(strategy.custom.claims) ? strategy.custom.claims : null; - user.sid = obj.common.validateString(profile.sub) ? '~oidc:' + profile.sub : null; - user.name = obj.common.validateString(profile.name) ? profile.name : null; - user.email = obj.common.validateString(profile.email) ? profile.email : null; - if (claims != null) { - user.sid = obj.common.validateString(profile[claims.uuid]) ? '~oidc:' + profile[claims.uuid] : user.sid; - user.name = obj.common.validateString(profile[claims.name]) ? profile[claims.name] : user.name; - user.email = obj.common.validateString(profile[claims.email]) ? profile[claims.email] : user.email; - } - user.emailVerified = profile.email_verified ? profile.email_verified : obj.common.validateEmail(user.email); - user.groups = obj.common.validateStrArray(profile.groups, 1) ? profile.groups : null; - user.preset = obj.common.validateString(strategy.custom.preset) ? strategy.custom.preset : null; - if (strategy.groups && obj.common.validateString(strategy.groups.claim)) { - user.groups = obj.common.validateStrArray(profile[strategy.groups.claim], 1) ? profile[strategy.groups.claim] : null - } - - // Setup end session enpoint if not already configured this requires an auth token - try { - if (!strategy.issuer.end_session_endpoint) { - strategy.issuer.end_session_endpoint = strategy.obj.client.endSessionUrl({ 'id_token_hint': tokenset }) - parent.authLog('oidcCallback', `OIDC: Discovered end_session_endpoint: ${strategy.issuer.end_session_endpoint}`); - } - } catch (err) { - let error = new Error('OIDC: Discovering end_session_endpoint failed. Using Default.', { cause: err }); - strategy.issuer.end_session_endpoint = strategy.issuer.issuer + '/logout'; - parent.debug('error', `${error.message} end_session_endpoint: ${strategy.issuer.end_session_endpoint} post_logout_redirect_uri: ${strategy.client.post_logout_redirect_uri} TOKENSET: ${JSON.stringify(tokenset)}`); - parent.authLog('oidcCallback', error.message); - } - - // Setup presets and groups, get groups from API if needed then return - if (strategy.groups && typeof user.preset == 'string') { - getGroups(user.preset, tokenset).then((groups) => { - user = Object.assign(user, { 'groups': groups }); - return verified(null, user); - }).catch((err) => { - let error = new Error('OIDC: GROUPS: No groups found due to error:', { cause: err }); - parent.debug('error', `${JSON.stringify(error)}`); - parent.authLog('oidcCallback', error.message); - user.groups = []; - return verified(null, user); - }); - } else { - return verified(null, user); - } - - async function getGroups(preset, tokenset) { - let url = ''; - if (preset == 'azure') { url = strategy.groups.recursive == true ? 'https://graph.microsoft.com/v1.0/me/transitiveMemberOf?$top=999' : 'https://graph.microsoft.com/v1.0/me/memberOf?$top=999'; } - if (preset == 'google') { url = strategy.custom.customer_id ? 'https://cloudidentity.googleapis.com/v1/groups?parent=customers/' + strategy.custom.customer_id : strategy.custom.identitysource ? 'https://cloudidentity.googleapis.com/v1/groups?parent=identitysources/' + strategy.custom.identitysource : null; } - return new Promise((resolve, reject) => { - const options = { - 'headers': { authorization: 'Bearer ' + tokenset.access_token } - } - const req = require('https').get(url, options, (res) => { - let data = [] - res.on('data', (chunk) => { - data.push(chunk); - }); - res.on('end', () => { - if (res.statusCode < 200 || res.statusCode >= 300) { - let error = new Error('OIDC: GROUPS: Bad response code from API, statusCode: ' + res.statusCode); - parent.authLog('getGroups', `ERROR: ${error.message} URL: ${url} OPTIONS: ${JSON.stringify(options)}`); - console.error(error); - reject(error); - } - if (data.length == 0) { - let error = new Error('OIDC: GROUPS: Getting groups from API failed, request returned no data in response.'); - parent.authLog('getGroups', `ERROR: ${error.message} URL: ${url} OPTIONS: ${JSON.stringify(options)}`); - console.error(error); - reject(error); - } - try { - if (Buffer.isBuffer(data[0])) { - data = Buffer.concat(data); - data = data.toString(); - } else { // else if (typeof data[0] == 'string') - data = data.join(); - } - } catch (err) { - let error = new Error('OIDC: GROUPS: Getting groups from API failed. Error joining response data.', { cause: err }); - parent.authLog('getGroups', `ERROR: ${error.message} URL: ${url} OPTIONS: ${JSON.stringify(options)}`); - console.error(error); - reject(error); - } - if (preset == 'azure') { - data = JSON.parse(data); - if (data.error) { - let error = new Error('OIDC: GROUPS: Getting groups from API failed. Error joining response data.', { cause: data.error }); - parent.authLog('getGroups', `ERROR: ${error.message} URL: ${url} OPTIONS: ${JSON.stringify(options)}`); - console.error(error); - reject(error); - } - data = data.value; - } - if (preset == 'google') { - data = data.split('\n'); - data = data.join(''); - data = JSON.parse(data); - data = data.groups; - } - let groups = [] - for (var i in data) { - if (typeof data[i].displayName == 'string') { - groups.push(data[i].displayName); - } - } - if (groups.length == 0) { - let warn = new Error('OIDC: GROUPS: No groups returned from API.'); - parent.authLog('getGroups', `WARN: ${warn.message} DATA: ${data}`); - console.warn(warn); - resolve(groups); - } else { - resolve(groups); - } - }); - }); - req.on('error', (err) => { - let error = new Error('OIDC: GROUPS: Request error.', { cause: err }); - parent.authLog('getGroups', `ERROR: ${error.message} URL: ${url} OPTIONS: ${JSON.stringify(options)}`); - console.error(error); - reject(error); - }); - req.end(); - }); - } - } - } - return authStrategyFlags; - } - - // Handle an incoming request as a web relay - function handleWebRelayRequest(req, res) { - var webRelaySessionId = null; - if ((req.session.userid != null) && (req.session.x != null)) { webRelaySessionId = req.session.userid + '/' + req.session.x; } - else if (req.session.z != null) { webRelaySessionId = req.session.z; } - if ((webRelaySessionId != null) && (obj.destroyedSessions[webRelaySessionId] == null)) { - var relaySession = webRelaySessions[webRelaySessionId + '/' + req.hostname]; - if (relaySession != null) { - // The web relay session is valid, use it - relaySession.handleRequest(req, res); - } else { - // No web relay session with this relay identifier, close the HTTP request. - res.sendStatus(404); - } - } else { - // The user is not logged in or does not have a relay identifier, close the HTTP request. - res.sendStatus(404); - } - } - - // Handle an incoming websocket connection as a web relay - function handleWebRelayWebSocket(ws, req) { - var webRelaySessionId = null; - if ((req.session.userid != null) && (req.session.x != null)) { webRelaySessionId = req.session.userid + '/' + req.session.x; } - else if (req.session.z != null) { webRelaySessionId = req.session.z; } - if ((webRelaySessionId != null) && (obj.destroyedSessions[webRelaySessionId] == null)) { - var relaySession = webRelaySessions[webRelaySessionId + '/' + req.hostname]; - if (relaySession != null) { - // The multi-tunnel session is valid, use it - relaySession.handleWebSocket(ws, req); - } else { - // No multi-tunnel session with this relay identifier, close the websocket. - ws.close(); - } - } else { - // The user is not logged in or does not have a relay identifier, close the websocket. - ws.close(); - } + // We are done starting the web server. + if (doneFunc) doneFunc(); } // Perform server inner authentication @@ -7990,7 +6581,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF if ((obj.common.validateString(command.cnonce, 1, 256) == false) || (obj.common.validateString(command.tlshash, 1, 512) == false)) { try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'badargs' })); } catch (ex) { } try { ws.close(); } catch (ex) { } - break; + break; } // Check that the TLS hash is an acceptable one. @@ -8036,7 +6627,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Figure out if email 2FA is allowed var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null) && (user.otpekey != null)); var sms2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false)) && (parent.smsserver != null) && (user.phone != null)); - var msg2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false)) && (parent.msgserver != null) && (parent.msgserver.providers != 0) && (user.msghandle != null)); //var push2fa = ((parent.firebase != null) && (user.otpdev != null)); if ((typeof command.token != 'string') || (command.token == '**email**') || (command.token == '**sms**')/* || (command.token == '**push**')*/) { if ((command.token == '**email**') && (email2fa == true)) { @@ -8046,7 +6636,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.debug('web', 'Sending 2FA email to: ' + user.email); domain.mailserver.sendAccountLoginMail(domain, user.email, user.otpekey.k, obj.getLanguageCodes(req), req.query.key); // Ask for a login token & confirm email was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, email2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, email2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } else if ((command.token == '**sms**') && (sms2fa == true)) { // Cause a token to be sent to the user's phone number user.otpsms = { k: obj.common.zeroPad(getRandomSixDigitInteger(), 6), d: Date.now() }; @@ -8054,15 +6644,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.debug('web', 'Sending 2FA SMS to: ' + user.phone); parent.smsserver.sendToken(domain, user.phone, user.otpsms.k, obj.getLanguageCodes(req)); // Ask for a login token & confirm sms was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, sms2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } - } else if ((command.token == '**msg**') && (msg2fa == true)) { - // Cause a token to be sent to the user's messenger account - user.otpmsg = { k: obj.common.zeroPad(getRandomSixDigitInteger(), 6), d: Date.now() }; - obj.db.SetUser(user); - parent.debug('web', 'Sending 2FA message to: ' + user.phone); - parent.msgserver.sendToken(domain, user.msghandle, user.otpmsg.k, obj.getLanguageCodes(req)); - // Ask for a login token & confirm sms was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, msg2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, sms2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } /* } else if ((command.token == '**push**') && (push2fa == true)) { // Cause push notification to device @@ -8077,20 +6659,20 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } else { // Ask for a login token parent.debug('web', 'Asking for login token'); - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (ex) { console.log(ex); } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (ex) { console.log(ex); } } } else { checkUserOneTimePassword(req, domain, user, command.token, null, function (result, authData) { if (result == false) { // Failed, ask for a login token again parent.debug('web', 'Invalid login token, asking again'); - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } else { // We are authenticated with 2nd factor. // Check email verification if (emailcheck && (user.email != null) && (!(user._id.split('/')[2].startsWith('~'))) && (user.emailVerified !== true)) { parent.debug('web', 'Invalid login, asking for email validation'); - try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, email2fasent: true })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, email2fasent: true })); ws.close(); } catch (e) { } } else { // We are authenticated ws._socket.pause(); @@ -8106,8 +6688,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.debug('web', 'Invalid login, asking for email validation'); var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null) && (user.otpekey != null)); var sms2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false)) && (parent.smsserver != null) && (user.phone != null)); - var msg2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false)) && (parent.msgserver != null) && (parent.msgserver.providers != 0) && (user.msghandle != null)); - try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, email2fasent: true })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, email2fasent: true })); ws.close(); } catch (e) { } } else { // We are authenticated ws._socket.pause(); @@ -8172,6 +6753,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF if ((req.query.user != null) && (req.query.pass != null)) { // A user/pass is provided in URL arguments obj.authenticate(req.query.user, req.query.pass, domain, function (err, userid, passhint, loginOptions) { + var user = obj.users[userid]; // Check if user as the "notools" site right. If so, deny this connection as tools are not allowed to connect. @@ -8192,7 +6774,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Figure out if email 2FA is allowed var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null) && (user.otpekey != null)); var sms2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false)) && (parent.smsserver != null) && (user.phone != null)); - var msg2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false)) && (parent.msgserver != null) && (parent.msgserver.providers != 0) && (user.msghandle != null)); //var push2fa = ((parent.firebase != null) && (user.otpdev != null)); if ((typeof req.query.token != 'string') || (req.query.token == '**email**') || (req.query.token == '**sms**')/* || (req.query.token == '**push**')*/) { if ((req.query.token == '**email**') && (email2fa == true)) { @@ -8202,7 +6783,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.debug('web', 'Sending 2FA email to: ' + user.email); domain.mailserver.sendAccountLoginMail(domain, user.email, user.otpekey.k, obj.getLanguageCodes(req), req.query.key); // Ask for a login token & confirm email was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, email2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, email2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } else if ((req.query.token == '**sms**') && (sms2fa == true)) { // Cause a token to be sent to the user's phone number user.otpsms = { k: obj.common.zeroPad(getRandomSixDigitInteger(), 6), d: Date.now() }; @@ -8210,15 +6791,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.debug('web', 'Sending 2FA SMS to: ' + user.phone); parent.smsserver.sendToken(domain, user.phone, user.otpsms.k, obj.getLanguageCodes(req)); // Ask for a login token & confirm sms was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, sms2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } - } else if ((req.query.token == '**msg**') && (msg2fa == true)) { - // Cause a token to be sent to the user's messenger account - user.otpmsg = { k: obj.common.zeroPad(getRandomSixDigitInteger(), 6), d: Date.now() }; - obj.db.SetUser(user); - parent.debug('web', 'Sending 2FA message to: ' + user.msghandle); - parent.msgserver.sendToken(domain, user.msghandle, user.otpmsg.k, obj.getLanguageCodes(req)); - // Ask for a login token & confirm message was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, msg2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, sms2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } /* } else if ((command.token == '**push**') && (push2fa == true)) { // Cause push notification to device @@ -8233,24 +6806,21 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } else { // Ask for a login token parent.debug('web', 'Asking for login token'); - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } } else { checkUserOneTimePassword(req, domain, user, req.query.token, null, function (result, authData) { if (result == false) { // Failed, ask for a login token again parent.debug('web', 'Invalid login token, asking again'); - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } else { // We are authenticated with 2nd factor. // Check email verification if (emailcheck && (user.email != null) && (!(user._id.split('/')[2].startsWith('~'))) && (user.emailVerified !== true)) { parent.debug('web', 'Invalid login, asking for email validation'); - try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, email2fasent: true })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, email2fasent: true })); ws.close(); } catch (e) { } } else { - req.session.userid = user._id; - req.session.ip = req.clientIp; - setSessionRandom(req); func(ws, req, domain, user, null, authData); } } @@ -8262,13 +6832,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.debug('web', 'Invalid login, asking for email validation'); var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null) && (user.otpekey != null)); var sms2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false)) && (parent.smsserver != null) && (user.phone != null)); - var msg2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false)) && (parent.msgserver != null) && (parent.msgserver.providers != 0) && (user.msghandle != null)); - try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, email2fasent: true })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, sms2fa: sms2fa, email2fasent: true })); ws.close(); } catch (e) { } } else { // We are authenticated - req.session.userid = user._id; - req.session.ip = req.clientIp; - setSessionRandom(req); func(ws, req, domain, user); } } @@ -8345,9 +6911,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Figure out if email 2FA is allowed var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null) && (user.otpekey != null)); var sms2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false)) && (parent.smsserver != null) && (user.phone != null)); - var msg2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false)) && (parent.msgserver != null) && (parent.msgserver.providers != 0) && (user.msghandle != null)); if (s.length != 3) { - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, msg2fa: msg2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } else { checkUserOneTimePassword(req, domain, user, s[2], null, function (result, authData) { if (result == false) { @@ -8367,14 +6932,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF parent.smsserver.sendToken(domain, user.phone, user.otpsms.k, obj.getLanguageCodes(req)); // Ask for a login token & confirm sms was sent try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', sms2fa: sms2fa, sms2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } - } else if ((s[2] == '**msg**') && (msg2fa == true)) { - // Cause a token to be sent to the user's phone number - user.otpmsg = { k: obj.common.zeroPad(getRandomSixDigitInteger(), 6), d: Date.now() }; - obj.db.SetUser(user); - parent.debug('web', 'Sending 2FA message to: ' + user.msghandle); - parent.msgserver.sendToken(domain, user.msghandle, user.otpmsg.k, obj.getLanguageCodes(req)); - // Ask for a login token & confirm sms was sent - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', msg2fa: msg2fa, msg2fasent: true, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } } else { // Ask for a login token try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, twoFactorCookieDays: twoFactorCookieDays })); ws.close(); } catch (e) { } @@ -8397,10 +6954,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF if (emailcheck && (user.email != null) && (!(user._id.split('/')[2].startsWith('~'))) && (user.emailVerified !== true)) { parent.debug('web', 'Invalid login, asking for email validation'); try { ws.send(JSON.stringify({ action: 'close', cause: 'emailvalidation', msg: 'emailvalidationrequired', email2fa: email2fa, email2fasent: true })); ws.close(); } catch (e) { } - } else { - req.session.userid = user._id; - req.session.ip = req.clientIp; - setSessionRandom(req); + } else { func(ws, req, domain, user); } } @@ -8458,22 +7012,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF obj.args.port = port; if (obj.tlsServer != null) { if (obj.args.lanonly == true) { - obj.tcpServer = obj.tlsServer.listen(port, addr, function () { console.log('MeshCentral HTTPS server running on port ' + port + ((typeof args.aliasport == 'number') ? (', alias port ' + args.aliasport) : '') + '.'); }); + obj.tcpServer = obj.tlsServer.listen(port, addr, function () { console.log('MeshCentral HTTPS server running on port ' + port + ((args.aliasport != null) ? (', alias port ' + args.aliasport) : '') + '.'); }); } else { - obj.tcpServer = obj.tlsServer.listen(port, addr, function () { - console.log('MeshCentral HTTPS server running on ' + certificates.CommonName + ':' + port + ((typeof args.aliasport == 'number') ? (', alias port ' + args.aliasport) : '') + '.'); - if (args.relaydns != null) { console.log('MeshCentral HTTPS relay server running on ' + args.relaydns[0] + ':' + port + ((typeof args.aliasport == 'number') ? (', alias port ' + args.aliasport) : '') + '.'); } - }); + obj.tcpServer = obj.tlsServer.listen(port, addr, function () { console.log('MeshCentral HTTPS server running on ' + certificates.CommonName + ':' + port + ((args.aliasport != null) ? (', alias port ' + args.aliasport) : '') + '.'); }); obj.parent.updateServerState('servername', certificates.CommonName); } - obj.parent.debug('https', 'Server listening on ' + ((addr != null) ? addr : '0.0.0.0') + ' port ' + port + '.'); + if (obj.parent.authlog) { obj.parent.authLog('https', 'Server listening on ' + ((addr != null) ? addr : '0.0.0.0') + ' port ' + port + '.'); } obj.parent.updateServerState('https-port', port); if (args.aliasport != null) { obj.parent.updateServerState('https-aliasport', args.aliasport); } } else { - obj.tcpServer = obj.app.listen(port, addr, function () { - console.log('MeshCentral HTTP server running on port ' + port + ((typeof args.aliasport == 'number') ? (', alias port ' + args.aliasport) : '') + '.'); - if (args.relaydns != null) { console.log('MeshCentral HTTP relay server running on ' + args.relaydns[0] + ':' + port + ((typeof args.aliasport == 'number') ? (', alias port ' + args.aliasport) : '') + '.'); } - }); + obj.tcpServer = obj.app.listen(port, addr, function () { console.log('MeshCentral HTTP server running on port ' + port + ((args.aliasport != null) ? (', alias port ' + args.aliasport) : '') + '.'); }); obj.parent.updateServerState('http-port', port); if (args.aliasport != null) { obj.parent.updateServerState('http-aliasport', args.aliasport); } } @@ -8496,16 +7044,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF function StartAltWebServer(port, addr) { if ((port < 1) || (port > 65535)) return; var agentAliasPort = null; - var agentAliasDns = null; if (args.agentaliasport != null) { agentAliasPort = args.agentaliasport; } - if (args.agentaliasdns != null) { agentAliasDns = args.agentaliasdns; } if (obj.tlsAltServer != null) { if (obj.args.lanonly == true) { obj.tcpAltServer = obj.tlsAltServer.listen(port, addr, function () { console.log('MeshCentral HTTPS agent-only server running on port ' + port + ((agentAliasPort != null) ? (', alias port ' + agentAliasPort) : '') + '.'); }); } else { - obj.tcpAltServer = obj.tlsAltServer.listen(port, addr, function () { console.log('MeshCentral HTTPS agent-only server running on ' + ((agentAliasDns != null) ? agentAliasDns : certificates.CommonName) + ':' + port + ((agentAliasPort != null) ? (', alias port ' + agentAliasPort) : '') + '.'); }); + obj.tcpAltServer = obj.tlsAltServer.listen(port, addr, function () { console.log('MeshCentral HTTPS agent-only server running on ' + certificates.CommonName + ':' + port + ((agentAliasPort != null) ? (', alias port ' + agentAliasPort) : '') + '.'); }); } - obj.parent.debug('https', 'Server listening on 0.0.0.0 port ' + port + '.'); + if (obj.parent.authlog) { obj.parent.authLog('https', 'Server listening on 0.0.0.0 port ' + port + '.'); } obj.parent.updateServerState('https-agent-port', port); } else { obj.tcpAltServer = obj.agentapp.listen(port, addr, function () { console.log('MeshCentral HTTP agent-only server running on port ' + port + ((agentAliasPort != null) ? (', alias port ' + agentAliasPort) : '') + '.'); }); @@ -8660,7 +7206,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } }; - /* Access Control Functions */ + // + // Access Control Functions + // // Remove user rights function removeUserRights(rights, user) { @@ -8997,9 +7545,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF delete user2.subscriptions; delete user2.passtype; delete user2.otpsms; - delete user2.otpmsg; if ((typeof user2.otpekey == 'object') && (user2.otpekey != null)) { user2.otpekey = 1; } // Indicates that email 2FA is enabled. - if ((typeof user2.otpduo == 'object') && (user2.otpduo != null)) { user2.otpduo = 1; } // Indicates that duo 2FA is enabled. if ((typeof user2.otpsecret == 'string') && (user2.otpsecret != null)) { user2.otpsecret = 1; } // Indicates a time secret is present. if ((typeof user2.otpkeys == 'object') && (user2.otpkeys != null)) { user2.otpkeys = 0; if (user.otpkeys != null) { for (var i = 0; i < user.otpkeys.keys.length; i++) { if (user.otpkeys.keys[i].u == true) { user2.otpkeys = 1; } } } } // Indicates the number of one time backup codes that are active. if ((typeof user2.otphkeys == 'object') && (user2.otphkeys != null)) { user2.otphkeys = user2.otphkeys.length; } // Indicates the number of hardware keys setup @@ -9055,8 +7601,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } // Filter the user web site and only output state that we need to keep - const acceptableUserWebStateStrings = ['webPageStackMenu', 'notifications', 'deviceView', 'nightMode', 'webPageFullScreen', 'search', 'showRealNames', 'sort', 'deskAspectRatio', 'viewsize', 'DeskControl', 'uiMode', 'footerBar','loctag','theme','lastThemes','uiViewMode']; - const acceptableUserWebStateDesktopStrings = ['encoding', 'showfocus', 'showmouse', 'showcad', 'limitFrameRate', 'noMouseRotate', 'quality', 'scaling', 'agentencoding'] + const acceptableUserWebStateStrings = ['webPageStackMenu', 'notifications', 'deviceView', 'nightMode', 'webPageFullScreen', 'search', 'showRealNames', 'sort', 'deskAspectRatio', 'viewsize', 'DeskControl', 'uiMode', 'footerBar']; + const acceptableUserWebStateDesktopStrings = ['encoding', 'showfocus', 'showmouse', 'showcad', 'limitFrameRate', 'noMouseRotate', 'quality', 'scaling'] obj.filterUserWebState = function (state) { if (typeof state == 'string') { try { state = JSON.parse(state); } catch (ex) { return null; } } if ((state == null) || (typeof state != 'object')) { return null; } @@ -9077,7 +7623,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } if ((typeof state.deskKeyShortcuts == 'string') && (state.deskKeyShortcuts.length < 2048)) { out.deskKeyShortcuts = state.deskKeyShortcuts; } if ((typeof state.deskStrings == 'string') && (state.deskStrings.length < 10000)) { out.deskStrings = state.deskStrings; } - if ((typeof state.runopt == 'string') && (state.runopt.length < 30000)) { out.runopt = state.runopt; } return JSON.stringify(out); } @@ -9160,7 +7705,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } xargs.extitle = encodeURIComponent(xargs.title).split('\'').join('\\\''); xargs.domainurl = domain.url; - xargs.autocomplete = (domain.autocomplete === false) ? 'autocomplete=off x' : 'autocomplete'; // This option allows autocomplete to be turned off on the login page. + xargs.autocomplete = (domain.autocomplete === false)?'x':'autocomplete'; // This option allows autocomplete to be turned off on the login page. if (typeof domain.hide == 'number') { xargs.hide = domain.hide; } // To mitigate any possible BREACH attack, we generate a random 0 to 255 bytes length string here. @@ -9271,9 +7816,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF if (obj.renderPages != null) { // Get the list of acceptable languages in order var acceptLanguages = obj.getLanguageCodes(req); - var domain = getDomain(req); + // Take a look at the options we have for this file - var fileOptions = obj.renderPages[domain.id][obj.path.basename(filename)]; + var fileOptions = obj.renderPages[obj.path.basename(filename)]; if (fileOptions != null) { for (var i in acceptLanguages) { if ((acceptLanguages[i] == 'en') || (acceptLanguages[i].startsWith('en-'))) { @@ -9320,58 +7865,36 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF if (translateFolder != null) { obj.renderPages = {}; obj.renderLanguages = ['en']; - for (var i in parent.config.domains) { - if (obj.fs.existsSync('views/translations')) { translateFolder = 'views/translations'; } - if (obj.fs.existsSync(obj.path.join(__dirname, 'views', 'translations'))) { translateFolder = obj.path.join(__dirname, 'views', 'translations'); } + var files = obj.fs.readdirSync(translateFolder); + for (var i in files) { + var name = files[i]; + if (name.endsWith('.handlebars')) { + name = name.substring(0, name.length - 11); + var xname = name.split('_'); + if (xname.length == 2) { + if (obj.renderPages[xname[0]] == null) { obj.renderPages[xname[0]] = {}; } + obj.renderPages[xname[0]][xname[1]] = obj.path.join(translateFolder, name); + if (obj.renderLanguages.indexOf(xname[1]) == -1) { obj.renderLanguages.push(xname[1]); } + } + } + } + + // See if there are any custom rending pages that will override the default ones + if ((obj.parent.webViewsOverridePath != null) && (obj.fs.existsSync(obj.path.join(obj.parent.webViewsOverridePath, 'translations')))) { + translateFolder = obj.path.join(obj.parent.webViewsOverridePath, 'translations'); var files = obj.fs.readdirSync(translateFolder); - var domain = parent.config.domains[i].id; - obj.renderPages[domain] = {}; for (var i in files) { var name = files[i]; if (name.endsWith('.handlebars')) { name = name.substring(0, name.length - 11); var xname = name.split('_'); if (xname.length == 2) { - if (obj.renderPages[domain][xname[0]] == null) { obj.renderPages[domain][xname[0]] = {}; } - obj.renderPages[domain][xname[0]][xname[1]] = obj.path.join(translateFolder, name); + if (obj.renderPages[xname[0]] == null) { obj.renderPages[xname[0]] = {}; } + obj.renderPages[xname[0]][xname[1]] = obj.path.join(translateFolder, name); if (obj.renderLanguages.indexOf(xname[1]) == -1) { obj.renderLanguages.push(xname[1]); } } } } - // See if there are any custom rending pages that will override the default ones - if ((obj.parent.webViewsOverridePath != null) && (obj.fs.existsSync(obj.path.join(obj.parent.webViewsOverridePath, 'translations')))) { - translateFolder = obj.path.join(obj.parent.webViewsOverridePath, 'translations'); - var files = obj.fs.readdirSync(translateFolder); - for (var i in files) { - var name = files[i]; - if (name.endsWith('.handlebars')) { - name = name.substring(0, name.length - 11); - var xname = name.split('_'); - if (xname.length == 2) { - if (obj.renderPages[domain][xname[0]] == null) { obj.renderPages[domain][xname[0]] = {}; } - obj.renderPages[domain][xname[0]][xname[1]] = obj.path.join(translateFolder, name); - if (obj.renderLanguages.indexOf(xname[1]) == -1) { obj.renderLanguages.push(xname[1]); } - } - } - } - } - // See if there is a custom meshcentral-web-domain folder as that will override the default ones - if (obj.fs.existsSync(obj.path.join(__dirname, '..', 'meshcentral-web-' + domain, 'views', 'translations'))) { - translateFolder = obj.path.join(__dirname, '..', 'meshcentral-web-' + domain, 'views', 'translations'); - var files = obj.fs.readdirSync(translateFolder); - for (var i in files) { - var name = files[i]; - if (name.endsWith('.handlebars')) { - name = name.substring(0, name.length - 11); - var xname = name.split('_'); - if (xname.length == 2) { - if (obj.renderPages[domain][xname[0]] == null) { obj.renderPages[domain][xname[0]] = {}; } - obj.renderPages[domain][xname[0]][xname[1]] = obj.path.join(translateFolder, name); - if (obj.renderLanguages.indexOf(xname[1]) == -1) { obj.renderLanguages.push(xname[1]); } - } - } - } - } } } } @@ -9457,7 +7980,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } - // Ensure exclusivity of a push messaging token for Android device + // Insure exclusivity of a push messaging token for Android device obj.removePmtFromAllOtherNodes = function (node) { if (typeof node.pmt != 'string') return; db.Get('pmt_' + node.pmt, function (err, docs) { @@ -9475,7 +7998,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var event = { etype: 'node', action: 'changenode', nodeid: oldNode._id, domain: oldNode.domain, node: obj.CloneSafeNode(oldNode) } if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the mesh. Another event will come. parent.DispatchEvent(['*', oldNode.meshid, oldNode._id], obj, event); - } + } } }); } @@ -9493,37 +8016,18 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } // Return decoded user agent information - obj.getUserAgentInfo = function (req) { + function getUserAgentInfo(req) { var browser = 'Unknown', os = 'Unknown'; try { - const ua = obj.uaparser((typeof req == 'string') ? req : req.headers['user-agent']); + const ua = obj.uaparser(req.headers['user-agent']); if (ua.browser && ua.browser.name) { ua.browserStr = ua.browser.name; if (ua.browser.version) { ua.browserStr += '/' + ua.browser.version } } if (ua.os && ua.os.name) { ua.osStr = ua.os.name; if (ua.os.version) { ua.osStr += '/' + ua.os.version } } return ua; } catch (ex) { return { browserStr: browser, osStr: os } } } - // Return the query string portion of the URL, the ? and anything after BUT remove secret keys from authentication providers - function getQueryPortion(req) { - var removeKeys = ['duo_code', 'state']; // Keys to remove - var s = req.url.indexOf('?'); - if (s == -1) { - if (req.body && req.body.urlargs) { - return req.body.urlargs; - } - return ''; - } - var queryString = req.url.substring(s + 1); - var params = queryString.split('&'); - var filteredParams = []; - for (var i = 0; i < params.length; i++) { - var key = params[i].split('=')[0]; - if (removeKeys.indexOf(key) === -1) { - filteredParams.push(params[i]); - } - } - return (filteredParams.length > 0 ? ('?' + filteredParams.join('&')) : ''); - } + // Return the query string portion of the URL, the ? and anything after. + function getQueryPortion(req) { var s = req.url.indexOf('?'); if (s == -1) { if (req.body && req.body.urlargs) { return req.body.urlargs; } return ''; } return req.url.substring(s); } // Generate a random Intel AMT password function checkAmtPassword(p) { return (p.length > 7) && (/\d/.test(p)) && (/[a-z]/.test(p)) && (/[A-Z]/.test(p)) && (/\W/.test(p)); } @@ -9759,150 +8263,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF return header + value + '\r\n'; } - // Check that everything is cleaned up - function checkWebRelaySessionsTimeout() { - for (var i in webRelaySessions) { webRelaySessions[i].checkTimeout(); } - } - - // Return true if this is a private IP address - function isPrivateAddress(ip_addr) { - // If this is a loopback address, return true - if ((ip_addr == '127.0.0.1') || (ip_addr == '::1')) return true; - - // Check IPv4 private addresses - const ipcheck = require('ipcheck'); - const IPv4PrivateRanges = ['0.0.0.0/8', '10.0.0.0/8', '100.64.0.0/10', '127.0.0.0/8', '169.254.0.0/16', '172.16.0.0/12', '192.0.0.0/24', '192.0.0.0/29', '192.0.0.8/32', '192.0.0.9/32', '192.0.0.10/32', '192.0.0.170/32', '192.0.0.171/32', '192.0.2.0/24', '192.31.196.0/24', '192.52.193.0/24', '192.88.99.0/24', '192.168.0.0/16', '192.175.48.0/24', '198.18.0.0/15', '198.51.100.0/24', '203.0.113.0/24', '240.0.0.0/4', '255.255.255.255/32'] - for (var i in IPv4PrivateRanges) { if (ipcheck.match(ip_addr, IPv4PrivateRanges[i])) return true; } - - // Check IPv6 private addresses - return /^::$/.test(ip_addr) || - /^::1$/.test(ip_addr) || - /^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ip_addr) || - /^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ip_addr) || - /^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(ip_addr) || - /^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) || - /^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) || - /^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) || - /^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) || - /^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) || - /^f[c-d]([0-9a-fA-F]{2,2}):/i.test(ip_addr) || - /^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(ip_addr) || - /^ff([0-9a-fA-F]{2,2}):/i.test(ip_addr) - } // Check that a cookie IP is within the correct range depending on the active policy function checkCookieIp(cookieip, ip) { if (obj.args.cookieipcheck == 'none') return true; // 'none' - No IP address checking if (obj.args.cookieipcheck == 'strict') return (cookieip == ip); // 'strict' - Strict IP address checking, this can cause issues with HTTP proxies or load-balancers. - if (require('ipcheck').match(cookieip, ip + '/24')) return true; // 'lax' - IP address need to be in the some range - return (isPrivateAddress(cookieip) && isPrivateAddress(ip)); // 'lax' - If both IP addresses are private or loopback, accept it. This is needed because sometimes browsers will resolve IP addresses oddly on private networks. - } - - // Takes a formating string like "this {{{a}}} is an {{{b}}} example" and fills the a and b with input o.a and o.b - function assembleStringFromObject(format, o) { - var r = '', i = format.indexOf('{{{'); - if (i > 0) { r = format.substring(0, i); format = format.substring(i); } - const cmd = format.split('{{{'); - for (var j in cmd) { if (j == 0) continue; i = cmd[j].indexOf('}}}'); r += o[cmd[j].substring(0, i)] + cmd[j].substring(i + 3); } - return r; - } - - // Sync an account with an external user group. - // Return true if the user was changed - function syncExternalUserGroups(domain, user, userMemberships, userMembershipType) { - var userChanged = false; - if (user.links == null) { user.links = {}; } - - // Create a user of memberships for this user that type - var existingUserMemberships = {}; - for (var i in user.links) { - if (i.startsWith('ugrp/') && (obj.userGroups[i] != null) && (obj.userGroups[i].membershipType == userMembershipType)) { existingUserMemberships[i] = obj.userGroups[i]; } - } - - // Go thru the list user memberships and create and add to any user groups as needed - for (var i in userMemberships) { - const membership = userMemberships[i]; - var ugrpid = 'ugrp/' + domain.id + '/' + obj.crypto.createHash('sha384').update(membership).digest('base64').replace(/\+/g, '@').replace(/\//g, '$'); - var ugrp = obj.userGroups[ugrpid]; - if (ugrp == null) { - // This user group does not exist, create it - ugrp = { type: 'ugrp', _id: ugrpid, name: membership, domain: domain.id, membershipType: userMembershipType, links: {} }; - - // Save the new group - db.Set(ugrp); - if (db.changeStream == false) { obj.userGroups[ugrpid] = ugrp; } - - // Event the user group creation - var event = { etype: 'ugrp', ugrpid: ugrpid, name: ugrp.name, action: 'createusergroup', links: ugrp.links, msgid: 69, msgArgv: [ugrp.name], msg: 'User group created: ' + ugrp.name, ugrpdomain: domain.id }; - parent.DispatchEvent(['*', ugrpid, user._id], obj, event); // Even if DB change stream is active, this event must be acted upon. - - // Log in the auth log - parent.authLog('https', userMembershipType.toUpperCase() + ': Created user group ' + ugrp.name); - } - - if (existingUserMemberships[ugrpid] == null) { - // This user is not part of the user group, add it. - if (user.links == null) { user.links = {}; } - user.links[ugrp._id] = { rights: 1 }; - userChanged = true; - db.SetUser(user); - parent.DispatchEvent([user._id], obj, 'resubscribe'); - - // Notify user change - var targets = ['*', 'server-users', user._id]; - var event = { etype: 'user', userid: user._id, username: user.name, account: obj.CloneSafeUser(user), action: 'accountchange', msgid: 67, msgArgs: [user.name], msg: 'User group membership changed: ' + user.name, domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. - parent.DispatchEvent(targets, obj, event); - - // Add a user to the user group - ugrp.links[user._id] = { userid: user._id, name: user.name, rights: 1 }; - db.Set(ugrp); - - // Notify user group change - var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: ugrp._id, name: ugrp.name, desc: ugrp.desc, action: 'usergroupchange', links: ugrp.links, msgid: 71, msgArgs: [user.name, ugrp.name], msg: 'Added user(s) ' + user.name + ' to user group ' + ugrp.name, addUserDomain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user group. Another event will come. - parent.DispatchEvent(['*', ugrp._id, user._id], obj, event); - - // Log in the auth log - parent.authLog('https', userMembershipType.toUpperCase() + ': Adding ' + user.name + ' to user group ' + userMemberships[i] + '.'); - } else { - // User is already part of this user group - delete existingUserMemberships[ugrpid]; - } - } - - // Remove the user from any memberships they don't belong to anymore - for (var ugrpid in existingUserMemberships) { - var ugrp = obj.userGroups[ugrpid]; - parent.authLog('https', userMembershipType.toUpperCase() + ': Removing ' + user.name + ' from user group ' + ugrp.name + '.'); - if ((user.links != null) && (user.links[ugrpid] != null)) { - delete user.links[ugrpid]; - - // Notify user change - var targets = ['*', 'server-users', user._id, user._id]; - var event = { etype: 'user', userid: user._id, username: user.name, account: obj.CloneSafeUser(user), action: 'accountchange', msgid: 67, msgArgs: [user.name], msg: 'User group membership changed: ' + user.name, domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come. - parent.DispatchEvent(targets, obj, event); - - db.SetUser(user); - parent.DispatchEvent([user._id], obj, 'resubscribe'); - } - - if (ugrp != null) { - // Remove the user from the group - if ((ugrp.links != null) && (ugrp.links[user._id] != null)) { - delete ugrp.links[user._id]; - db.Set(ugrp); - - // Notify user group change - var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: ugrp._id, name: ugrp.name, desc: ugrp.desc, action: 'usergroupchange', links: ugrp.links, msgid: 72, msgArgs: [user.name, ugrp.name], msg: 'Removed user ' + user.name + ' from user group ' + ugrp.name, domain: domain.id }; - if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user group. Another event will come. - parent.DispatchEvent(['*', ugrp._id, user._id], obj, event); - } - } - } - - return userChanged; + return require('ipcheck').match(cookieip, ip + '/24'); // 'lax' - IP address need to be in the some range } return obj;