Merge branch 'master' of https://github.com/Ylianst/MeshCentral into master

This commit is contained in:
Bryan Roe 2021-01-18 22:08:37 -08:00
commit c5d4885b45
4 changed files with 2759 additions and 2869 deletions

View File

@ -20,26 +20,25 @@ CheckStartupType() {
if [[ $starttype1 == 'systemd' ]] if [[ $starttype1 == 'systemd' ]]
then return 1; then return 1;
elif [[ $starttype1 == 'init' || $starttype2 == 'init' ]] elif [[ $starttype1 == 'init' || $starttype2 == 'init' ]]
then then
if [ -d "/etc/init" ] if [ -d "/etc/init" ]
then then
return 2; return 2;
else else
return 3; return 3;
fi fi
fi fi
return 0; return 0;
} }
# Add "StartupType=(type)" to .msh file # Add "StartupType=(type)" to .msh file
UpdateMshFile() { UpdateMshFile() {
# Remove all lines that start with "StartupType=" # Remove all lines that start with "StartupType="
sed '/^StartupType=/ d' < /usr/local/mesh/meshagent.msh >> /usr/local/mesh/meshagent2.msh sed '/^StartupType=/ d' < ./meshagent.msh >> ./meshagent2.msh
# Add the startup type to the file # Add the startup type to the file
echo "StartupType=$starttype" >> /usr/local/mesh/meshagent2.msh echo "StartupType=$starttype" >> ./meshagent2.msh
mv /usr/local/mesh/meshagent2.msh /usr/local/mesh/meshagent.msh mv ./meshagent2.msh ./meshagent.msh
} }
CheckInstallAgent() { CheckInstallAgent() {
@ -52,8 +51,9 @@ CheckInstallAgent() {
fi fi
if [ $# -ge 2 ] if [ $# -ge 2 ]
then then
url=$1 uninstall=$1
meshid=$2 url=$2
meshid=$3
meshidlen=${#meshid} meshidlen=${#meshid}
if [ $meshidlen -gt 63 ] if [ $meshidlen -gt 63 ]
then then
@ -61,41 +61,41 @@ CheckInstallAgent() {
machinetype=$( uname -m ) machinetype=$( uname -m )
# If we have 3 arguments... # If we have 3 arguments...
if [ $# -ge 3 ] if [ $# -ge 4 ]
then then
# echo "Computer type is specified..." # echo "Computer type is specified..."
machineid=$3 machineid=$4
else else
# echo "Detecting computer type..." # echo "Detecting computer type..."
if [ $machinetype == 'x86_64' ] || [ $machinetype == 'amd64' ] if [ $machinetype == 'x86_64' ] || [ $machinetype == 'amd64' ]
then then
if [ $starttype -eq 5 ] if [ $starttype -eq 5 ]
then then
# FreeBSD x86, 64 bit # FreeBSD x86, 64 bit
machineid=30 machineid=30
else else
# Linux x86, 64 bit # Linux x86, 64 bit
bitlen=$( getconf LONG_BIT ) bitlen=$( getconf LONG_BIT )
if [ $bitlen == '32' ] if [ $bitlen == '32' ]
then then
# 32 bit OS # 32 bit OS
machineid=5 machineid=5
else else
# 64 bit OS # 64 bit OS
machineid=6 machineid=6
fi fi
fi fi
fi fi
if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ] || [ $machinetype == 'i586' ] if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ] || [ $machinetype == 'i586' ]
then then
if [ $starttype -eq 5 ] if [ $starttype -eq 5 ]
then then
# FreeBSD x86, 32 bit # FreeBSD x86, 32 bit
machineid=31 machineid=31
else else
# Linux x86, 32 bit # Linux x86, 32 bit
machineid=5 machineid=5
fi fi
fi fi
if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ] if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ]
then then
@ -114,169 +114,66 @@ CheckInstallAgent() {
then then
echo "Unsupported machine type: $machinetype." echo "Unsupported machine type: $machinetype."
else else
DownloadAgent $url $meshid $machineid DownloadAgent $uninstall $url $meshid $machineid
fi fi
else else
echo "MeshID is not correct, must be at least 64 characters long." echo "Device group identifier is not correct, must be at least 64 characters long."
fi fi
else else
echo "URI and/or MeshID have not been specified, must be passed in as arguments." echo "URI and/or device group identifier have not been specified, must be passed in as arguments."
return 0; return 0;
fi fi
} }
DownloadAgent() { DownloadAgent() {
url=$1 uninstall=$1
meshid=$2 url=$2
machineid=$3 meshid=$3
# Create folder machineid=$4
mkdir -p /usr/local/mesh echo "Downloading agent #$machineid..."
cd /usr/local/mesh wget $url/meshagents?id=$machineid {{{wgetoptionshttps}}}-O ./meshagent || curl {{{curloptionshttps}}}--output ./meshagent $url/meshagents?id=$machineid
echo "Downloading Mesh agent #$machineid..."
wget $url/meshagents?id=$machineid {{{wgetoptionshttps}}}-O /usr/local/mesh/meshagent || curl {{{curloptionshttps}}}--output /usr/local/mesh/meshagent $url/meshagents?id=$machineid
# If it did not work, try again using http # If it did not work, try again using http
if [ $? != 0 ] if [ $? != 0 ]
then then
url=${url/"https://"/"http://"} url=${url/"https://"/"http://"}
wget $url/meshagents?id=$machineid {{{wgetoptionshttp}}}-O /usr/local/mesh/meshagent || curl {{{curloptionshttp}}}--output /usr/local/mesh/meshagent $url/meshagents?id=$machineid wget $url/meshagents?id=$machineid {{{wgetoptionshttp}}}-O ./meshagent || curl {{{curloptionshttp}}}--output ./meshagent $url/meshagents?id=$machineid
fi fi
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
echo "Mesh agent downloaded." echo "Agent downloaded."
# TODO: We could check the meshagent sha256 hash, but best to authenticate the server. # TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
chmod 755 /usr/local/mesh/meshagent chmod 755 ./meshagent
wget $url/meshsettings?id=$meshid {{{wgetoptionshttps}}}-O /usr/local/mesh/meshagent.msh || curl {{{curloptionshttps}}}--output /usr/local/mesh/meshagent.msh $url/meshsettings?id=$meshid wget $url/meshsettings?id=$meshid {{{wgetoptionshttps}}}-O ./meshagent.msh || curl {{{curloptionshttps}}}--output ./meshagent.msh $url/meshsettings?id=$meshid
# If it did not work, try again using http # If it did not work, try again using http
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
wget $url/meshsettings?id=$meshid {{{wgetoptionshttp}}}-O /usr/local/mesh/meshagent.msh || curl {{{curloptionshttp}}}--output /usr/local/mesh/meshagent.msh $url/meshsettings?id=$meshid wget $url/meshsettings?id=$meshid {{{wgetoptionshttp}}}-O ./meshagent.msh || curl {{{curloptionshttp}}}--output ./meshagent.msh $url/meshsettings?id=$meshid
fi fi
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
UpdateMshFile # Update the .msh file and run the agent installer/uninstaller
if [ $starttype -eq 1 ] if [ $uninstall == 'uninstall' ] || [ $uninstall == 'UNINSTALL' ]
then then
# systemd # Uninstall the agent
if [ -d "/lib/systemd/system/" ] ./meshagent -fulluninstall
then
echo -e "[Unit]\nDescription=MeshCentral Agent\n[Service]\nWorkingDirectory=/usr/local/mesh\nExecStart=/usr/local/mesh/meshagent\nStandardOutput=null\nRestart=always\nRestartSec=3\n[Install]\nWantedBy=multi-user.target\nAlias=meshagent.service\n" > /lib/systemd/system/meshagent.service
else
# Some distros have the systemd folder at a different place
if [ -d "/usr/lib/systemd/system/" ]
then
echo -e "[Unit]\nDescription=MeshCentral Agent\n[Service]\nWorkingDirectory=/usr/local/mesh\nExecStart=/usr/local/mesh/meshagent\nStandardOutput=null\nRestart=always\nRestartSec=3\n[Install]\nWantedBy=multi-user.target\nAlias=meshagent.service\n" > /usr/lib/systemd/system/meshagent.service
else
echo "Unable to find systemd folder."
fi
fi
systemctl enable meshagent
systemctl start meshagent
echo 'meshagent installed as systemd service.'
echo 'To start service: sudo systemctl start meshagent'
echo 'To stop service: sudo systemctl stop meshagent'
elif [ $starttype -eq 3 ]
then
# initd
wget $url/meshagents?script=2 {{{wgetoptionshttps}}}-O /etc/init.d/meshagent || curl {{{curloptionshttps}}}--output /etc/init.d/meshagent $url/meshagents?script=2
chmod +x /etc/init.d/meshagent
# creates symlinks for rc.d
update-rc.d meshagent defaults
service meshagent start
echo 'meshagent installed as init.d service.'
echo 'To start service: sudo service meshagent start'
echo 'To stop service: sudo service meshagent stop'
elif [ $starttype -eq 2 ]
then
# upstart
echo -e "start on runlevel [2345]\nstop on runlevel [016]\n\nrespawn\n\nchdir /usr/local/mesh\nexec /usr/local/mesh/meshagent\n\n" > /etc/init/meshagent.conf
initctl start meshagent
echo 'meshagent installed as upstart/init.d service.'
echo 'To start service: sudo initctl start meshagent'
echo 'To stop service: sudo initctl stop meshagent'
elif [ $starttype -eq 5 ]
then
# FreeBSD
wget $url/meshagents?script=5 {{{wgetoptionshttps}}}-O /usr/local/etc/rc.d/meshagent || curl {{{curloptionshttps}}}--output /usr/local/etc/rc.d/meshagent $url/meshagents?script=5
chmod +x /usr/local/etc/rc.d/meshagent
service meshagent start
echo 'meshagent installed as BSD service.'
echo 'To start service: sudo service meshagent start'
echo 'To stop service: sudo service meshagent stop'
else else
# unknown # Install the agent
echo "Unknown Service Platform Type. (ie: init, systemd, etc)" UpdateMshFile
echo "Installing as Pseudo Service (Mesh Daemon)" ./meshagent -fullinstall --copy-msh=1
/usr/local/mesh/meshagent -exec "require('service-manager').manager.installService({name: 'meshagent', servicePath: process.execPath, files: ['/usr/local/mesh/meshagent.msh']});process.exit();"
/usr/local/mesh_daemons/daemon start meshagent
echo 'To start service: /usr/local/mesh_daemons/daemon start meshagent'
echo 'To stop service: /usr/local/mesh_daemons/daemon stop meshagent'
fi fi
echo "Mesh agent started."
else else
echo "Unable to download mesh settings at: $url/meshsettings?id=$meshid." echo "Unable to download device group settings at: $url/meshsettings?id=$meshid."
fi fi
else else
echo "Unable to download mesh agent at: $url/meshagents?id=$machineid." echo "Unable to download agent at: $url/meshagents?id=$machineid."
fi fi
} }
UninstallAgent() {
# Uninstall agent
if [ -e "/usr/local" ]
then
installpath="/usr/local/mesh"
else
installpath="/usr/mesh"
fi
if [ $starttype -eq 1 ]
then
# systemd
systemctl disable meshagent
systemctl stop meshagent
rm -f /sbin/meshcmd /lib/systemd/system/meshagent.service
systemctl stop meshagentDiagnostic &> /dev/null
rm -f /lib/systemd/system/meshagentDiagnostic.service &> /dev/null
else
if [ $starttype -eq 3 ]; then
# initd
service meshagent stop
update-rc.d -f meshagent remove
rm -f /sbin/meshcmd /etc/init.d/meshagent
service meshagentDiagnostic stop &> /dev/null
rm -f /etc/init.d/meshagentDiagnostic &> /dev/null
elif [ $starttype -eq 2 ]; then
# upstart
initctl stop meshagent
rm -f /sbin/meshcmd
rm -f /etc/init/meshagent.conf
rm -f /etc/rc2.d/S20mesh /etc/rc3.d/S20mesh /etc/rc5.d/S20mesh
initctl stop meshagentDiagnostic &> /dev/null
rm -f /etc/init/meshagentDiagnostic.conf &> /dev/null
elif [ $starttype -eq 5 ]; then
# FreeBSD
service meshagent stop
service meshagentDiagnostic stop &> /dev/null
rm -f /usr/local/etc/rc.d/meshagent
rm -f /usr/local/etc/rc.d/meshagentDiagnostic &> /dev/null
fi
fi
if [ -e $installpath ]
then
rm -rf $installpath/*
rmdir $installpath
fi
rm -rf /usr/local/mesh_services/meshagentDiagnostic &> /dev/null
rm -f /etc/cron.d/meshagentDiagnostic_periodicStart &> /dev/null
echo "Agent uninstalled."
}
CheckStartupType CheckStartupType
starttype=$? starttype=$?
@ -287,19 +184,15 @@ if [ $currentuser == 'root' ]
then then
if [ $# -eq 0 ] if [ $# -eq 0 ]
then then
echo -e "This script will install or uninstall a mesh agent, usage:\n $0 [serverurl] [meshid] (machineid)\n $0 uninstall" echo -e "This script will install or uninstall a agent, usage:\n $0 [serverUrl] [deviceGroupId] (machineId)\n $0 uninstall [serverUrl] [deviceGroupId] (machineId)"
else else
if [ $# -eq 1 ] if [ $1 == 'uninstall' ] || [ $1 == 'UNINSTALL' ]
then then
if [ $1 == 'uninstall' ] || [ $1 == 'UNINSTALL' ] CheckInstallAgent 'uninstall' $2 $3 $4
then
UninstallAgent
fi
else else
UninstallAgent CheckInstallAgent 'install' $1 $2 $3
CheckInstallAgent $1 $2 $3
fi fi
fi fi
else else
echo "Must be root to install or uninstall mesh agent." echo "Must be root to install or uninstall the agent."
fi fi

File diff suppressed because it is too large Load Diff

View File

@ -3543,7 +3543,7 @@
// Construct the key command // Construct the key command
if (ks == -1) { deskCustomizeKeys(); return; } // Customize if (ks == -1) { deskCustomizeKeys(); return; } // Customize
if (ks == 0x0A002E) { desktop.m.sendcad(); return; } // CTRL-ALT-DEL if (ks == 0x0A002E) { desktop.m.sendcad(); return; } // CTRL-ALT-DEL
if ((desktop.contype == 1) && (ks == 0x100052)) { desktop.sendCtrlMsg('{"action":"lock"}'); return; } // Lock desktop //if ((desktop.contype == 1) && (ks == 0x10004C)) { desktop.sendCtrlMsg('{"action":"lock"}'); return; } // Lock desktop, WIN + L
var flags = (ks & 0xFF0000) >> 16, key = (ks & 0xFFFF), keyArray = [], keyArray2 = []; var flags = (ks & 0xFF0000) >> 16, key = (ks & 0xFFFF), keyArray = [], keyArray2 = [];
var amtTranslate = { var amtTranslate = {

View File

@ -4428,33 +4428,18 @@
var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port); var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
new QRCode(Q('agins_qrimage'), { text: 'mc://' + servername + portStr + domainUrlNoSlash + ',' + serverinfo.agentCertHash + ',' + meshid.split('/')[2], width: 180, height: 180, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.M }); new QRCode(Q('agins_qrimage'), { text: 'mc://' + servername + portStr + domainUrlNoSlash + ',' + serverinfo.agentCertHash + ',' + meshid.split('/')[2], width: 180, height: 180, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.M });
if (serverinfo.https == true) if ((features & 0x2000) == 0)
{ {
if ((features & 0x2000) == 0) Q('agins_linux_area').value = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
{ Q('agins_linux_area_un').value = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh uninstall uninstall uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
Q('agins_linux_area').value = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n'; //Q('agins_linux_area_un').value = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
Q('agins_linux_area_un').value = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
}
else
{
// Server asked that agent be installed to preferably not use a HTTP proxy.
Q('agins_linux_area').value = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
Q('agins_linux_area_un').value = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
}
} }
else else
{ {
if ((features & 0x2000) == 0) // Server asked that agent be installed to preferably not use a HTTP proxy.
{ Q('agins_linux_area').value = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
Q('agins_linux_area').value = '(wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" -O ./meshinstall.sh || wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n'; Q('agins_linux_area_un').value = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
Q('agins_linux_area_un').value = '(wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" -O ./meshinstall.sh || wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1" --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n'; //Q('agins_linux_area_un').value = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
}
else
{
// Server asked that agent be installed to preferably not use a HTTP proxy.
Q('agins_linux_area').value = 'wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
Q('agins_linux_area_un').value = 'wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + (urlargs.key?('&key=' + urlargs.key):'') + '" --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
}
} }
Q('aginsSelect').focus(); Q('aginsSelect').focus();
addAgentToMeshClick(); addAgentToMeshClick();
@ -7545,7 +7530,7 @@
// Construct the key command // Construct the key command
var ks = parseInt(Q('deskkeys').value); var ks = parseInt(Q('deskkeys').value);
if (ks == 0x0A002E) { desktop.m.sendcad(); return; } // CTRL-ALT-DEL if (ks == 0x0A002E) { desktop.m.sendcad(); return; } // CTRL-ALT-DEL
if ((desktop.contype == 1) && (ks == 0x100052)) { desktop.sendCtrlMsg('{"action":"lock"}'); return; } // Lock desktop //if ((desktop.contype == 1) && (ks == 0x10004C)) { desktop.sendCtrlMsg('{"action":"lock"}'); return; } // Lock desktop, WIN + L
var flags = (ks & 0xFF0000) >> 16, key = (ks & 0xFFFF), keyArray = [], keyArray2 = []; var flags = (ks & 0xFF0000) >> 16, key = (ks & 0xFFFF), keyArray = [], keyArray2 = [];
var amtTranslate = { var amtTranslate = {