|
| 1 | +Imports System.IO |
1 | 2 | Imports SunFlower.Abstractions |
| 3 | +Imports SunFlower.Abstractions.Types |
| 4 | +Imports SunFlower.Vb.Handlers |
| 5 | +Imports SunFlower.Vb.Headers |
| 6 | +Imports SunFlower.Vb.Services |
| 7 | +Imports SunFlower.Vb.Visualizers |
2 | 8 |
|
3 | | -<FlowerSeedContract(3, 0,0)> |
| 9 | +<FlowerSeedContract(4, 0,0)> |
4 | 10 | Public Class VisualBasicClassicSeed |
5 | 11 | Implements IFlowerSeed |
6 | 12 |
|
7 | | - Public ReadOnly Property Seed As String = "MSVBVM.dll 5.0+ Runtime walker" _ |
| 13 | + Public ReadOnly Property Seed As String = "Visual Basic 5.0+ Runtime walker" _ |
8 | 14 | Implements IFlowerSeed.Seed |
9 | 15 | Public ReadOnly Property Status As FlowerSeedStatus = |
10 | 16 | New FlowerSeedStatus() _ |
11 | 17 | Implements IFlowerSeed.Status |
12 | 18 |
|
13 | 19 | Public Function Main(path As String) As Integer Implements IFlowerSeed.Main |
| 20 | + Try |
| 21 | + Status.Results = New List(Of FlowerSeedResult)() |
| 22 | + Dim common = New CommonDumpingService(path) |
| 23 | + |
| 24 | + Dim vbParamsOption As Some = common.Dump() |
| 25 | + |
| 26 | + Dim vbParam As Vb5ServiceParameters = vbParamsOption.Data |
| 27 | + |
| 28 | + Using stream = New FileStream(path, FileMode.Open, FileAccess.Read) |
| 29 | + Using reader = New BinaryReader(stream) |
| 30 | + Dim entryPointManager = New VbEntryPointManager(reader, vbParam, vbParam.Sections) |
| 31 | + Dim headerResult As Some = entryPointManager.Vb5Header |
| 32 | + Dim header = headerResult.Cast(Of Vb5Header)() |
| 33 | + Dim proj = New Vb5ProjectParser( |
| 34 | + vbParam.ImageBase, |
| 35 | + header, |
| 36 | + reader, |
| 37 | + vbParam.Sections, |
| 38 | + entryPointManager.RuntimeHeaderOffset |
| 39 | + ) |
| 40 | + Dim projInfoOption = DirectCast(proj.ProjectInfo, Some) |
| 41 | + Dim projInfo = DirectCast(projInfoOption.Data, Vb5ProjectInfo) |
| 42 | + Dim objOption = DirectCast(proj.ObjectTable, Some) |
| 43 | + Dim objTable = DirectCast(objOption.Data, Vb5ObjectTable) |
| 44 | + |
| 45 | + Dim comParser = New Vb5ComRegistrationParser(vbParam.ImageBase, header, reader, vbParam.Sections) |
| 46 | + Dim comData = comParser.ParseComRegistrationData() |
| 47 | + |
| 48 | + Dim objParser = New Vb5ObjectsParser(reader, vbParam.Sections, vbParam.ImageBase) |
| 49 | + Dim obj = objParser.ParseObjects(objTable.ObjectsArrayPointer, objTable.TotalObjectsCount) |
| 50 | + |
| 51 | + Dim impParser = New Vb5ImportsParser(reader, vbParam.Sections, vbParam.ImageBase) |
| 52 | + Dim imps = impParser.ParseImports(projInfo.ExternalTablePointer, projInfo.ExternalTableCount) |
| 53 | + |
| 54 | + Dim headv = New Vb5HeaderVisualizer(header).ToRegion() |
| 55 | + Dim projv = New Vb5ProjectInfoVisualizer(projInfo).ToRegion() |
| 56 | + Dim imptv = New Vb5ExternalApiVisualizer(imps).ToRegion() |
| 57 | + Dim objsv = Vb5ObjectsIterator.Iterate(obj) |
| 58 | + |
| 59 | + Dim reg = New List(Of Region)() |
| 60 | + reg.Add(headv) |
| 61 | + reg.Add(projv) |
| 62 | + reg.Add(imptv) |
| 63 | + |
| 64 | + Status.Results.Add(New FlowerSeedResult(FlowerSeedEntryType.Regions) With { |
| 65 | + .BoxedResult = reg |
| 66 | + }) |
| 67 | + Status.Results.Add(New FlowerSeedResult(FlowerSeedEntryType.Regions) With { |
| 68 | + .BoxedResult = objsv |
| 69 | + }) |
| 70 | + Status.IsEnabled = True |
| 71 | + reader.Close() |
| 72 | + End Using |
| 73 | + End Using |
| 74 | + |
| 75 | + Catch e As Exception |
| 76 | + Status.LastError = e |
| 77 | + End Try |
14 | 78 |
|
15 | | - Return -1 |
| 79 | + Return 1 'https://t.me/overfriends/1087 |
16 | 80 | End Function |
17 | 81 | End Class |
0 commit comments