加密数字,加密BOOL Base64分行加密
//加密数字
if (checkBox2.Checked)
{
RegexOptions ops = RegexOptions.Multiline;
Regex r = new Regex(@" (\d{1,}) ", ops);
if (r.IsMatch(content))
{
content = r.Replace(content, "(int)\"$1" + CreateFlag()+"\"");
}
}
//加密BOOL
if (checkBox3.Checked)
{
content = content.Replace("true", "(bool)(int)\"" + RandomNum() + CreateFlag() + "\"");
Thread.Sleep(20);
content = content.Replace("TRUE", "(bool)(int)\"" + RandomNum() + CreateFlag() + "\"");
Thread.Sleep(20);
content = content.Replace("false", "(bool)(int)\"" + CreateFlag() + "\"");
Thread.Sleep(20);
content = content.Replace("FLASE", "(bool)(int)\"" + CreateFlag() + "\"");
Thread.Sleep(20);
}
//Base64加密
if (checkBox4.Checked)
{
content = content.Substring(5);//去掉 <?php
content = content.Remove(content.Length - 2);//去掉 ?>
//分行加密
int flag = 0;
while(0<(flag = content.IndexOf("\r")))
{
string temp = content.Substring(flag+1);
temp = temp.Replace("\n", "");
if (0 < temp.Length)
{
string lineStr = content.Substring(flag, temp.IndexOf("\r")).Replace("\r", "");
content = content.Substring(0, flag + 1).Replace("\r", "") + Base64_encode(lineStr + " ; /*" + CreateFlag() + "*/", true)
+ content.Substring(flag + temp.IndexOf("\r") + 1);
}
else
{
break;
}
}
//全局加密
content = "<?php //清如许工作室版权所有\r\n eval (base64_decode(\"" + Base64_encode(content,false) + "\"));?>";
}
/// <summary>
/// Base64加密程序
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public string Base64_encode(string str,bool eval)
{
byte[] bytes = Encoding.UTF8.GetBytes(str);
string temp = Convert.ToBase64String(bytes);
if (eval)
{
temp = "eval (base64_decode(\"" + temp + "\"));";
}
return temp;
}
- 上一篇:php 代码保护利器-清如许工作室代码保护器
- 下一篇:C#模拟键盘按键源码