Knowledge Base Article

VBscript for Windows desktops and servers to redact logs...

Some forum posters are unable to post even fragments of, let alone complete, raw log files for NetBackup.

If a poster takes a copy of the attached script and places it on their desktop they will then be able to drag'n'drop log files onto the script icon, and then the script will create a copy of the log file, but with all of the pre-configured sensitive text replaced, and place the redacted copy in the same folder as the source file.

All that has to be done is to save a copy of the script to your desktop, edit it for your site, and then it's ready for use.

The script will create a copy of any file, to a file named "*.red.txt", for any file dropped on to it.

Published 9 years ago
Version 1.0

Was this article helpful?

1 Comment

  • And a visual copy of the script follows:

    Option Explicit
    Dim go_fso
    Set go_fso = CreateObject( "Scripting.FileSystemObject"    )
    Call s_main()
    WScript.Quit(0)
    
    Sub s_main()
      Dim ls_inp_file, ls_out_file, lo_inp_chan, lo_out_chan, ls_inp, ls_out
      ls_inp_file = WScript.Arguments.Item( 0 )
      ls_out_file = ls_inp_file & ".red.txt"
      Set lo_inp_chan = go_fso.OpenTextFile( ls_inp_file, 1 )
      Set lo_out_chan = go_fso.OpenTextFile( ls_out_file, 2, True )
      Do
        ls_inp = lo_inp_chan.ReadLine
        ls_out = ls_inp
    
    'replace company names...
        ls_out = Replace( ls_out, "ACME"          ,"XXX"            )
        ls_out = Replace( ls_out, "AcmE"          ,"XxX"            )
        ls_out = Replace( ls_out, "acme"          ,"xxx"            )
    
    'replace user names...
        ls_out = Replace( ls_out, "onlyme"        ,"nbuadmin"       )
        ls_out = Replace( ls_out, "OnlyMe"        ,"NbuAdmin"       )
    
    'replace IP addresses...
        ls_out = Replace( ls_out, "10.0.1."       ,"x.x.x."         )
        ls_out = Replace( ls_out, "10.0.9."       ,"y.y.y."         )
    
    'replace site names (e.g. in policy names)...
        ls_out = Replace( ls_out, "SITENAMEA_"    ,"PRIMARY_"       )
        ls_out = Replace( ls_out, "SITENAMEB_"    ,"SECONDARY_"    )
        ls_out = Replace( ls_out, "SiteNameA_"    ,"Primary_"       )
        ls_out = Replace( ls_out, "SiteNameB_"    ,"Secondary_"     )
    
        lo_out_chan.WriteLine ls_out
      Loop Until lo_inp_chan.AtEndOfStream
      lo_inp_chan.Close
      lo_out_chan.Close
    End Sub