Advertisement
Guest User

SSLBinding2

a guest
Feb 13th, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 10.35 KB | None | 0 0
  1. #include "Array.au3"
  2.  
  3. Global $_nice_COMerrorArray, $_nice_COMerrorObj
  4. _nice_COMerrorHandler(1) ; COM error handler.
  5.  
  6.     ; Generated by AutoIt ScriptOMatic
  7.  
  8. ; Description: Represents a Secure Sockets Layer (SSL) binding.
  9.  
  10. Local $wbemFlagReturnImmediately = 0x10
  11. Local $wbemFlagForwardOnly = 0x20
  12. Local $colItems = ""
  13. Local $sComputer = "."
  14. Local $sUser = ""
  15. Local $sPassword = ""
  16. Local $sReturn=""
  17. FileDelete(@TempDir & "\ScriptOMatic.SSLBinding2.txt")
  18.  
  19. If $sComputer & $sUser & $sPassword = "." Then
  20.     ToolTip("...ObjGet", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - SSLBinding2",1,4)
  21.     Local $oWMIService = ObjGet("winmgmts:\\" & $sComputer & "\root\WebAdministration")
  22.     If Not IsObj($oWMIService) Then Exit MsgBox(262144, "WMI ScriptOMatic error", "ObjGet failed")
  23. Else
  24.     ToolTip("...ObjCreate", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - SSLBinding2",1,4)
  25.     Local $wmiLocator = ObjCreate("WbemScripting.SWbemLocator")
  26.     If Not IsObj($wmiLocator) Then Exit MsgBox(262144, "WMI ScriptOMatic error", "ObjCreate failed")
  27.     ToolTip("...ConnectServer", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - SSLBinding2",1,4)
  28.     Local $oWMIService = $wmiLocator.ConnectServer($sComputer, "\root\WebAdministration", $sUser, $sPassword)
  29.     If Not IsObj($oWMIService) Then Exit MsgBox(262144, "WMI ScriptOMatic error", "ConnectServer failed")
  30. EndIf
  31.  
  32. ToolTip("...ExecQuery", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - SSLBinding2",1,4)
  33. Local $colItems = $oWMIService.ExecQuery("SELECT * FROM SSLBinding2", _
  34.                      "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
  35.  
  36. ToolTip("...ExecQuery executed."& @CR &"...waiting for data.", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - SSLBinding2",1,4)
  37. If IsObj($colItems) Then
  38.  
  39.     Local $iCounter = 0
  40.     For $objItem In $colItems
  41.         $iCounter += 1
  42.         If Not Mod( $iCounter , 100 ) Then
  43.             ToolTip("...adding "& $iCounter &" of ??", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - SSLBinding2",1,4)
  44.             FileWriteLine(@TempDir & "\ScriptOMatic.SSLBinding2.txt", $sReturn )
  45.             $sReturn = ""
  46.         EndIf
  47.         $sReturn &= "BindingOwnerID: " & $objItem.BindingOwnerID & @CRLF
  48.         $sReturn &= "CertificateCheckMode: " & $objItem.CertificateCheckMode & @CRLF
  49.         $sReturn &= "CertificateHash: " & $objItem.CertificateHash & @CRLF
  50.         $sReturn &= "CTLIdentifier: " & $objItem.CTLIdentifier & @CRLF
  51.         $sReturn &= "CTLStoreName: " & $objItem.CTLStoreName & @CRLF
  52.         $sReturn &= "HostName: " & $objItem.HostName & @CRLF
  53.         $sReturn &= "IPAddress: " & $objItem.IPAddress & @CRLF
  54.         $sReturn &= "Port: " & $objItem.Port & @CRLF
  55.         $sReturn &= "RevocationFreshnessTime: " & WMIDateStringToDate($objItem.RevocationFreshnessTime) & @CRLF
  56.         $sReturn &= "RevocationURLRetrievalTimeout: " & WMIDateStringToDate($objItem.RevocationURLRetrievalTimeout) & @CRLF
  57.         $sReturn &= "SslAlwaysNegoClientCert: " & $objItem.SslAlwaysNegoClientCert & @CRLF
  58.         $sReturn &= "SslUseDsMapper: " & $objItem.SslUseDsMapper & @CRLF
  59.         $sReturn &= "StoreName: " & $objItem.StoreName & @CRLF
  60.         $sReturn &= @CRLF
  61.     Next
  62.     ;ConsoleWrite($sReturn)
  63.     FileWriteLine(@TempDir & "\ScriptOMatic.SSLBinding2.txt", $sReturn )
  64.     Run(@ComSpec & " /c start " & @TempDir & "\ScriptOMatic.SSLBinding2.txt" , @TempDir, @SW_HIDE)
  65. Else
  66.     MsgBox(262144 ,"WMI ScriptOMatic error","No WMI Objects Found for class: " & "SSLBinding2" )
  67. EndIf
  68. If $_nice_COMerrorArray[0][0] Then _nice_COMerrorHandler(2)
  69.  
  70.  
  71. Func WMIDateStringToDate($dtmDate)
  72.     Return (StringMid($dtmDate, 5, 2) & "/" & _
  73.         StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
  74.         & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
  75. EndFunc
  76. #Region    # ValueToDescription Functions #
  77.  
  78.  
  79.  
  80. #EndRegion # ValueToDescription Functions #
  81.  
  82. Func _nice_COMerrorHandler($i = 0)
  83.     If $i == 1 Then
  84.         Dim $_nice_COMerrorArray[301][9]
  85.         $_nice_COMerrorArray[0][0] = 0
  86.         $_nice_COMerrorObj = ObjEvent("AutoIt.Error", "_nice_COMerrorHandler")
  87.         Return
  88.     EndIf
  89.     If $i == 2 Then
  90.         If Not @Compiled Then
  91.             Local $n = 0, $c = 0, $s = FileRead(@ScriptFullPath)
  92.             Local $a = StringSplit($s, @CRLF, 1)
  93.             For $n = 1 To $_nice_COMerrorArray[0][0]
  94.                 If Int($_nice_COMerrorArray[$n][7]) > $a[0] Then ContinueLoop
  95.                 $_nice_COMerrorArray[$n][8] = StringStripWS($a[Int($_nice_COMerrorArray[$n][7])], 3)
  96.             Next
  97.             If StringInStr($s, "; only for the ANSI compiled version" & @CRLF) Then
  98.                 For $n = 1 To $a[0]
  99.                     If StringInStr($a[$n], "; only for the ANSI compiled version") Then $c += 1
  100.                     If $n > 50 Then ExitLoop
  101.                 Next
  102.                 For $n = 1 To $_nice_COMerrorArray[0][0]
  103.                     $_nice_COMerrorArray[$n][7] = $_nice_COMerrorArray[$n][7] - $c
  104.                 Next
  105.             EndIf
  106.         EndIf
  107.         $_nice_COMerrorArray[1][0] = ""
  108.         ReDim $_nice_COMerrorArray[$_nice_COMerrorArray[0][0] + 1][9]
  109.         _ArrayDisplay($_nice_COMerrorArray, "ScriptOMatic - COM Errors intercepted ( the script will continue after this screen )")
  110.         Return
  111.     EndIf
  112.     If $_nice_COMerrorArray[0][0] = 300 Then
  113.         $_nice_COMerrorArray[0][8] = "ScriptLine: only first 300 errors shown !!!"
  114.         Return
  115.     EndIf
  116.     If StringInStr($_nice_COMerrorArray[1][0], "|" & $_nice_COMerrorObj.scriptline & "|") Then Return
  117.     $i = $_nice_COMerrorArray[0][0] + 1
  118.     $_nice_COMerrorArray[0][0] = $i
  119.     $_nice_COMerrorArray[$i][1] = "0x" & Hex($_nice_COMerrorObj, 8)
  120.     $_nice_COMerrorArray[$i][2] = $_nice_COMerrorObj.windescription
  121.     $_nice_COMerrorArray[$i][3] = $_nice_COMerrorObj.source
  122.     $_nice_COMerrorArray[$i][4] = $_nice_COMerrorObj.helpfile
  123.     $_nice_COMerrorArray[$i][5] = $_nice_COMerrorObj.helpcontext
  124.     $_nice_COMerrorArray[$i][6] = $_nice_COMerrorObj.lastdllerror
  125.     $_nice_COMerrorArray[$i][7] = $_nice_COMerrorObj.scriptline
  126.     $_nice_COMerrorArray[1][0] = $_nice_COMerrorArray[1][0] & "|" & $_nice_COMerrorObj.scriptline & "|"
  127.     If $i == 1 Then
  128.         $_nice_COMerrorArray[0][1] = "ErrorNumber:"
  129.         $_nice_COMerrorArray[0][2] = "WinDescription:"
  130.         $_nice_COMerrorArray[0][3] = "Source:"
  131.         $_nice_COMerrorArray[0][4] = "HelpFile:"
  132.         $_nice_COMerrorArray[0][5] = "HelpContext:"
  133.         $_nice_COMerrorArray[0][6] = "LastDLLerror:"
  134.         $_nice_COMerrorArray[0][7] = "ScriptLineNumber:"
  135.         $_nice_COMerrorArray[0][8] = "ScriptLine:"
  136.     EndIf
  137. EndFunc   ;==>_nice_COMerrorHandler
  138.  
  139.  
  140. #comments-start
  141.  
  142. List of all the Properties and Methods for \root\WebAdministration:SSLBinding2
  143.  
  144.  
  145. SSLBinding2 Class Qualifiers
  146. ----------------------------
  147.  
  148. 1. Description = Represents a Secure Sockets Layer (SSL) binding.
  149. 2. DisplayName = SSL Binding2
  150. 3. dynamic = -1
  151. 4. factory_clsid = {283ADED9-F67A-4A5A-A8C4-ABF841F47626}
  152. 5. Locale = 1033
  153. 6. provider = WebAdministrationProvider
  154. 7. SupportsCreate = -1
  155. 8. SupportsDelete = -1
  156. 9. SupportsUpdate = -1
  157.  
  158.  
  159. SSLBinding2 Class Properties and Property Qualifiers
  160. ----------------------------------------------------
  161.  
  162. 1. BindingOwnerID
  163. 1.1. CIMTYPE = string
  164. 1.2. Description = A read/write string value that contains a GUID that represents the application that created the binding.
  165. 1.3. read = -1
  166. 1.4. write = -1
  167.  
  168. 2. CertificateCheckMode
  169. 2.1. CIMTYPE = sint32
  170. 2.2. Description = A read/write sint32 enumeration that configures client certificate checking.
  171. 2.3. read = -1
  172. 2.4. ValueMap = 1,2,4,65536
  173. 2.5. Values = DisableClientCertRevocationCheck,AlwaysUseCachedCRL,EnableRevocationFreshnessTimeSetting,DisableClientCertUsageCheck
  174. 2.6. write = -1
  175.  
  176. 3. CertificateHash
  177. 3.1. CIMTYPE = string
  178. 3.2. Description = A read/write string value that represents the unique identifier for the certificate.
  179. 3.3. read = -1
  180. 3.4. write = -1
  181.  
  182. 4. CTLIdentifier
  183. 4.1. CIMTYPE = string
  184. 4.2. Description = A read/write string value that identifies a certificate trust list (CTL).
  185. 4.3. read = -1
  186. 4.4. write = -1
  187.  
  188. 5. CTLStoreName
  189. 5.1. CIMTYPE = string
  190. 5.2. Description = A read/write string value that specifies the name of the certificate store where the CTL is found.
  191. 5.3. read = -1
  192. 5.4. write = -1
  193.  
  194. 6. HostName
  195. 6.1. CIMTYPE = string
  196. 6.2. Description = A read only string value that contains the name of the certificate store where the certificate is found.
  197. 6.3. key = -1
  198. 6.4. read = -1
  199.  
  200. 7. IPAddress
  201. 7.1. CIMTYPE = string
  202. 7.2. Description = A read-only string value that contains the IP address for the secure binding.
  203. 7.3. key = -1
  204. 7.4. read = -1
  205.  
  206. 8. Port
  207. 8.1. CIMTYPE = uint32
  208. 8.2. Description = A read-only uint32 value that contains the port number that the secure binding uses.
  209. 8.3. key = -1
  210. 8.4. read = -1
  211.  
  212. 9. RevocationFreshnessTime
  213. 9.1. CIMTYPE = DateTime
  214. 9.2. Description = A read/write datetime value in seconds.
  215. 9.3. read = -1
  216. 9.4. SUBTYPE = interval
  217. 9.5. write = -1
  218.  
  219. 10. RevocationURLRetrievalTimeout
  220. 10.1. CIMTYPE = DateTime
  221. 10.2. Description = A read/write datetime value that specifies a timeout interval, in milliseconds, after which the certificate revocation list (CRL) on the certificate client is updated by the CRL from the remote location.
  222. 10.3. read = -1
  223. 10.4. SUBTYPE = interval
  224. 10.5. write = -1
  225.  
  226. 11. SslAlwaysNegoClientCert
  227. 11.1. CIMTYPE = boolean
  228. 11.2. Description = A read/write Boolean value that specifies how SSL client connections will be negotiated. True if the server will immediately negotiate a client certificate; otherwise, false.
  229. 11.3. read = -1
  230. 11.4. write = -1
  231.  
  232. 12. SslUseDsMapper
  233. 12.1. CIMTYPE = boolean
  234. 12.2. Description = A read/write Boolean value. True if the Microsoft Active Directory certificate mapper is used for client certificate authentication; otherwise, false.
  235. 12.3. read = -1
  236. 12.4. write = -1
  237.  
  238. 13. StoreName
  239. 13.1. CIMTYPE = string
  240. 13.2. Description = A read only string value that contains the name of the certificate store where the certificate is found.
  241. 13.3. key = -1
  242. 13.4. read = -1
  243.  
  244.  
  245. SSLBinding2 Class Methods and Method Qualifiers
  246. -----------------------------------------------
  247.  
  248. 1. Create
  249. 1.1. bypass_getobject = -1
  250. 1.2. Constructor = -1
  251. 1.3. Description = Creates an SSL binding.
  252. 1.4. Implemented = -1
  253. 1.5. Static = -1
  254.  
  255. #comments-end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement