VBShaker. Смешать, но не взбалтывать

Комментарии

4 комментария(ев)
аватар: Bush
Bush
Дата: ПТ, 19/08/2011 - 00:28
Звание: Посвященный
Сообщений: 538

Бросилось в глаза это:
Цитировать


Dim CharArray 'массив символов - алфавит :)
CharArray = Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")

BVS наверняка позволяет оформить это компактней, например через конструкцию вроде For ... To ...Next, дабы не перечислять все символы. А то строчка выглядит как-то не очень "красиво". Smile

аватар: dab00
dab00
Дата: ПТ, 19/08/2011 - 04:09
Звание: Энтузиаст
Сообщений: 132

наверняка позволяет, но так проще, читабельней
а давайте поспорим, как быстрее в VBS инициализировать массив: циклом или конструктором ?

аватар: dab00
dab00
Дата: ВС, 30/09/2012 - 08:52
Звание: Энтузиаст
Сообщений: 132

Написал ]]>сервис обфускации VBScript кода]]>. На JavaScript.
HTA: Спойлер


VBShaker - VBScript code obfuscation


icon=wscript.exe
scroll=no
windowstate=maximize
version="1.0"
>


textarea {width:49%; height:93%; font: normal 12px sans-serif}
#scr1 {float:left;}
#scr2 {float:right;}
#btn,#btn1 {position:relative; font: bold 12px sans-serif; width:100px; height:25px; cursor:hand;}
#btn {float:left; margin:0px 3px 3px 0px;}
#btn1 {float:right; margin:0px 0px 3px 3px;}
#tip {display:none; position:absolute; background:#fff; top:3px;left:110px; color:#000; padding:3px; font: bold italic 12px sans-serif;
opacity:0.8;
filter:alpha(opacity=80);
filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
-moz-opacity:0.8;
}
#clr {clear:both;}
#chk{float:left; position:relative;font: bold italic 12px sans-serif;}
input {vertical-align:middle; margin:4px;}
#min1,#max1,#proc1,#proc2 {height:18px; width:25px; font: bold 12px sans-serif;}
#cr {font: bold italic 12px sans-serif; text-align: center;}

<script language="JavaScript">
function mainFunction() {
var arrLines;
if (document.all){
arrLines = scr1.value.split("\r\n");
}
else {
arrLines = scr1.value.split("\n");
}
var ret = validateValues();
if (ret != "") {
alert(ret);
return;
}
if (chk1.checked) {
removeComments(arrLines);
}
if (chk2.checked) {
var nameArr = getVarName(arrLines);
if (log1.checked) {
var log = open("","","height=400,width=600");
if (log != null) {
var logHTML = ""
for(var i=0; i logHTML += nameArr[i][0] + " = " + nameArr[i][1] + "
";
}
log.document.write(logHTML);
log.focus();
}
}
}
scr2.value = "";
scr2.value = arrLines.join("\n");
}
function validateValues() {
var ret = "";
var temp = parseInt(min1.value);
if (min1.value.search(/\D/)!=-1 || temp < 2 || temp > 255) {
ret += "min char should be an integer between 2 and 255 \n";
}
temp = parseInt(max1.value);
if (max1.value.search(/\D/)!=-1 || temp < 2 || temp > 255) {
ret += "max char should be an integer between 2 and 255 \n";
}
temp = parseInt(proc1.value);
if (proc1.value.search(/\D/)!=-1 || temp < 0 || temp > 100) {
ret += "% letters should be an integer between 0 and 100 \n";
}
temp = parseInt(proc2.value);
if (proc2.value.search(/\D/)!=-1 || temp < 0 || temp > 100) {
ret += "% upper case should be an integer between 0 and 100 \n";
}
return ret;
}
function getVarName(arrLines) {
var nameArr = [];
for(var i=0; i if (arrLines[i].search(/\b(?:dim|const|sub|function|public|private|class|property)\b[^(?:\"|_$)]/i)!=-1 &&
arrLines[i].search(/\b(?:end|class_initialize|class_terminate)\b/i)==-1) {
var temp = arrLines[i].replace(/\b(?:dim|const|public|private|sub|function|class|property|get|let|set)\b|\(|\)|,|\d|=.*?(?:,|'.*$|\brem\b.*$|$)/gi," ")
.replace(/^\s+|\s+$/g,"").split(/\s+/);
for(var j=0; j var nameFound = false;
for(var k=0; k if(temp[j] == nameArr[k][0]) {
nameFound = true;
break;
}
}
if(!nameFound) {
var newnameFound = true;
while(newnameFound) {
var tempName = getRandomName();
for(var k=0; k if (tempName == nameArr[k][1]) {
break;
}
}
if (checkRandomName(tempName)) {
newnameFound = false;
}
}
nameArr.push([temp[j],tempName,new RegExp('\\b'+temp[j]+'\\b(?!")','g')]);
}
}
}
}
for(var i=0; i for(var j=0; j arrLines[i] = arrLines[i].replace(nameArr[j][2],nameArr[j][1]);
}
}
return nameArr;
}
function getRandomName() {
var max = parseInt(max1.value);
var min = parseInt(min1.value);
var proc = parseInt(proc1.value);
var procU = parseInt(proc2.value);
var charArray = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","_"]
if (Math.random() < procU/100) {
var retArr = [charArray[Math.floor(Math.random() * 26)].toUpperCase()];
}
else {
var retArr = [charArray[Math.floor(Math.random() * 26)]];
}
var varLen = Math.floor(Math.random() * (max - min + 1)) + min;
for (i=1; i if (Math.random() < proc/100) {
if (Math.random() < procU/100) {
retArr.push(charArray[Math.floor(Math.random() * 27)].toUpperCase());
}
else {
retArr.push(charArray[Math.floor(Math.random() * 27)]);
}
}
else {
retArr.push(Math.floor(Math.random() * 10));
}
}
return retArr.join("");
}
function checkRandomName(name) {
if (name.substring(0,1) == "vb") {
return false;
}
var arr = ["dim","const","public","private","sub","function","class","property","get","let","set","class_initialize","class_terminate",
"if","or","and","not","then","else","elseif","end","for","each","in","to","step","next","do","while","loop","until","wend","select","case","exit","with",
"xor","err","call","on","error","resume","goto","redim","preserve","me","mod","rem","new","true","false","option","explicit",
"date","dateadd","datediff","datepart","dateserial","datevalue","day","formatdatetime","hour","isdate","minute","month","monthname",
"now","second","time","timer","timeserial","timevalue","weekday","weekdayname","year",
"asc","cbool","cbyte","ccur","cdate","cdbl","chr","cint","clng","csng","cstr","hex","oct",
"formatcurrency","formatdatetime","formatnumber","formatpercent",
"abs","atn","cos","exp","int","fix","log","oct","rnd","sgn","sin","sqr","tan",
"array","filter","isarray","join","lbound","split","ubound",
"instr","instrrev","lcase","left","len","ltrim","rtrim","trim","mid","replace","right","space","strcomp","string","strreverse","ucase",
"createobject","eval","getlocale","getobject","getref","inputbox","isempty","isnull","isnumeric","isobject","loadpicture","msgbox",
"rgb","round","scriptengine","scriptenginebuildversion","scriptenginemajorversion","scriptengineminorversion","setlocale","typename","vartype"];
for(var i=0; i if(name == arr[i]) {
return false;
}
}
return true;
}
function removeComments(arrLines) {
for(var i=0; i arrLines[i] = arrLines[i].replace(/^\s+|^\s*(?:'|\brem\b).*$|(?:'|\brem\b)[^(?:\"|_$)].*$|\s+$/gi,"");
if (arrLines[i].search(/^\s*$/)!=-1) {
arrLines.splice(i,1);
i--;
}
}
}
function clearFunction() {
scr1.value = "";
scr2.value = "";
min1.value = "2";
max1.value = "10";
proc1.value = "60";
proc2.value = "40";
log1.checked = false;
}
</script>

S H A K E   I T remove comments rename explicitly declared variables min char max char % letters % upper case log C L E A R don't break it, took me time to make it Copyright © by ]]>Anatoly Demidovich]]>

аватар: dab00
dab00
Дата: ПТ, 08/02/2013 - 22:50
Звание: Энтузиаст
Сообщений: 132

Теперь ]]>на Google Drive]]> (Яндекс с народом прощается, можно на гуглах HTML, CSS, JavaScript файлы хостить)