2017-11-22 10 views
1

コマンドラインから手動で実行するか、ダブルクリックすると完全に正常に動作するintel cpu脆弱性のvbsスクリプトを作成しました。 NSClient/gitのインフラがすべてのサーバーにあり、nagiosがチェックを作成するために使用しています。コマンドプロンプトからNSClient ++ .exeを使用してこのスクリプトを実行しようとしています。しかし、NSClientを使用してファイルを実行すると、ログファイル(SA-00086--)が作成されません。ここでNsclientを使用してVBSスクリプトからexeを実行しているときに発生する

がnsc.iniから私のNSClientコマンドです:ここで

intel_cpu_vulnerability=C:\Windows\system32\cscript.exe //NoLogo //T:60 C:\WINDOWS\NSClient\scripts\DiscoveryTool\cpu-unsafe.vbs 

は私のCPU-unsafe.vbsスクリプトです:

' VB SCript to find the Intel Processor vulnerability. 
Dim Maindir, objFSO, oFile, Executable, Vulnerable, NotVulnerable, objTextFile, Readme, VStatus, StatusLine, strLine 

Const ForReading = 1 
Maindir = "c:\Windows\nsclient\scripts\DiscoveryTool" 
Executable = "Intel-SA-00086-console.exe" 
Vulnerable = "Status: This system is vulnerable." 
NotVulnerable = "Status: This system is not vulnerable." 
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set WshShell = WScript.CreateObject("WScript.Shell") 

'Deleting all previous log/xml files 
For Each oFile In objFSO.GetFolder(Maindir).Files 
    If LCase(objFSO.GetExtensionName(oFile.Name))= "log" or LCase(objFSO.GetExtensionName(oFile.Name)) = "xml" Then 
     If oFile.Name <> "CommandLine.xml" Then 
      Deleteme = Maindir+"\"+oFile 
      objFSO.DeleteFile oFile 
     End If 
    End If 
next  

'Running the Intel detector 
WSHShell.Run Maindir + "\" + Executable , 0, True 
Set objShell = Nothing 
WScript.Sleep 3000 

'Setting the logfile to read 
For Each oFile In objFSO.GetFolder(Maindir).Files 
    If LCase(objFSO.GetExtensionName(oFile.Name))= "log" Then 
     If oFile.Name <> "CommandLine.xml" Then 
      Readme = oFile 
     End If 
    End If 
next 

Set objTextFile = objFSO.OpenTextFile(Readme, ForReading) 

'Reading the logfile and determining if the prosessor is affected. 
VStatus = "Undetermined" 
do until objTextFile.AtEndOfStream 
    strLine = objTextFile.ReadLine() 
    If Left(strLine, 7) = "Status:" Then 
     If InStr(strLine, NotVulnerable) <> 0 then 
      VStatus = "OK" 
      StatusLine = strLine 
     End If 

     If InStr(strLine, Vulnerable) <> 0 then 
      VStatus = "NOK" 
      StatusLine = strLine 
     End If 
    End If 
    If Left(strLine, 24) = "Status: Detection Error:" Then 
     VStatus = "Undetermined" 
     StatusLine = strLine 
    End If 
loop 

'The FINAL RESULTS: 
If VStatus = "OK" then 
    Wscript.Echo VStatus + ": Not Vulnerable -> From File: " + StatusLine 
    Wscript.Quit(1) 
ElseIf VStatus = "NOK" then 
    Wscript.Echo VStatus + ": Vulnerable -> From File: " + StatusLine 
    Wscript.Quit(3) 
Else 
    Wscript.Echo VStatus + ": May be Vulnerable -> From File: " + StatusLine 
    Wscript.Quit(2) 
End If 


objTextFile.Close 

あなたがWindows Vulnerability Detection tool from Intel's Websiteをダウンロードする必要があり、このスクリプトをテストします。ダウンロードしたら、zipファイルを解凍し、このスクリプトをDiscoveryToolフォルダの中に置き、ダブルクリックして実行します。このスクリプトは、CPUがIntel®Management Engineの脆弱性の影響を受けるかどうかを判断します。

編集:私はさらにNSClientから直接.exeを実行しようとしましたが、Commandline.dll auth failエラーが表示されました。

nsc.iniコマンド:

icvy=C:\WINDOWS\NSClient\scripts\DiscoveryTool\Intel-SA-00086-console.exe 

出力:

l NSClient++.cpp(456) Enter command to inject or exit to terminate... 
icvy 
d NSClient++.cpp(1106) Injecting: icvy: 
e \CheckExternalScripts.cpp(188) The command (C:\WINDOWS\NSClient\scripts\DiscoveryTool\Intel-SA-00086-console.exe) retu 
rned an invalid return code: 11 
d NSClient++.cpp(1142) Injected Result: WARNING 'Error: The file 'CommandLine.dll' authentication has failed.' 
d NSClient++.cpp(1143) Injected Performance Result: '' 
WARNING:Error: The file 'CommandLine.dll' authentication has failed. 

答えて

0

実行可能ファイルを含むディレクトリに現在の作業ディレクトリを設定してみてください。私はそうするまで同じエラーメッセージを見ていました。 VBScriptでは、それは次のようになります:

WSHShell.CurrentDirectory = Maindir 
WSHShell.Run Maindir + "\" + Executable , 0, True 
関連する問題