Files
2026-08-27 11:04:21 -06:00

96 lines
4.2 KiB
VB.net

Imports System.IO
Imports System.Text
Imports System.Windows.Forms
Imports ThreeCryptStub.Functions
Module Main
Dim _folderPath, _dataPath, _outputPath As String
Dim _key As Byte()
Sub Main()
Console.Title = "ThreeCrypt Decryptor"
Console.CursorVisible = False
Print("Welcome to ThreeCrypt Decryptor, this tool will decrypt any key and data combinations that were generated by ThreeCrypt.", ConsoleColor.Cyan)
Console.WriteLine("Press any key to continue...") : Console.ReadKey(True)
Console.Clear()
Print("Select the data file...", ConsoleColor.Cyan)
Using ofd As New OpenFileDialog()
ReDD:
ofd.Title = "Select the path to the data..."
ofd.Filter = "Data Files (*.dat)|*.dat|All Files (*.*)|*.*"
If ofd.ShowDialog() = DialogResult.OK And ofd.CheckPathExists Then
Print("Selected data path is: " + ofd.FileName, ConsoleColor.Cyan)
_dataPath = ofd.FileName
Else
Print("Path invalid, or no path included.")
Print("Press any key to continue...") : Console.ReadKey(True)
GoTo ReDD
End If
End Using
Console.WriteLine("Press any key to continue...") : Console.ReadKey(True)
Console.Clear()
Print("Select the key file...", ConsoleColor.Cyan)
Using ofd As New OpenFileDialog()
ReFD:
ofd.Title = "Select the path to the key..."
ofd.Filter = "Data Files (*.dat)|*.dat|All Files (*.*)|*.*"
If ofd.ShowDialog() = DialogResult.OK And ofd.CheckPathExists Then
Print("Selected key path is: " + ofd.FileName, ConsoleColor.Cyan)
_key = IO.File.ReadAllBytes(ofd.FileName)
Else
Print("Path invalid, or no path included.")
Print("Press any key to continue...") : Console.ReadKey(True)
GoTo ReFD
End If
End Using
Console.WriteLine("Press any key to continue...") : Console.ReadKey(True)
Console.Clear()
Print("Select the folder to output the files to...", ConsoleColor.Cyan)
Using fbd As New FolderBrowserDialog()
ReFB:
fbd.Description = "Select the path to output the files to..."
If fbd.ShowDialog() = DialogResult.OK And My.Computer.FileSystem.DirectoryExists(fbd.SelectedPath) Then
Print("Selected path is: " + fbd.SelectedPath, ConsoleColor.Cyan)
_folderPath = fbd.SelectedPath()
Else
Print("Path invalid, or no path included.")
Print("Press any key to continue...") : Console.ReadKey(True)
GoTo ReFB
End If
End Using
Print("Press any key to continue...") : Console.ReadKey(True)
Console.Clear()
Print("All preparations done, ready to begin decryption.", ConsoleColor.Cyan)
Print("Press any key to continue...") : Console.ReadKey(True)
Console.Clear()
Dim thisfile As String = Nothing
Dim stw As New Stopwatch
stw.Start()
Using srw As New StreamReader(_dataPath)
Dim thisline As String = Nothing
Dim sw As BinaryWriter
While (InlineAssignHelper(thisline, srw.ReadLine)) IsNot Nothing
If thisline.Contains(":") Then
thisfile = Path.Combine(_folderPath, Encoding.ASCII.GetString(Convert.FromBase64String(thisline.Replace(":", ""))))
Directory.CreateDirectory(New FileInfo(thisfile).Directory.FullName)
Print("Decrypting: " + New FileInfo(thisfile).Name, ConsoleColor.Green)
Try
sw.Close()
Catch ex As Exception
End Try
sw = New BinaryWriter(File.Create(thisfile))
Else
sw.Write(PerformDecrypt(thisline, _key))
End If
End While
End Using
stw.Stop()
Print("All files decrypted in: " + stw.Elapsed.ToString(), ConsoleColor.Cyan)
Print("Press any key to continue...") : Console.ReadKey(True)
End Sub
End Module