From 89d6eb62efb8baeae85256f18078bf22a648fd29 Mon Sep 17 00:00:00 2001 From: Lee Berg Date: Mon, 18 Jan 2021 17:05:36 -0600 Subject: [PATCH] Simplfication Update * Multiple Extenions Names * Removed all dependencies * Update UI to be more scary --- CashCat/CashCat.csproj | 8 +-- CashCat/ConfigurationFile.cs | 13 ++-- CashCat/FileSystemOperation.cs | 87 ++++++++++------------- CashCat/MainWindow.xaml | 27 ++++++-- CashCat/MainWindow.xaml.cs | 123 ++++++++++++++++++++++++++------- CashCat/RansomFiles.cs | 24 +++++++ CashCat/packages.config | 5 -- 7 files changed, 185 insertions(+), 102 deletions(-) create mode 100644 CashCat/RansomFiles.cs delete mode 100644 CashCat/packages.config diff --git a/CashCat/CashCat.csproj b/CashCat/CashCat.csproj index 4bf9a96..ba03918 100644 --- a/CashCat/CashCat.csproj +++ b/CashCat/CashCat.csproj @@ -60,12 +60,6 @@ Cjdowner-BCH.ico - - ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - - - ..\packages\RestSharp.106.11.4\lib\net452\RestSharp.dll - @@ -87,6 +81,7 @@ MSBuild:Compile Designer + MSBuild:Compile Designer @@ -120,7 +115,6 @@ ResXFileCodeGenerator Resources.Designer.cs - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/CashCat/ConfigurationFile.cs b/CashCat/ConfigurationFile.cs index 809a774..5b0e52e 100644 --- a/CashCat/ConfigurationFile.cs +++ b/CashCat/ConfigurationFile.cs @@ -1,5 +1,4 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -16,7 +15,9 @@ public partial class ConfigurationFile // Get Current Config file // return object - public ConfigurationFile ConfigurationFileSetup(string path) + //public ConfigurationFile ConfigurationFileSetup(string path) + + public void ConfigurationFileSetup(string path) { string jsonPath = path + "\\CashCat.json"; // read JSON directly from a file @@ -26,9 +27,9 @@ public ConfigurationFile ConfigurationFileSetup(string path) { string json = file.ReadToEnd(); - ConfigurationFile CurrentConfig = JsonConvert.DeserializeObject(json); + //ConfigurationFile CurrentConfig = JsonConvert.DeserializeObject(json); - return CurrentConfig; + //return CurrentConfig; } @@ -36,7 +37,7 @@ public ConfigurationFile ConfigurationFileSetup(string path) catch { Console.WriteLine("Error Loading JSON Config"); - return null; + //return null; } diff --git a/CashCat/FileSystemOperation.cs b/CashCat/FileSystemOperation.cs index ee55ee5..c379b85 100644 --- a/CashCat/FileSystemOperation.cs +++ b/CashCat/FileSystemOperation.cs @@ -15,6 +15,8 @@ public class FileSystemOperation /// /// + private RansomFiles RandomwareFileList = new RansomFiles(); + public void WriteLog(string logMessage) { @@ -78,6 +80,29 @@ public FileInfo[] GetLockyFileCount(string path) return Files; } + public List GetRansomedFileCount(string path) + { + DirectoryInfo d = new DirectoryInfo(path); + FileInfo[] Files = d.GetFiles("*"); + + List RansomwareFiles = new List(); + + int fileCount = 0; + + foreach (FileInfo file in Files) + { + + if(RandomwareFileList.fileExtensions.Contains(file.Extension)) + { + RansomwareFiles.Add(file); + } + + } + + return RansomwareFiles; + } + + public FileInfo[] GetTXTFileCount (string path) @@ -90,9 +115,13 @@ public FileInfo[] GetTXTFileCount (string path) public void LockTXTFile(FileInfo file) { string oldfilename = file.Name; - string newfilename = (file.Name).Replace(".txt", ".locky"); + + + string newExtension = RandomwareFileList.GetRandomFileExtension(); + + string newfilename = (file.Name).Replace(".txt", newExtension); string oldfileExtension = file.Extension; - string newfilefullname = (file.FullName).Replace(".txt", ".locky"); + string newfilefullname = (file.FullName).Replace(".txt", newExtension); try { @@ -104,37 +133,14 @@ public void LockTXTFile(FileInfo file) } } - public void LockTXTFiles(string path) - { - DirectoryInfo d = new DirectoryInfo(path); - FileInfo[] Files = d.GetFiles("*.txt"); //Getting Txt files - - foreach (FileInfo file in Files) - { - //Console.WriteLine(file.Name); - string oldfilename = file.Name; - string newfilename = (file.Name).Replace(".txt", ".locky"); - string oldfileExtension = file.Extension; - string newfilefullname = (file.FullName).Replace(".txt", ".locky"); - - try - { - System.IO.File.Move(file.Name, newfilename); - } - catch - { - //can't touch this - } - - - } - } - public void UnlockLockyFile(FileInfo file) + public void UnlockRansomwareFile(FileInfo file) { //Console.WriteLine(file.Name); - string newfilename = (file.Name).Replace(".locky", ".txt"); - string newfilefullname = (file.FullName).Replace(".locky", ".txt"); + + + string newfilename = (file.Name).Replace(file.Extension, ".txt"); + // string newfilefullname = (file.FullName).Replace(".locky", ".txt"); try { System.IO.File.Move(file.Name, newfilename); @@ -145,27 +151,6 @@ public void UnlockLockyFile(FileInfo file) } } - public void UnlockLockyFiles(string path) - { - DirectoryInfo d = new DirectoryInfo(path); - FileInfo[] Files = d.GetFiles("*.locky"); //Getting locky files - - foreach (FileInfo file in Files) - { - //Console.WriteLine(file.Name); - string newfilename = (file.Name).Replace(".locky", ".txt"); - string newfilefullname = (file.FullName).Replace(".locky", ".txt"); - try - { - System.IO.File.Move(file.Name, newfilename); - } - catch - { - //can't touch this - } - - } - } } } diff --git a/CashCat/MainWindow.xaml b/CashCat/MainWindow.xaml index 57a4dfa..5f3a2cc 100644 --- a/CashCat/MainWindow.xaml +++ b/CashCat/MainWindow.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:CashCat" mc:Ignorable="d" Title="CryptoLocker Simulator" Height="575" Width="820" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" ContentRendered="Window_ContentRendered"> - + @@ -18,28 +18,41 @@ - + -