@MaxAdmin The other respondents are correct, this is not an efficient use of IEM/BigFix, but it can be done with minimal pain. What follows is basically what @aram suggested. Iâm assuming there wonât be too many instances of âsystem.iniâ on each endpoint and they wonât be very large, so generating the Hash wonât take much computational effort, just some disk I/O.
Youâre going to need to use a combination of a Task and an Analysis and an external utility to perform this. If you could use the SHA1 hash, you wouldnât need the external utility.
You need a utility to generate the MD5 hash values. If you donât already have one I recommend the FCIV.exe utility. It should fit the bill nicely. You can extract the .EXE file from the file available from the URL below and place it where you can download it during the Task (I have an IIS server where I host internal utilities that I might need, but your environment is different).
http://download.microsoft.com/download/c/f/4/cf454ae0-a4bb-4123-8333-a1b6737712f7/Windows-KB841290-x86-ENU.exe
Letâs look at the Task first. The first priority is to minimize the number of files that you will be generating the Hash value for. You have the file name you are looking for (system.ini), just not a file path, so letâs create a list of all the files on the system with that file name ⌠(I am assuming C:\TEMP exists, adjust it as needed, or you can keep this all inside the BES Client folder). Once we have the list of system.ini locations, we need to hash them, then make the hash values available to an Analysis.
The Relevance for this task should be something similar to âŚ
(Windows of Operating System)
The Action script would be âŚ
// We need to get the FCIV.exe utility, Iâm leaving that code out but assuming it is placed in the C:\TEMP
// folder to keep this simple.
// Weâre going to create a .cmd to generate what we need.
delete __createfile
delete C:\TEMP\FileList.txt
// If we donât delete the Hash database, FCIV will put duplicate entries in it on the second scan.
delete C:\TEMP\Hash.xml
delete C:\TEMP\HashList.txt
createfile until END
@ECHO OFF
REM Iâm assuming C:\TEMP exists, adjust to your environment, or it can be tweaked to use the
REM BES Client folder paths, the resulting hashfile.txt needs to persist for the Analysis to evaluate
REM later.
REM Step 1 - To minimize the number of files we need to generate a Hash for. This might be possible
REM with FCIV directly using different command line switches, but I couldnât get it to only hash the target
REM file, just by file extension types.
C:
CD
DIR /B /S system.ini > C:\TEMP\FileList.txt
REM Step 2 - Generate the hash values by iterating through the resulting list of found files.
for /F âtokens=*â %%A in (C:\TEMP\filelist.txt) do C:\TEMP\FCIV.EXE -add â%%Aâ -md5 -xml c:\temp\hash.xml
REM Step 3 - Export the Hash values to a text file where an Analysis can evaluate them.
C:\TEMP\FCIV.EXE -list -xml c:\temp\hash.xml > c:\temp\HashList.txt> END
move __createfile FindStuff.cmd
// Run the cmd file
waithidden FindStuff.cmd
= Overview =
- This script will result in a file that contains one line per instance of a any file named SYSTEM.INI on the C: drive. It may take a few moments to run, but no longer than most software installs. A 2-3 minutes, max in testing on my desktop. If you need to scan multiple drives, include multiple DIR lines and use the >> redirection option for each DIR command after the first. We want a single file âFileList.txtâ with all the resulting entries.
- FCIV is used to build an XML database of the Hash values for all the instances of System.ini we found on the system.
- We can then extract the Hash values into a format that the BES Client process can read (FCIV stores them in a base64 encoded format in the XML file).
- After testing your Task on a system or two, target all of your suspected systems (I assume something like âAll Computersâ)
Now you simply need an Analysis to check for the Hash values you are looking for. You can use relevance for the Analysis similar to the following âŚ
(Windows of Operating System) AND (exists file âHashList.txtâ of folder âC:\Tempâ)
with a property named âŚ
Bad SYSTEM.INI
with a relevance of âŚ
if (exists file âHashList.txtâ whose (content of it contains ââ) of folder âc:\tempâ) THEN (substrings after " " of lines whose (it contains ââ) of file âHashList.txtâ of folder âc:\tempâ) ELSE (NOTHING)
You can create a property for each file you are looking for as long as the files have been hashed by the initial Task. The relevance above should return the full path to every System.ini file that matches your âBadâ hash value. You can then enumerate the results using Web Reports, expanding the value of the âBad SYSTEM.INIâ property for all computers where âBad SYSTEM.INIâ contains âsystem.iniâ.