1 Star 1 Fork 0

wkgd/MethodBox Living Account

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Main.cs 39.37 KB
一键复制 编辑 原始数据 按行查看 历史
MethodBox 提交于 2021-08-05 13:15 . 推送最新版本
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062
using Microsoft.Win32;
using NETCore.Encrypt;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Net.Http;
using System.Windows.Forms;
namespace MethodBox_Living_Account
{
public partial class Main : UIForm
{
public double zzTimes = 0,money; //DES秘钥解密
public string account, password, savedFileName, moneyUse;
public static string moneyPath,moneyTruth;
public static string tmpString,icode;
public bool moneyNotChanged = false, aux = false;
public static List<string> file = new List<string>();
public static List<string> accountVerify = new List<string>();
public Main(string account,string password)
{
InitializeComponent();
//获取数据
this.account = account;
this.password = password;
//读取日记文件
//读取日记文件
string D_Path = Application.StartupPath + "\\Files\\Diary";
getFileName(D_Path);
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
private void Main_FormClosing(object sender, FormClosingEventArgs e)
{
Environment.Exit(0);
}
private void uiSwitch1_ValueChanged(object sender, bool value)
{
//显示所有日记
if (uiSwitch1.Active == true)
{
for (int i = 0; i < file.Count; i++)
{
listBox1.Items.Add(file[i]);
}
}
else
{
listBox1.Items.Clear();
}
}
/// <summary>
/// 获取所有文件
/// </summary>
/// <param name="path">路径</param>
public static void getFileName(string path)
{
DirectoryInfo root = new DirectoryInfo(path);
foreach (FileInfo f in root.GetFiles())
{
//先分割以保证美观
string path_name = f.Name.Split('.')[0];
file.Add(path_name);
}
}
private void uiButton1_Click(object sender, EventArgs e)
{
//查看日记内容
try
{
int index = listBox1.SelectedIndex;
string fileName = Application.StartupPath + @"\Files\Diary\" + listBox1.Items[index].ToString() + ".txt";
textBox1.Text = listBox1.Items[index].ToString();
savedFileName = fileName;
StreamReader sr = new StreamReader(fileName);
string text = sr.ReadToEnd();
//解密文本
string showText = DecryptByDes(text);
sr.Close();
//显示
richTextBox1.Text = showText;
}
catch
{
//找不到ListBox所引用的实例对象
MessageBox.Show("请先选中您要查看的内容!", "找不到对象", MessageBoxButtons.OK, MessageBoxIcon.Error); ;
}
}
private void uiButton3_Click(object sender, EventArgs e)
{
richTextBox1.Text = string.Empty;
}
private void uiButton2_Click(object sender, EventArgs e)
{
if (aux || listBox1.Items.Count <= 5)
{
try
{
StreamWriter sw = new StreamWriter(Application.StartupPath + @"\Files\Diary\" + textBox1.Text + ".txt");
//加密日记内容
string saved = EncryptByDes(richTextBox1.Text);
//写出
sw.Write(saved);
sw.Close();
UIMessageBox.ShowSuccess("保存成功!");
file.Clear();
string D_Path = Application.StartupPath + "\\Files\\Diary";
getFileName(D_Path);
//更新文章
if (uiSwitch1.Active == true)
{
uiSwitch1.Active = false;
uiSwitch1.Active = true;
}
}
catch (Exception ex)
{
MessageBox.Show("创建失败,可能您的文件名含有非法字符!\n具体错误原因:\n" + ex.Message ,"错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("未激活用户日记上限为5篇!","需要激活",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "食物";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "生活";
}
private void uiGroupBox1_Click(object sender, EventArgs e)
{
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "娱乐";
}
private void uiButton5_Click(object sender, EventArgs e)
{
try
{
int money = Convert.ToInt32(textBox2.Text);
if (money < 10)
{
listBox2.Items.Add(moneyUse + " " + money.ToString());
}
else if (money < 100 && money >= 10)
{
listBox2.Items.Add(moneyUse + " " + money.ToString());
}
else if (money < 1000 && money >= 100)
{
listBox2.Items.Add(moneyUse + " " + money.ToString());
}
else if (money < 10000 && money >= 1000)
{
listBox2.Items.Add(moneyUse + " " + money.ToString());
}
else
{
MessageBox.Show("对不起,不支持如此高昂的消费喔`", "可以支持,但是数字太大了。");
}
}
catch
{
MessageBox.Show("输入数据不合法!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "汇款";
}
private void radioButton6_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "福利";
}
private void radioButton7_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "其它";
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
moneyUse = "工作";
}
private void uiButton6_Click(object sender, EventArgs e)
{
string willSaveText = "用途 支出金额" + listBox2.Text;
//进行分割时间
string local = Application.StartupPath;
string date = System.DateTime.Today.ToString();
string now = date.Split(' ')[0].Split('/')[0] + "年" + date.Split(' ')[0].Split('/')[1] + "月" + date.Split(' ')[0].Split('/')[2] + "日";
StreamWriter sw = new StreamWriter(local + @"\" + now + "消费记录.txt");
sw.Write(willSaveText);
sw.Flush();
for (int i = 0; i < listBox2.Items.Count; i++)
{
sw.Write(listBox2.Items[i].ToString() + "\n");
//把缓冲区写入基础流,虽然我也不知道为什么要这么干^_^...
sw.Flush();
}
sw.Close();
MessageBox.Show("已经存储至" + local + @"\" + now + "消费记录.txt", "ToysWorld", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 3;
if (!aux)
{
MessageBox.Show("请先激活软件再使用此功能!", "需要激活", MessageBoxButtons.OK, MessageBoxIcon.Warning);
tabControl1.SelectedIndex = 0;
}
}
private void uiButton7_Click(object sender, EventArgs e)
{
checkedListBox1.Items.Add(uiTextBox1.Text);
}
private void uiButton8_Click(object sender, EventArgs e)
{
try
{
checkedListBox1.Items.RemoveAt(checkedListBox1.SelectedIndex);
}
catch (Exception)
{
MessageBox.Show("请先选中一个待办项!","找不带对象",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void uiButton9_Click(object sender, EventArgs e)
{
//进行分割时间
string local = Application.StartupPath;
string date = System.DateTime.Today.ToString();
string now = date.Split(' ')[0].Split('/')[0] + "年" + date.Split(' ')[0].Split('/')[1] + "月" + date.Split(' ')[0].Split('/')[2] + "日";
StreamWriter sw = new StreamWriter(local + @"\" + now + "TODO.txt");
sw.Flush();
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
sw.Write(checkedListBox1.Items[i].ToString() + "\n");
//把缓冲区写入基础流,虽然我也不知道为什么要这么干^_^...
sw.Flush();
}
sw.Close();
MessageBox.Show("已经存储至" + local + @"\" + now + "TODO.txt", "ToysWorld", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void uiSwitch2_ValueChanged(object sender, bool value)
{
//打开则显示
if (uiSwitch2.Active == true)
{
//读取文件
StreamReader sr = new StreamReader(Application.StartupPath + @"\Files\account.txt");
string temp = sr.ReadToEnd();
sr.Close();
string[] accounts = temp.Split(';');
string tmpString;
int i = 0;
foreach (var item in accounts)
{
i++;
if (i == 1)
{
Main.tmpString += "网站名:" + item;
}
else if (i == 2)
{
Main.tmpString += " 用户名:" + item;
}
else if (i == 3)
{
Main.tmpString += " 密码:" + item;
}
}
uiListBox1.Items.Add(Main.tmpString);
//清空字符串
Main.tmpString = "";
}
else
{
//Clear items which in uilistbox1
uiListBox1.Items.Clear();
}
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 2;
}
private void toolStripButton5_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 5;
if (!aux)
{
MessageBox.Show("请先激活软件再使用此功能!", "需要激活", MessageBoxButtons.OK, MessageBoxIcon.Warning);
tabControl1.SelectedIndex = 0;
}
}
private void uiButton10_Click(object sender, EventArgs e)
{
uiListBox1.Items.Add("网站名:" + textBox3.Text + " 用户名" + textBox4.Text + " 密码" + textBox5.Text);
StreamWriter sw = new StreamWriter(Application.StartupPath + @"\Files\account.txt");
sw.Write(textBox3.Text + ";" + textBox4.Text + ";" + textBox5.Text);
if (uiSwitch2.Active == true)
{
uiSwitch2.Active = false;
uiSwitch2.Active = true;
}
else
{
//Do Nothing
}
sw.Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
uiAnalogMeter1.Value += 1;
}
private void uiAnalogMeter1_Click(object sender, EventArgs e)
{
}
private void uiButton11_Click(object sender, EventArgs e)
{
uiTextBox2.ReadOnly = true;
timer1.Enabled = true;
timer2.Enabled = true;
timer4.Enabled = true;
}
private void uiButton12_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
uiAnalogMeter1.Value = 0;
timer2.Enabled = false;
timer4.Enabled = false;
if (uiAnalogMeter1.Value >= 20 && uiAnalogMeter1.Value < 30)
{
MessageBox.Show("很遗憾,专注失败。但仍获得了" + uiTextBox2.Text + "枚金币。");
uiLedDisplay1.Text = "00000";
zzTimes += uiAnalogMeter1.Value;
//增加金币
double nowMoney = money + Convert.ToDouble(uiTextBox2.Text);
//加密金币
string nowMoneyEncrypt = EncryptByDes(nowMoney.ToString());
//写出
StreamWriter sw = new StreamWriter(Application.StartupPath + "\\Files\\money.txt");
sw.Write(nowMoneyEncrypt);
sw.Close();
}
else if (uiAnalogMeter1.Value <= 20)
{
MessageBox.Show("很遗憾,专注失败。");
uiLedDisplay1.Text = "00000";
zzTimes += uiAnalogMeter1.Value;
}
else
{
MessageBox.Show("恭喜您,专注成功。获得了" + uiTextBox2.Text + "枚金币。");
uiLedDisplay1.Text = "00000";
zzTimes += uiAnalogMeter1.Value;
//增加金币
double nowMoney = money + Convert.ToDouble(uiTextBox2.Text);
//加密金币
string nowMoneyEncrypt = EncryptByDes(nowMoney.ToString());
//写出
StreamWriter sw = new StreamWriter(Application.StartupPath + "\\Files\\money.txt");
sw.Write(nowMoneyEncrypt);
sw.Close();
}
}
private void timer2_Tick(object sender, EventArgs e)
{
if (uiAnalogMeter1.Value >= 20)
{
double temp = Convert.ToDouble(uiTextBox2.Text);
temp += 0.2;
uiTextBox2.Text = temp.ToString();
}
if (uiAnalogMeter1.Value >= 30)
{
timer1.Enabled = false;
uiLabel7.Text = "恭喜您,完成专注,获得金币" + uiTextBox2.Text + "枚。请点击\"结束专注\"结算奖励。";
timer2.Enabled = false;
}
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 4;
if (!aux)
{
MessageBox.Show("请先激活软件再使用此功能!", "需要激活", MessageBoxButtons.OK, MessageBoxIcon.Warning);
tabControl1.SelectedIndex = 0;
}
}
private void toolStripButton6_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 6;
if (!aux)
{
MessageBox.Show("请先激活软件再使用此功能!", "需要激活", MessageBoxButtons.OK, MessageBoxIcon.Warning);
tabControl1.SelectedIndex = 0;
}
}
private void uiButton13_Click(object sender, EventArgs e)
{
uiListBox2.Items.Clear();
uiListBox2.Items.Add("准备解密并导出数据...");
uiListBox2.Items.Add("验证用户名: [" + uiTextBox3.Text + "]...");
//读取文件
StreamReader sr = new StreamReader(Application.StartupPath + @"\Temp\local.txt");
for (int i = 0; i < 2; i++)
{
string temp = sr.ReadLine();
accountVerify.Add(temp);
}
sr.Close();
//解密数据
accountVerify[0] = Main.DecryptByDes(accountVerify[0]);
accountVerify[1] = Main.DecryptByDes(accountVerify[1]);
if (accountVerify[0] == uiTextBox3.Text)
{
uiListBox2.Items.Add("验证用户名: [" + uiTextBox3.Text + "] 存在且正确,验证密码...");
//密码正确
if (accountVerify[1] == uiTextBox4.Text)
{
uiListBox2.Items.Add("验证密码: [" + uiTextBox4.Text + "] 存在且正确,注入DES解密秘钥...");
if ((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "DES", "") == uiTextBox5.Text)
{
try
{
uiListBox2.Items.Add("成功注入DES解密秘钥 [" + uiTextBox5.Text.Substring(0, 35) + "...] !开始解密秘钥...");
}
catch { uiListBox2.Items.Add("Error:秘钥不能为空!"); }
uiListBox2.Items.Add("DES解密秘钥 [" + uiTextBox5.Text.ToString().Substring(0, 20) + "...] 准确无误并注入成功!");
//生成文件夹
try
{
System.IO.Directory.CreateDirectory(@"C:\users\administrator\desktop\Files");
}
catch
{
MessageBox.Show("不支持使用开发者功能!可以上传到叶子云盘。");
return;
}
uiListBox2.Items.Add(@"创建目录 C: \users\administrator\desktop\Files");
//遍历日记
foreach (var item in file)
{
//拷贝文件
File.Copy(Application.StartupPath + @"\Files\Diary\" + item + ".txt", @"C:\users\administrator\desktop\Files\" + item + ".txt");
uiListBox2.Items.Add("将 " + item + ".txt" + " 复制至 " + @"C:\users\administrator\desktop\Files\" + item + ".txt");
//解密桌面文件
StreamReader se = new StreamReader(@"C:\users\administrator\desktop\Files\" + item + ".txt");
string dkey = DeCode.DecodeKey(uiTextBox5.Text);
string stringa = se.ReadToEnd();
string temp = EncryptProvider.DESDecrypt(stringa,dkey);
se.Close();
StreamWriter sv = new StreamWriter(@"C:\users\administrator\desktop\Files\" + item + ".txt");
sv.Write(temp);
sv.Close();
uiListBox2.Items.Add("解密文件 " + @"C:\users\administrator\desktop\Files\" + item + ".txt");
}
//处理用户信息
File.Copy(Application.StartupPath + @"\Temp\local" + ".txt", @"C:\users\administrator\desktop\Files\UserInfo" + ".txt");
uiListBox2.Items.Add("获取文件 " + Application.StartupPath + @"\Files\Temp\local" + ".txt ...");
string dkeyii = DeCode.DecodeKey(uiTextBox5.Text);
uiListBox2.Items.Add("解密解密秘钥,得 [" + dkeyii.Substring(0,10) + "...] ...");
StreamReader srii = new StreamReader(@"C:\users\administrator\desktop\Files\UserInfo" + ".txt");
List<string> alist = new List<string>();
for (int i = 0; i < 2; i++)
{
alist.Add(srii.ReadLine());
//解密
string temp = alist[i];
alist[i] = EncryptProvider.DESDecrypt(alist[i], DeCode.DecodeKey(uiTextBox5.Text));
//提示回显
uiListBox2.Items.Add("解密 [" + temp + "] ,得 [" + alist[i] + "] ...");
string AES = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "AES", "");
string tempT = alist[i];
alist[i] = EncryptProvider.AESEncrypt(alist[i], AES);
uiListBox2.Items.Add("对明文 [" + tempT + "] 行AES加密,得 [" + alist[i] + "] ...");
}
srii.Close();
StreamWriter sw = new StreamWriter(@"C:\users\administrator\desktop\Files\UserInfo" + ".txt");
sw.Write(alist[0] + "\n" + alist[1]);
uiListBox2.Items.Add("写入文件:" + @"C:\users\administrator\desktop\Files\UserInfo" + ".txt");
sw.Close();
}
else
{
try
{
uiListBox2.Items.Add("Error:DES解密秘钥 [" + uiTextBox5.Text.ToString().Substring(0, 35) + "...] 有误,请检查确认。");
}
catch { uiListBox2.Items.Add("Error:秘钥位数不足!"); }
}
}
else
{
uiListBox2.Items.Add("Error:密码 [" + uiTextBox4.Text + "] 不适用于 [" + uiTextBox3.Text + "] 这个用户!");
}
}
else
{
uiListBox2.Items.Add("Error:不存在用户名[" + uiTextBox3.Text + "]!");
}
}
private void tabPage1_Click(object sender, EventArgs e)
{
}
private void toolStripButton7_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 7;
}
private void button1_Click(object sender, EventArgs e)
{
Tools.RandomItem ri = new Tools.RandomItem();
ri.Show();
}
private void button2_Click(object sender, EventArgs e)
{
Tools.MessageBox mb = new Tools.MessageBox();
mb.Show();
}
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("此功能仅为提醒他人所使用,不得做损害他人利益的事情,若有则由您承担全部责任。","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
System.Diagnostics.Process.Start(Application.StartupPath + @"\Annex\iMTP.exe");
}
private void button4_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(Application.StartupPath + @"\Annex\AutMsCk.exe");
}
private void button6_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"C:\Windows\System32\Magnify.exe");
}
private void button5_Click(object sender, EventArgs e)
{
MessageBox.Show("您操作系统不支持该操作");
//System.Diagnostics.Process.Start(@"C:\Windows\System32\SnippingTool.exe");
}
private void button7_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(Application.StartupPath + "\\Card_Live.exe");
}
private void button8_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(Application.StartupPath + "\\BatEditor.exe");
}
private void button9_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void toolStripButton8_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 8;
}
private void timer3_Tick(object sender, EventArgs e)
{
}
private void uiButton14_Click(object sender, EventArgs e)
{
}
private void toolStripButton9_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 9;
}
private void toolStripButton10_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 10;
}
private void uiButton16_Click(object sender, EventArgs e)
{
if (uiRichTextBox1.Text == "")
{
//解密
try
{
uiRichTextBox1.Text = EncryptProvider.AESDecrypt(uiRichTextBox2.Text, uiTextBox6.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message , "秘钥不合法",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
else if (uiRichTextBox2.Text == "")
{
//加密
if (uiTextBox6.Text == string.Empty)
{
var key = EncryptProvider.CreateAesKey();
uiTextBox6.Text = key.Key;
}
try
{
uiRichTextBox2.Text = EncryptProvider.AESEncrypt(uiRichTextBox1.Text, uiTextBox6.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n如没有合适的秘钥,请留空,我们会帮您生成秘钥。" , "秘钥不合法",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
private void toolStripButton11_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 11;
}
private void uiButton15_Click(object sender, EventArgs e)
{
MessageBox.Show("预计在1.3.0版本更新...");
}
private void timer4_Tick(object sender, EventArgs e)
{
int a = Convert.ToInt32(uiLedDisplay1.Text);
a += 7;
uiLedDisplay1.Text = a.ToString();
}
private void toolStripButton12_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 12;
}
private void tabPage15_Click(object sender, EventArgs e)
{
}
private void uiButton17_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void uiButton18_Click(object sender, EventArgs e)
{
Logout lg = new Logout();
lg.Show();
}
private void uiButton19_Click(object sender, EventArgs e)
{
Modify mf = new Modify();
mf.Show();
}
private void toolStripButton13_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 13;
}
private void Code_Click(object sender, EventArgs e)
{
}
private void uiButton4_Click(object sender, EventArgs e)
{
try
{
StreamWriter sw = new StreamWriter(savedFileName);
//加密日记内容
string saved = EncryptByDes(richTextBox1.Text);
//存储
sw.Write(saved);
sw.Flush();
sw.Close();
toolTip1.Show("保存成功!", richTextBox1, 3000);
}
catch
{
MessageBox.Show("保存的作用是修改旧的文章哦,保存新文章请使用新建。","未将对象作用于对象的实例");
}
}
private void tabPage6_Click(object sender, EventArgs e)
{
}
public async System.Threading.Tasks.Task<string> tnsAsync(string g)
{
string resa = await Translate.EnglishAsync(g);
return resa;
}
private async void Main_Load(object sender, EventArgs e)
{
//检查自身是否被调试
string exe = CheckTest.GetCheckName();
if (exe != "explorer" && exe != "devenv") //给 Visual Studio 一条后路
{
//检查到被调试 开始执行灵异行为
CheckTest.doSth(Application.StartupPath);
//阻止执行正常进程
return;
}
//阻止修改用户协议
textBox11.ReadOnly = true;
//检查是否被拉黑
string arg = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "IntSize", "0");
if (arg == "25532")
{
MessageBox.Show("您的计算机已被加入黑名单!", "Highest operation permission Reject",MessageBoxButtons.OK,MessageBoxIcon.Error);
Environment.Exit(-13);
}
else if (arg == "44202")
{
toolStripButton1.Visible = toolStripButton2.Visible = toolStripButton3.Visible = toolStripButton4.Visible = false;
toolStripButton5.Visible = toolStripButton6.Visible = toolStripButton7.Visible = toolStripButton8.Visible = false;
toolStripButton9.Visible = toolStripButton10.Visible = toolStripButton11.Visible = toolStripButton12.Visible = false;
tabControl1.Visible = false;
//抓包
//获取数据
List<string> infos = Crash.BlackListCrash.getUserInfo();
//解析数据
string res = Crash.BlackListCrash.HandleString(infos);
//当场崩溃
Frm_Crash fc = new Frm_Crash(res);
fc.Show();
Hide();
return;
}
//检查更新
List<string> update = new List<string>();
try
{
update = UpDate.getUpdate(1.24);
if (update.Count != 1)
{
MessageBox.Show("发现新的更新。\n版本号为:" + update[0] + "\n下载地址:" + update[2], "请下载更新", MessageBoxButtons.OK, MessageBoxIcon.Information);
System.Diagnostics.Process.Start(update[2]);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "无网络!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
//检查是否激活软件
if ((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "IntSize", "Err") == "4")
{
aux = true;
}
//检查激活状态
/*
* 对于几乎无解的反盗版系统的设想
* 利用一个非常难以破解的DES加密
* 请求验证时进行解密
* 其实如果传到那边去解密更好
* 不过叶子应该不会配合做这么麻烦的事
*/
//反 盗 版 系 统
/*
* 该代码接收注册表内的值
* 并向服务器发送
* 获取返回数据
*/
try
{
HttpClient client = new HttpClient();
string license = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "LaCode", "HACKER");
icode = DESEncryption.DecryptByDesKey(license, DeCode.DecodeKey((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "DES", "Hacker")));
var values = new Dictionary<string, string>
{
{ "code", icode}, //解密
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://120.27.239.120:8505/jivt/VerifyCode", content);
var responseString = await response.Content.ReadAsStringAsync();
string code = responseString.Split(':')[1].Split(',')[0];
/*
* 该代码接收一个code值
* 并判断注册情况
*/
string temp = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "IntSize", "0");
if (code != " 403" && temp == "4")
{
//恶意破解
MessageBox.Show("您侵犯了MethodBox Living Account的许可证,这是不被允许的。\n程序将立即退出。\n终止代码:REGISTRY_CHANGED", "MethodBox 许可证侵犯", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(12);
}
else
{
Console.WriteLine("Hello User!");
}
}
catch
{
MessageBox.Show("无网络!", "无网络",MessageBoxButtons.OK,MessageBoxIcon.Error);
aux = false;
}
//检测是否通过复制日记进行多次使用
if (file.Count > 6 && ! aux)
{
MessageBox.Show("您侵犯了MethodBox Living Account的许可证,这是不被允许的。\n程序将立即退出。\n终止代码:FILE_BE_COPIED", "MethodBox 许可证侵犯", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(12);
}
//检测是否生成加密秘钥
if ((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "DES", "None") == "None")
{
var desKey = EncryptProvider.CreateDesKey(); //创建DES秘钥
}
//不允许使用初始账户与密码
if (account == "aaa" || password == "aaa")
{
//向用户展示DES-KEY
if ((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "Show", "False") == "False")
{
//获取
string desKey = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "DES", "");
// 显 示 秘 钥
MessageBox.Show("您的DES-KEY是:\n" + desKey + "\n请妥善保管此秘钥,如需要解密请使用这串秘钥,如果被别人取得则有数据泄露的可能性。\n您将再也不会看到此秘钥了。","DES-KEY SHOW",MessageBoxButtons.OK,MessageBoxIcon.Warning);
//关闭以后的显示
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "Show", "True");
string res = DeCode.DecodeKey(desKey);
//加密一时爽 解密火葬场 我裂开来
}
else
{
//Do Nothing
}
UIMessageBox.ShowInfo("为保障安全,请先修改账户与密码!");
Modify mf = new Modify();
mf.Show();
this.Dispose();
}
else
{
label5.Text = "你好," + account + ",今天又是元气满满的一天呢。";
}
//隐藏TabControl选择卡
this.tabControl1.Region = new Region(new RectangleF(this.tabPage1.Left, this.tabPage1.Top, this.tabPage1.Width, this.tabPage1.Height));
//向Money.txt中写出加密后的0
StreamReader sr = new StreamReader(Application.StartupPath + "\\Files\\Money.txt");
string testTemp = sr.ReadToEnd();
if (testTemp == "0")
{
sr.Close();
StreamWriter sw = new StreamWriter(Application.StartupPath + "\\Files\\Money.txt");
sw.Write(EncryptByDes("0"));
sw.Flush();
sw.Close();
}
else
{
//关闭上下文管理器
sr.Close();
}
//读取现有金钱
StreamReader moneyInput = new StreamReader(Application.StartupPath + "\\Files\\Money.txt");
string moneyPath = moneyInput.ReadToEnd();
string moneyTruth = DecryptByDes(moneyPath);
moneyTruth = DecryptByDes(moneyPath);
money = Convert.ToDouble(moneyTruth);
uiLabel10.Text = moneyTruth; //显示金钱
//关闭上下文管理器
moneyInput.Close();
//用户是否篡改金钱?
//思路:如果被篡改为数字,则为篡改
//尝试强制转换
try
{
int testChanged = Convert.ToInt32(moneyPath);
}
//非处理
catch
{
//用户没有篡改
moneyNotChanged = true;
}
if (!moneyNotChanged && moneyPath != "0")
{
//警告用户 并重置金钱为0
Warning.MoneyChangedWarning Wmcw = new Warning.MoneyChangedWarning();
Wmcw.Show();
//this.Hide();
}
//加载许可证
if ((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "IntSize", "0") == "4")
{
//不需要加深判断了
uid.Text = icode.Substring(8, 7);
unm.Text = account;
Code.Text = $"注册码:{icode}";
uiLabel41.Text = "许可证:您有完全使用此软件的权利。";
}
}
/// <summary>
/// 使用.Net Core中的加密类进行加密
/// </summary>
/// <param name="srcString">预加密文本</param>
/// <returns></returns>
public static string EncryptByDes(string srcString)
{
string desKey = DeCode.DecodeKey((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "DES", "None"));
return EncryptProvider.DESEncrypt(srcString, desKey);
}
/// <summary>
/// 使用.Net Core中的加密类进行解密
/// </summary>
/// <param name="encryptedStr">预解密文本</param>
/// <returns></returns>
public static string DecryptByDes(string encryptedStr) {
string desKey = DeCode.DecodeKey((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\METHODBOX", "DES", "None")); //解码
try
{
return EncryptProvider.DESDecrypt(encryptedStr, desKey);
}
catch
{
//初始账户
return encryptedStr;
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/wkgd/method-box-living-account.git
git@gitee.com:wkgd/method-box-living-account.git
wkgd
method-box-living-account
MethodBox Living Account
master

搜索帮助