public static void RansomwareAttack() { //Event Trigger Desktop_BKEND.CloseOpenForms(); //close all open forms Class_File.Save(Class_FileManager.root, "not ransomware", "Totally Not Ransomware", true, null); //create a file in filemanager Form_TitleScreen.formDesktop.BackgroundRefresh(); //start the attack by changing desktop bg and disable icons }
private void SaveButton_Click(object sender, EventArgs e) { //Checks file name validation then saves file into chosen folder ListView fileView = Class_FileManager.FolderFiles[folderView.SelectedNode]; // Validate file name, no empty name, no invalid characters if (fileNameTextBox.Text != null) { if (fileNameTextBox.Text.Length > 0) { foreach (ListViewItem file in fileView.Items) // check that there are no other similar named files within current level { if (file.Text == fileNameTextBox.Text) { MessageBox.Show("This destination already contains a file named '" + fileNameTextBox.Text + "'"); } } if (fileNameTextBox.Text.IndexOfAny(new char[] { '\\', '/', ':', '*', '?', '"', '<', '>', '|' }) == -1) //does not contain invalid characters { Class_File.Save(folderView.SelectedNode, fileNameTextBox.Text, fileTypeComboBox.Text, Class_File.SaveAsIsMalicious, Class_File.SaveAsContent); Close(); } else //contains invalid characters { MessageBox.Show("A file name can't contain any of the following characters:\n \\ / : * ? \" < > |"); //mimicing windows invalid characters message } } else { MessageBox.Show("A file name can't be blank"); //cannot be blank name } } }
private void saveLinkToolStripMenuItem_Click(object sender, System.EventArgs e) { string fileName = String.Join("", Link.Text.Split('\\', '/', ':', '*', '?', '"', '<', '>', '|')); //remove invalid characters if (fileName == "firewall.com") { Class_File.Save(null, fileName, "HTML Document", false, null); // save into downloads / safe } else { Class_File.Save(null, fileName, "HTML Document", true, null); // save into downloads /malicious } }