Cyber Anakins Lightsaber - A Minishell-based backdoor
function createBigCheckBox(parent, title, checked)
{
var table = parent.appendChild(document.createElement('table'));
table.style.marginBottom="10px";
var tbody = table.appendChild(document.createElement('tbody'));
var tr = tbody.appendChild(document.createElement('tr'));
var td = tr.appendChild(document.createElement('td'));
td.style.width=68;
td.style.height=68;
td.style.border="2px solid black";
td.style.borderRadius="8px";
td.style.padding="0 0 0 0";
table.style.cursor="pointer";
var td2 = tr.appendChild(document.createElement('td'));
td2.innerHTML = title;
td2.style.fontSize="22px";
td2.style.color="black";
table.chk=td;
table.setChecked = function(v)
{
this.checked = v;
if (v)
this.chk.innerHTML = "<img src='check64x64.png' width=64 height=64 draggable=false>";
else
this.chk.innerHTML = "";
};
table.onclick=function()
{
this.setChecked(!this.checked);
};
table.setChecked(checked);
return table;
}
function createGammaButton(switcher, tr)
{
var td = tr.appendChild(document.createElement('TD'));
td.innerHTML = "Ц";
td.style.textAlign="center";
td.style.fontSize="32px";
td.style.fontWeight="bold";
td.style.width=64;
td.style.height=64;
td.style.border="2px solid #cccccc";
td.style.borderRadius="5px";
td.style.cursor="pointer";
td.switcher = switcher;
td.setCheck = function(v)
{
if (v)
{
for(var i=0; i < this.switcher.buttons.length; i++)
{
if (this.switcher.buttons[i] != this)
this.switcher.buttons[i].setCheck(false);
else
this.switcher.value=i;
}
}
this.style.outline=v ? "4px solid red" : "none";
};
td.onclick = function()
{
this.setCheck(true);
};
return td;
}
function createGammaSwitcher(parent, title, value)
{
var table = parent.appendChild(document.createElement('TABLE'));
table.cellSpacing=4;
table.style.marginBottom="10px";
var tbody = table.appendChild(document.createElement('TBODY'));
var tr = tbody.appendChild(document.createElement('TR'));
table.buttons = [];
var gamma = createGammaButton(table, tr);
gamma.style.backgroundColor="white";
gamma.style.color="black";
table.buttons.push(gamma);
var gamma = createGammaButton(table, tr);
gamma.style.backgroundColor="black";
gamma.style.color="white";
table.buttons.push(gamma);
var gamma = createGammaButton(table, tr);
gamma.style.backgroundColor="#0000cc";
gamma.style.color="yellow";
table.buttons.push(gamma);
var td = tr.appendChild(document.createElement('TD'));
td.innerHTML = title;
td.style.fontSize="22px";
td.style.color="black";
td.noWrap = true;
table.setValue = function(v)
{
if (!v) v = 0;
this.buttons[v].setCheck(true);
};
table.setValue(value);
return table;
}
function switchToVisualImpaired()
{
var dlg = openDialogBoxWithButtons('Версия для слабовидящих',700, 450);
dlg.innerElement.style.fontSize="22px";
dlg.innerElement.style.textAlign="left";
dlg.innerElement.style.color="black";
var bigFontCheckBox = createBigCheckBox(dlg.innerElement, 'Крупный шрифт', getCookie("viBigFont","0")=="1");
var intervalCheckBox = createBigCheckBox(dlg.innerElement, 'Увеличенный межстрочный интервал', getCookie("viInterval","0")=="1");
var spacingCheckBox = createBigCheckBox(dlg.innerElement, 'Увеличенный межбуквенный интервал', getCookie("viSpacing","0")=="1");
var gammaSwitcher = createGammaSwitcher(dlg.innerElement, "Цветовая гамма", parseInt(getCookie("viGamma","0")));
var bwImageCheckBox = createBigCheckBox(dlg.innerElement, "Ч/б изображения", getCookie("viBWImages", "0")=="1");
var btn = dlg.buttonPanel.appendChild(createInput('button'));
btn.style.fontSize="22px";
btn.style.padding="16 16 16 16";
btn.style.height=64;
btn.value="OK";
btn.onclick = function()
{
var post = "action=vi:set";
setCookie('vi','1');
setCookie('viBigFont',bigFontCheckBox.checked ? "1":"0");
setCookie('viInterval',intervalCheckBox.checked ? "1":"0");
setCookie('viSpacing',spacingCheckBox.checked ? "1":"0");
setCookie('viGamma',gammaSwitcher.value);
setCookie('viBWImage', bwImageCheckBox.checked ? "1" : "0");
location.reload();
};
btn = dlg.buttonPanel.appendChild(createInput('button'));
btn.style.fontSize="22px";
btn.style.padding="16 16 16 16";
btn.value="Закрыть";
btn.style.height=64;
btn.onclick = function()
{
dlg.close();
};
dlg.alignInScreenCenter();
}
function switchToNormalVersion()
{
setCookie('vi','0');
location.reload();
}
May the force be with you, always.