Language: VB.NET
I need to search through a processes memory for specific strings, for example, "String1, String2, String3".
If the returned string which is read from the process contains any of the above strings stored in an array, the string should be nulled or if it cannot be nulled then it should be changed to something else (random characters).
For Example: If the read string is any of these below, clear the string from memory (going by above phrases in array):
String1
string1
123String1abc
sadsadas String1 asdasdasd
I don't think it should be too difficult considering there's a few half examples out there, so anyone who is fluent with memory modification would probably find it simple enough along with the examples that are already out there.
I don't need GUI, just code, preferably easy to use from within a class and well commented to give me an idea of what's happening.
If I haven't explained what exactly it is i'm looking for well enough, here are some additional details and a code example of what i'm looking for.
There's a program called Process Hacker, Process Hacker allows you to fully search through a processes memory for strings, which is what I want to do, I don't need the strings listed/shown like Process Hacker does, I just want to scan through all the returned strings to see if it matches any of the strings i'm looking for, and if it does, then to null(remove) the string preferably from memory, but overwriting the memory address to random characters is also okay as a last resort.
Screenshot of Process Hacker example:
Screenshot(Gyazo)
Code Example for usage of code
Code:
Public Class ProcessMemory
Public ListOfStrings() As String = {"String1", "String2", "String3"} 'Strings to check for
Public NulledStrings As Dictionary(Of String, String) 'Use for this stated below
Public Sub ScanAndEraseStrings()
Dim ArrayOfStringsFromCertainProcess() As String = {"ALL STRINGS IN SPECIFIED PROCESS"}
'The Process Memory Strings doesn't necessarily need to be stored in an array as once the string is nulled
'down below there's no further use for the past array of strings, only the current one that is currently being scanned.
For Each [String] In ArrayOfStringsFromCertainProcess 'Process Memory Strings
[String] = [String].ToLower 'Non case sensitive
For Each item In ListOfStrings 'Strings to check for
item = item.ToLower 'Non case sensitive
If [String].Contains(item) Then
'Remove the string from the process memory, then continue
'scanning to see if there's any other strings containing this phrase.
'I would also like to keep track of the strings which are
'removed from the process, however if it's coded
'similiar to this example that would be easily done,
'i'm just giving an axample of what I want in case
'it's coded differently.
Dim MemoryAddressOfStringToRemove As String = "Memory Address"
Dim StringInMemory As String = "Memory String"
NulledStrings.Add(MemoryAddressOfStringToRemove, StringInMemory)
End If
'Then move on to the next string in the list to scan for.
Next ' Finished searching for specific string
Next 'Finished searching through the processes memory
'Null everything that is no longer needed to free up memory.
'While keeping everything in "NulledStrings"
Array.Clear(ArrayOfStringsFromCertainProcess, 0, ArrayOfStringsFromCertainProcess.Length)
End Sub
End Class