:

17 2008 .
:
Main

  

  
,

,
  Windows
      WSH
  Linux
      
  Android
Web
  SEO
  Templates
  CMS
      DLE
  
  css
,


Arduino



   e-book
  









RSS



Windows Mobile
Symbian
Android
iPhone
Linux



«     2012    »
 1
2345678
9101112131415
16171819202122
23242526272829
30 

2019 (2)
2019 (1)
2019 (1)
2018 (1)
2018 (3)
2018 (2)

ACL
OS, OS » Windows » WSH
: dimon, : 3 2012

ACL . . .

'----------------------------------------------------------------------
'
' Copyright (c)All rights reserved.
'
'
' AUTHOR: tudimon.com
' DATE: 03.04.2012
' NAME: acl_group_in_log_v2.vbs
'
' COMMENT:
'
' ACL .
' .
'
'
'----------------------------------------------------------------------


StartPath = "C:\1" ' , ACL
LogFilePath = "c:\log.log"' -
ACLGroupName = "DOMAIN\GROUPNAME"'

LogTXT = "" '



'----------------------------------------------------------------------



LogTXT = LogTXT & vbNewLine & "******************** " & Now & "********************"



Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(StartPath)
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders


CurrentPath = objSubfolder.Path


Set objWsNet = CreateObject("WScript.Network")
strComputer = objWsNet.ComputerName
Set objWsNet = Nothing
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objSecSettings = objWMI.Get("Win32_LogicalFileSecuritySetting.Path='" & CurrentPath & "'")
If objSecSettings.GetSecurityDescriptor(objSD) = 0 Then
If Not IsNull(objSD.DACL) Then
' ACL

For Each objACE In objSD.DACL

ACL_group_read = objACE.Trustee.Domain & "\" & objACE.Trustee.Name

If ACL_group_read = ACLGroupName Then
'
LogTXT = LogTXT & vbNewLine & CurrentPath & " " & ACL_group_read
Else
'
' LogTXT = LogTXT & vbNewLine & " "
End If



Next

Set objACE = Nothing

Else
LogTXT = LogTXT & vbNewLine & " (ACL) . " & CurrentPath
End If
Else
LogTXT = LogTXT & vbNewLine & " . " & CurrentPath
End If

Next


Set objSD = Nothing
Set objSecSettings = Nothing
Set objWMI = Nothing


'
Set FSO = CreateObject("Scripting.FileSystemObject")
Set LogFile = FSO.OpenTextFile(LogFilePath, 8, True)
LogTXT = LogTXT & vbNewLine & "*************************************************************"
LogFile.WriteLine LogTXT
LogFile.Close

Set objFolder = Nothing
Set objShell = Nothing
WScript.Quit 0




acl_group_in_log_v2.rar [2,67 Kb] (c: 33)





*** v3 ***


+ e-mail

'----------------------------------------------------------------------
'
' Copyright (c)All rights reserved.
'
'
' AUTHOR: tudimon.com
' DATE: 02.05.2012
' NAME: alc_group_in_log_v3.vbs
'
' COMMENT:
'
' ACL .
' .
' e-mail
'
'
'
'----------------------------------------------------------------------


StartPath = "G:\Share" ' ,
LogFilePath = "c:\log.log"' -
ALCGroupName = "Domain\ALC_group"'

LogTXT = "" '

compName = "ServerName"' /

strSMTP_Server = "smtp.local"' SMTP
strSMTP_user = "admin"' SMTP
strSMTP_password = "secret_pass"' SMTP
strTo = "support@domain.ru"' e-mail
strFrom = "support@domain.ru"'
strSubject = "Find bad security on " & compName'
strBody = ""'
needSentMail = 0' , -


'----------------------------------------------------------------------



LogTXT = LogTXT & vbNewLine & "******************** " & Now & "********************"



Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(StartPath)
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders

CurrentPath = objSubfolder.Path

Set objWsNet = CreateObject("WScript.Network")
strComputer = objWsNet.ComputerName
Set objWsNet = Nothing
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objSecSettings = objWMI.Get("Win32_LogicalFileSecuritySetting.Path='" & CurrentPath & "'")
If objSecSettings.GetSecurityDescriptor(objSD) = 0 Then
If Not IsNull(objSD.DACL) Then
' ACL

For Each objACE In objSD.DACL

ALC_group_read = objACE.Trustee.Domain & "\" & objACE.Trustee.Name

If ALC_group_read = ALCGroupName Then
'
LogTXT = LogTXT & vbNewLine & CurrentPath & " " & ALC_group_read
needSentMail = 1
Else
'
' LogTXT = LogTXT & vbNewLine & " "
End If



Next

Set objACE = Nothing

Else
LogTXT = LogTXT & vbNewLine & " (ACL) ."
End If
Else
LogTXT = LogTXT & vbNewLine & " ."
End If

Next

LogTXT = LogTXT & vbNewLine & "*************************************************************"

Set objSD = Nothing
Set objSecSettings = Nothing
Set objWMI = Nothing



' , -
If needSentMail = 1 Then

strBody = LogTXT

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP_Server
Flds.Item("http://schemas.microsoft.com/cdo/configuration/SMTPAuthenticate") = cdoBasic
Flds.Item("http://schemas.microsoft.com/cdo/configuration/SendUserName") = strSMTP_user
Flds.Item("http://schemas.microsoft.com/cdo/configuration/SendPassword") = strSMTP_password
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
Flds.Update
iMsg.Configuration = iConf
iMsg.To = strTo
iMsg.From = strFrom
iMsg.Subject = strSubject
iMsg.TextBody = strBody
iMsg.Send

End If


'
Set FSO = CreateObject("Scripting.FileSystemObject")
Set LogFile = FSO.OpenTextFile(LogFilePath, 8, True)
LogFile.WriteLine LogTXT
LogFile.Close

Set objFolder = Nothing
Set objShell = Nothing
WScript.Quit 0



alc_group_in_log_v3.rar [3,32 Kb] (c: 29)



SMTP
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25

 
, . , .

:

  • ...
  • ...


  • :





     

     
    , , .


    :


    Android, Arduino, backup, CentOS, cmd, css, div, DLE, DLE , domoticz, dzvents, LCD, Linux, log, LUA, Monster, ogf3, RDP, Template, VBS, w2k8, windows, WSH, , , , , , , , , , , , , , , , -

    | | | | | | Copyright © 2005-2018 by dimon - all right reserved!
    :          PR     .   , by dimon