Answer» Hello,
I would like to know how to perform a search that looks for the following Hex code in the file c:\test.exe and return the path of thsi file if it is found 58354f2150254041505b345c505a58353428505 e2937434329377d2445494341522d5354414e44 4152442d414e544956495255532d544553542d4 6494c452124482b482a
This code would be part of a larger program so I would help in vb.net. If anyone could point me to a tutorial where there is information on hat it would be very much appreciated.
Thank You
Al968Not sure the commands you will need to use, but I'd use a procedure like this.
1. Store the string to be found in a variable, and create a found variable whose VALUE is false. 2. Open the file as a text document. 3. Set a variable to TRACK the current character of the string we have found so far. I will call this track (no pun intended) 4. Whilst you have not reached the end of file... 4A. If the character you have just read is the same as the "track-th" character in the string to be found, increase track by one, else track becomes zero. 4b. If track equals the size of the string to be found (or probably the size -1) then set the found variable to true and break from the loop (unless you which to count the number of instances perhaps?). 5. Close the file. For completeness 6. Perform whatever instructions based upon the result of the found variable.
There are probably more efficent ways of doing this, but try to find if this works first and we can IMPROVE it later.
You probably can't find tutorials on this as tutorials only cover general aspects, or very popular tasks. This is rather a specific problem. Try reading tutorials on handling strings and file management. I haven't used vb.net in a long time so I can't give you any code sorry.
Good luck.Thanks for the PSEUDO Code, I too don't know the commands to do that but know very well like you do what the pseudo code would be. I'll look into strings and file management tutorials. Thanks Al968 P.S: Still looking for the code if you have an idea
|