Search the Community
Showing results for tags 'c sharp'.
-
As some of you requested, I've added a class to decrypt passwords found in *.rdp files. To work with this class add the DLL to references, include the namespace in you're class "using DataProtection;" and use the two functions provided by DataProtectionWrapper: Encrypt(string) and Decrypt(string) The repository can be found here: hg clone https://bitbucket.org/rokill3r/rdppassworddecrypter DLL can be found here: DataProtection.dll using System; using System.Collections.Generic; using System.Linq; using System.Text; using DataProtection; namespace RdpPasswordDecrypter { class Program { static void Main(string[] args) { try { string password = "01000000D08C9DDF0115D1118C7A00C04FC297EB01000000B03D76F7FF29E741AC1991D9E850476500000000080000007000730077000000106600000001000020000000DA8BB4AC41DE92695BF32E8F756F6C7EA1A7D939EE98C99D79740DF7A5DD66B7000000000E8000000002000020000000C1CF8B672062B84AC36624E43D316383B6ADB08D026A9A1C5DF78162C04D421820000000D94E470B71E687C0A4DF24E2800983C7071AAC55B0122FCD8AD7F490F932899B4000000024356DC7D805EEF60CEEB2F3D0D9232CD488C0C2882950B7CE10810480E61997307B6C1DC95C263033178F4272458BA6CCAF8F84487F61677A5A291265582964"; Console.WriteLine("Decrypting ..."); Console.WriteLine("Password: " + DataProtectionWrapper.Decrypt(password)); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } } Log output: Decrypting ... Password: rstcenter.com Press any key to continue . . . Alien
-
This is a simple example using C# and AForge of how you can detect if ImageA is found in ImageB. AForge is a C# framework designed for developers and researchers in the fields of Computer Vision and Artificial Intelligence - image processing, neural networks, genetic algorithms, machine learning, robotics, etc. You can add it to you're project as a NuGet package or from their website AForge.NET :: Computer Vision, Artificial Intelligence, Robotics The code is very straight forward: - you load to images(source and template) - you create a ExhaustiveTemplateMatching from AForge - you store the found matches in a TemplateMatch System.Drawing.Bitmap sourceImage = (Bitmap)Bitmap.FromFile(SourceInput.Text); System.Drawing.Bitmap template = (Bitmap)Bitmap.FromFile(TempateInput.Text); // create template matching algorithm's instance // (set similarity threshold to 92.5%) ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0.921f); // find all matchings with specified above similarity TemplateMatch[] matchings = tm.ProcessImage(sourceImage, template); // highlight found matchings foreach (TemplateMatch m in matchings) MessageBox.Show(m.Rectangle.Location.ToString()); Working code can be found here: hg clone https://bitbucket.org/rokill3r/imageprocessing
-
This tutorial will explain the basics of generating and verifying of HWID's. First things first, "What the hell is a HWID??" Most of you already know this so I will keep it short. Ever since Windows XP Product Activation came around, when the OS is installed an unique ID is generated for the basic hardware components in the system. This ensures that a software will be bound to those unique ID, so it can't be moved/run on other machines. Of course there are methods to bypass this, but this is not the scope of this tutorial. Also to make it more "secure" we will be using the triple DES algorithm to crypt the generated CPU and HDD Id's. A short overview: The class will be called Hwid and will contain 2 properties(CpuId,HddId plain text), Generate, Verify and EncryptString methods. The Verify method takes 2 parameters: password(used for DES) and path. The path can be also an URL to a website hosting the file with the HWID's. The void Main() contains a simple console application to see how Hwid class works. The code is commented and self explanatory I would say. Source code: hg clone https://bitbucket.org/rokill3r/hwid Hwid class class Hwid { private string _cpuId = string.Empty; private string _hddId = string.Empty; public Hwid() { _cpuId = GetCpuId(); _hddId = GetHddId("C"); } /// <summary> /// Gets first CPU unique ID /// </summary> /// <returns></returns> private string GetCpuId() { ManagementClass cpuManager = new ManagementClass("win32_processor"); ManagementObjectCollection cpuCollection = cpuManager.GetInstances(); foreach (ManagementObject cpu in cpuCollection) { // Return first CPU Id return cpu.Properties["processorID"].Value.ToString(); } return string.Empty; } /// <summary> /// Gets the drives unique ID /// </summary> /// <param name="drive">Drive name(eg: C,D..)</param> /// <returns></returns> private string GetHddId(string drive) { ManagementObject dsk = new ManagementObject(@"win32_logicaldisk.deviceid=""" + drive + @":"""); dsk.Get(); return dsk["VolumeSerialNumber"].ToString(); } /// <summary> /// Encrypts the HWID using tripple DES algorithm /// </summary> /// <param name="Message">String to crypt</param> /// <param name="Passphrase">Password to use when crypting</param> /// <returns></returns> private string EncryptString(string Message, string Passphrase) ... /// <summary> /// Generates an encrypted HWID /// </summary> /// <param name="password">Password for the DES crypt algorith</param> /// <returns>Encrypted HWID</returns> public string Generate(string password) { return EncryptString(_cpuId + _hddId, password); } public string Generate(string password, string path) { try { string cryptedHwid = EncryptString(_cpuId + _hddId, password); // Write the crypted Hwid to file System.IO.StreamWriter file = new System.IO.StreamWriter(path); file.WriteLine(cryptedHwid); file.Close(); return cryptedHwid; } catch (Exception ex) { return ex.Message; } } /// <summary> /// Generates an encrypted HWID using the tripple DES algorithm /// </summary> /// <param name="password">Password for the DES crypt algorithm</param> /// <param name="path">Path where the HWID will be saved</param> /// <returns>Encrypted HWID</returns> public string Verify(string password, string path) { try { string db = string.Empty; if (path.Contains("http")) { WebClient webClient = new WebClient(); db = webClient.DownloadString(path); webClient.Dispose(); } else { System.IO.StreamReader file = new System.IO.StreamReader(path); db = file.ReadToEnd(); file.Close(); } if (db.Contains(EncryptString(_cpuId + _hddId, password))) return "HWID OK"; else return "HWID NOT FOUND"; } catch (Exception ex) { return ex.Message; } } void Main() static void Main(string[] args) { Hwid hwid = new Hwid(); // Change this to your desired password; string password = "secret1234"; if (args.Length < 1) PrintHelp(); else switch (args[0]) { case "--display": { Console.WriteLine("CPU ID: " + hwid.CpuId); Console.WriteLine("HDD ID: " + hwid.HddId); Console.WriteLine(); break; } case "--generate": { if (args.Length < 2) { Console.WriteLine("Path not specified!"); break; } string path = args[1]; Console.WriteLine("Encrypted HWID: " + hwid.Generate(password, path)); // If we don't specify the path it will only return the encrypted string //Console.WriteLine("Encrypted HWID: " + hwid.Generate(password)); break; } case "--verify": { if (args.Length < 2) { Console.WriteLine("Path not specified!"); break; } string path = args[1]; Console.WriteLine(hwid.Verify(password, path)); break; } default: { PrintHelp(); break; } } Console.WriteLine("Press any key to continue . . ."); Console.ReadLine(); }