����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!powershell
# Copyright: (c) 2016, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#AnsibleRequires -CSharpUtil Ansible.Basic
#Requires -Module Ansible.ModuleUtils.LinkUtil
$spec = @{
options = @{
paths = @{ type = "list"; elements = "str"; required = $true }
age = @{ type = "str" }
age_stamp = @{ type = "str"; default = "mtime"; choices = "mtime", "ctime", "atime" }
file_type = @{ type = "str"; default = "file"; choices = "file", "directory" }
follow = @{ type = "bool"; default = $false }
hidden = @{ type = "bool"; default = $false }
patterns = @{ type = "list"; elements = "str"; aliases = "regex", "regexp" }
recurse = @{ type = "bool"; default = $false }
size = @{ type = "str" }
use_regex = @{ type = "bool"; default = $false }
get_checksum = @{ type = "bool"; default = $true }
checksum_algorithm = @{ type = "str"; default = "sha1"; choices = "md5", "sha1", "sha256", "sha384", "sha512" }
}
supports_check_mode = $true
}
$module = [Ansible.Basic.AnsibleModule]::Create($args, $spec)
$paths = $module.Params.paths
$age = $module.Params.age
$age_stamp = $module.Params.age_stamp
$file_type = $module.Params.file_type
$follow = $module.Params.follow
$hidden = $module.Params.hidden
$patterns = $module.Params.patterns
$recurse = $module.Params.recurse
$size = $module.Params.size
$use_regex = $module.Params.use_regex
$get_checksum = $module.Params.get_checksum
$checksum_algorithm = $module.Params.checksum_algorithm
$module.Result.examined = 0
$module.Result.files = @()
$module.Result.matched = 0
# https://github.com/ansible-collections/ansible.windows/issues/297
$oldLib = $env:LIB
$env:LIB = $null
Load-LinkUtils
$env:LIB = $oldLib
Function Assert-Age {
Param (
[System.IO.FileSystemInfo]$File,
[System.Int64]$Age,
[System.String]$AgeStamp
)
$actual_age = switch ($AgeStamp) {
mtime { $File.LastWriteTime.Ticks }
ctime { $File.CreationTime.Ticks }
atime { $File.LastAccessTime.Ticks }
}
if ($Age -ge 0) {
return $Age -ge $actual_age
}
else {
return ($Age * -1) -le $actual_age
}
}
Function Assert-FileType {
Param (
[System.IO.FileSystemInfo]$File,
[System.String]$FileType
)
$is_dir = $File.Attributes.HasFlag([System.IO.FileAttributes]::Directory)
return ($FileType -eq 'directory' -and $is_dir) -or ($FileType -eq 'file' -and -not $is_dir)
}
Function Assert-FileHidden {
Param (
[System.IO.FileSystemInfo]$File,
[Switch]$IsHidden
)
# https://github.com/ansible-collections/ansible.windows/issues/130
# We want to always return non-hidden files + hidden files if hidden: yes.
$file_is_hidden = $File.Attributes.HasFlag([System.IO.FileAttributes]::Hidden)
return $IsHidden.IsPresent -or -not $file_is_hidden
}
Function Assert-FileNamePattern {
Param (
[System.IO.FileSystemInfo]$File,
[System.String[]]$Patterns,
[Switch]$UseRegex
)
$valid_match = $false
foreach ($pattern in $Patterns) {
if ($UseRegex) {
if ($File.Name -match $pattern) {
$valid_match = $true
break
}
}
else {
if ($File.Name -like $pattern) {
$valid_match = $true
break
}
}
}
return $valid_match
}
Function Assert-FileSize {
Param (
[System.IO.FileSystemInfo]$File,
[System.Int64]$Size
)
if ($Size -ge 0) {
return $File.Length -ge $Size
}
else {
return $File.Length -le ($Size * -1)
}
}
Function Get-FileChecksum {
[CmdletBinding()]
Param (
[System.String]$Path,
[System.String]$Algorithm
)
$sp = switch ($algorithm) {
'md5' { New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
}
$fp = [System.IO.File]::Open($Path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
try {
[System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower()
}
catch {
Write-Error -Message "Failed to get $Algorithm hash for '$Path': $($_.Exception.Message)" -Exception $_.Exception
}
finally {
$fp.Dispose()
}
}
Function Search-Path {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingEmptyCatchBlock", "",
Justification = "We purposefully ignore certain exceptions when failing to access files we don't have permissions to")]
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[System.String]
$Path,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[System.Collections.Generic.HashSet`1[System.String]]
$CheckedPaths,
[Parameter(Mandatory = $true)]
[Object]
$Module,
[System.Int64]
$Age,
[System.String]
$AgeStamp,
[System.String]
$FileType,
[Switch]
$Follow,
[Switch]
$GetChecksum,
[Switch]
$IsHidden,
[System.String[]]
$Patterns,
[Switch]
$Recurse,
[System.Int64]
$Size,
[Switch]
$UseRegex
)
$dir_obj = New-Object -TypeName System.IO.DirectoryInfo -ArgumentList $Path
if ($null -eq $dir_obj.Attributes -or [Int32]$dir_obj.Attributes -eq -1) {
$Module.Warn("Argument path '$Path' does not exist or is not accessible, skipping")
return
}
elseif (-not $dir_obj.Attributes.HasFlag([System.IO.FileAttributes]::Directory)) {
$Module.Warn("Argument path '$Path' is a file not a directory, skipping")
return
}
$dir_files = @()
try {
$dir_files = $dir_obj.EnumerateFileSystemInfos("*", [System.IO.SearchOption]::TopDirectoryOnly)
}
catch [System.IO.DirectoryNotFoundException] {
# Broken ReparsePoint/Symlink, cannot enumerate
}
catch [System.UnauthorizedAccessException] {} # No ListDirectory permissions, Get-ChildItem ignored this
foreach ($dir_child in $dir_files) {
if ($dir_child.Attributes.HasFlag([System.IO.FileAttributes]::Directory) -and $Recurse) {
if ($Follow -or -not $dir_child.Attributes.HasFlag([System.IO.FileAttributes]::ReparsePoint)) {
$PSBoundParameters.Remove('Path') > $null
Search-Path -Path $dir_child.FullName @PSBoundParameters
}
}
# Check to see if we've already encountered this path and skip if we have.
if (-not $CheckedPaths.Add($dir_child.FullName.ToLowerInvariant())) {
continue
}
$Module.Result.examined++
if ($PSBoundParameters.ContainsKey('Age')) {
$age_match = Assert-Age -File $dir_child -Age $Age -AgeStamp $AgeStamp
}
else {
$age_match = $true
}
$file_type_match = Assert-FileType -File $dir_child -FileType $FileType
$hidden_match = Assert-FileHidden -File $dir_child -IsHidden:$IsHidden
if ($PSBoundParameters.ContainsKey('Patterns')) {
$pattern_match = Assert-FileNamePattern -File $dir_child -Patterns $Patterns -UseRegex:$UseRegex.IsPresent
}
else {
$pattern_match = $true
}
if ($PSBoundParameters.ContainsKey('Size')) {
$size_match = Assert-FileSize -File $dir_child -Size $Size
}
else {
$size_match = $true
}
if (-not ($age_match -and $file_type_match -and $hidden_match -and $pattern_match -and $size_match)) {
continue
}
# It passed all our filters so add it
$module.Result.matched++
# TODO: Make this generic so it can be shared with win_find and win_stat.
$epoch = New-Object -Type System.DateTime -ArgumentList 1970, 1, 1, 0, 0, 0, 0
$file_info = @{
attributes = $dir_child.Attributes.ToString()
checksum = $null
creationtime = (New-TimeSpan -Start $epoch -End $dir_child.CreationTime).TotalSeconds
exists = $true
extension = $null
filename = $dir_child.Name
isarchive = $dir_child.Attributes.HasFlag([System.IO.FileAttributes]::Archive)
isdir = $dir_child.Attributes.HasFlag([System.IO.FileAttributes]::Directory)
ishidden = $dir_child.Attributes.HasFlag([System.IO.FileAttributes]::Hidden)
isreadonly = $dir_child.Attributes.HasFlag([System.IO.FileAttributes]::ReadOnly)
isreg = $false
isshared = $false
lastaccesstime = (New-TimeSpan -Start $epoch -End $dir_child.LastAccessTime).TotalSeconds
lastwritetime = (New-TimeSpan -Start $epoch -End $dir_child.LastWriteTime).TotalSeconds
owner = $null
path = $dir_child.FullName
sharename = $null
size = $null
}
try {
$file_info.owner = $dir_child.GetAccessControl().Owner
}
catch {
# May not have the rights to get the Owner, historical behaviour is to ignore but we will at least warn.
$module.Warn("Failed to get the owner for '$($dir_child.FullName)': $($_.Exception.Message)")
}
if ($dir_child.Attributes.HasFlag([System.IO.FileAttributes]::Directory)) {
$share_info = Get-CimInstance -ClassName Win32_Share -Filter "Path='$($dir_child.FullName -replace "(\\|')", '\$1')'"
if ($null -ne $share_info) {
$file_info.isshared = $true
$file_info.sharename = $share_info.Name
}
}
else {
$file_info.extension = $dir_child.Extension
$file_info.isreg = $true
$file_info.size = $dir_child.Length
if ($GetChecksum) {
$file_info.checksum = Get-FileChecksum -Path $dir_child.FullName -Algorithm $checksum_algorithm -ErrorAction SilentlyContinue
}
}
# Append the link information if the path is a link
$link_info = @{
isjunction = $false
islnk = $false
nlink = 1
lnk_source = $null
lnk_target = $null
hlnk_targets = @()
}
$link_stat = Get-Link -link_path $dir_child.FullName
if ($null -ne $link_stat) {
switch ($link_stat.Type) {
"SymbolicLink" {
$link_info.islnk = $true
$link_info.isreg = $false
$link_info.lnk_source = $link_stat.AbsolutePath
$link_info.lnk_target = $link_stat.TargetPath
break
}
"JunctionPoint" {
$link_info.isjunction = $true
$link_info.isreg = $false
$link_info.lnk_source = $link_stat.AbsolutePath
$link_info.lnk_target = $link_stat.TargetPath
break
}
"HardLink" {
$link_info.nlink = $link_stat.HardTargets.Count
# remove current path from the targets
$hlnk_targets = $link_info.HardTargets | Where-Object { $_ -ne $dir_child.FullName }
$link_info.hlnk_targets = @($hlnk_targets)
break
}
}
}
foreach ($kv in $link_info.GetEnumerator()) {
$file_info.$($kv.Key) = $kv.Value
}
# Output the file_info object
$file_info
}
}
$search_params = @{
CheckedPaths = [System.Collections.Generic.HashSet`1[System.String]]@()
GetChecksum = $get_checksum
Module = $module
FileType = $file_type
Follow = $follow
IsHidden = $hidden
Recurse = $recurse
}
if ($null -ne $age) {
$seconds_per_unit = @{'s' = 1; 'm' = 60; 'h' = 3600; 'd' = 86400; 'w' = 604800 }
$seconds_pattern = '^(-?\d+)(s|m|h|d|w)?$'
$match = $age -match $seconds_pattern
if ($Match) {
$specified_seconds = [Int64]$Matches[1]
if ($null -eq $Matches[2]) {
$chosen_unit = 's'
}
else {
$chosen_unit = $Matches[2]
}
$total_seconds = $specified_seconds * ($seconds_per_unit.$chosen_unit)
if ($total_seconds -ge 0) {
$search_params.Age = (Get-Date).AddSeconds($total_seconds * -1).Ticks
}
else {
# Make sure we add the positive value of seconds to current time then make it negative for later comparisons.
$age = (Get-Date).AddSeconds($total_seconds).Ticks
$search_params.Age = $age * -1
}
$search_params.AgeStamp = $age_stamp
}
else {
$module.FailJson("Invalid age pattern specified")
}
}
if ($null -ne $patterns) {
$search_params.Patterns = $patterns
$search_params.UseRegex = $use_regex
}
if ($null -ne $size) {
$bytes_per_unit = @{'b' = 1; 'k' = 1KB; 'm' = 1MB; 'g' = 1GB; 't' = 1TB }
$size_pattern = '^(-?\d+)(b|k|m|g|t)?$'
$match = $size -match $size_pattern
if ($Match) {
$specified_size = [Int64]$Matches[1]
if ($null -eq $Matches[2]) {
$chosen_byte = 'b'
}
else {
$chosen_byte = $Matches[2]
}
$search_params.Size = $specified_size * ($bytes_per_unit.$chosen_byte)
}
else {
$module.FailJson("Invalid size pattern specified")
}
}
$matched_files = foreach ($path in $paths) {
# Ensure we pass in an absolute path. We use the ExecutionContext as this is based on the PSProvider path not the
# process location which can be different.
$abs_path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
Search-Path -Path $abs_path @search_params
}
# Make sure we sort the files in alphabetical order.
$module.Result.files = @() + ($matched_files | Sort-Object -Property { $_.path })
$module.ExitJson()
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| async_status.ps1 | File | 1.81 KB | 0644 |
|
| async_status.yml | File | 1.77 KB | 0644 |
|
| setup.ps1 | File | 49.89 KB | 0644 |
|
| setup.yml | File | 2.35 KB | 0644 |
|
| slurp.ps1 | File | 728 B | 0644 |
|
| slurp.yml | File | 1.5 KB | 0644 |
|
| win_acl.ps1 | File | 9.54 KB | 0644 |
|
| win_acl.py | File | 4.14 KB | 0644 |
|
| win_acl_inheritance.ps1 | File | 4.72 KB | 0644 |
|
| win_acl_inheritance.py | File | 2.34 KB | 0644 |
|
| win_certificate_store.ps1 | File | 19.78 KB | 0644 |
|
| win_certificate_store.py | File | 8.08 KB | 0644 |
|
| win_command.ps1 | File | 3.98 KB | 0644 |
|
| win_command.py | File | 6.13 KB | 0644 |
|
| win_copy.ps1 | File | 18.06 KB | 0644 |
|
| win_copy.py | File | 6.55 KB | 0644 |
|
| win_dns_client.ps1 | File | 12.99 KB | 0644 |
|
| win_dns_client.py | File | 2.13 KB | 0644 |
|
| win_domain.ps1 | File | 7.67 KB | 0644 |
|
| win_domain.py | File | 4.15 KB | 0644 |
|
| win_domain_controller.ps1 | File | 12.37 KB | 0644 |
|
| win_domain_controller.py | File | 5.66 KB | 0644 |
|
| win_domain_membership.ps1 | File | 10.36 KB | 0644 |
|
| win_domain_membership.py | File | 3.35 KB | 0644 |
|
| win_dsc.ps1 | File | 19.46 KB | 0644 |
|
| win_dsc.py | File | 7.31 KB | 0644 |
|
| win_environment.ps1 | File | 5.56 KB | 0644 |
|
| win_environment.py | File | 4.13 KB | 0644 |
|
| win_feature.ps1 | File | 4.1 KB | 0644 |
|
| win_feature.py | File | 4.63 KB | 0644 |
|
| win_file.ps1 | File | 5.4 KB | 0644 |
|
| win_file.py | File | 2.16 KB | 0644 |
|
| win_find.ps1 | File | 14.29 KB | 0644 |
|
| win_find.py | File | 11.19 KB | 0644 |
|
| win_get_url.ps1 | File | 11.59 KB | 0644 |
|
| win_get_url.py | File | 5.82 KB | 0644 |
|
| win_group.ps1 | File | 1.64 KB | 0644 |
|
| win_group.py | File | 1.1 KB | 0644 |
|
| win_group_membership.ps1 | File | 5.82 KB | 0644 |
|
| win_group_membership.py | File | 2.95 KB | 0644 |
|
| win_hostname.ps1 | File | 1 KB | 0644 |
|
| win_hostname.py | File | 1.07 KB | 0644 |
|
| win_optional_feature.ps1 | File | 2.84 KB | 0644 |
|
| win_optional_feature.py | File | 2.32 KB | 0644 |
|
| win_owner.ps1 | File | 2.18 KB | 0644 |
|
| win_owner.py | File | 1.05 KB | 0644 |
|
| win_package.ps1 | File | 51.85 KB | 0644 |
|
| win_package.py | File | 15.68 KB | 0644 |
|
| win_path.ps1 | File | 6.17 KB | 0644 |
|
| win_path.py | File | 2.94 KB | 0644 |
|
| win_ping.ps1 | File | 454 B | 0644 |
|
| win_ping.py | File | 1.16 KB | 0644 |
|
| win_powershell.ps1 | File | 29.57 KB | 0644 |
|
| win_powershell.py | File | 15.7 KB | 0644 |
|
| win_reboot.py | File | 4.76 KB | 0644 |
|
| win_reg_stat.ps1 | File | 4.11 KB | 0644 |
|
| win_reg_stat.py | File | 3.51 KB | 0644 |
|
| win_regedit.ps1 | File | 18.12 KB | 0644 |
|
| win_regedit.py | File | 6.35 KB | 0644 |
|
| win_service.ps1 | File | 37.85 KB | 0644 |
|
| win_service.py | File | 16.71 KB | 0644 |
|
| win_service_info.ps1 | File | 9.98 KB | 0644 |
|
| win_service_info.py | File | 9.44 KB | 0644 |
|
| win_share.ps1 | File | 11.93 KB | 0644 |
|
| win_share.py | File | 3.02 KB | 0644 |
|
| win_shell.ps1 | File | 4.93 KB | 0644 |
|
| win_shell.py | File | 5.69 KB | 0644 |
|
| win_stat.ps1 | File | 7.24 KB | 0644 |
|
| win_stat.py | File | 7.39 KB | 0644 |
|
| win_tempfile.ps1 | File | 2.46 KB | 0644 |
|
| win_tempfile.py | File | 1.49 KB | 0644 |
|
| win_template.py | File | 5.48 KB | 0644 |
|
| win_updates.ps1 | File | 57.42 KB | 0644 |
|
| win_updates.py | File | 11.95 KB | 0644 |
|
| win_uri.ps1 | File | 7.95 KB | 0644 |
|
| win_uri.py | File | 4.14 KB | 0644 |
|
| win_user.ps1 | File | 16.46 KB | 0644 |
|
| win_user.py | File | 5.43 KB | 0644 |
|
| win_user_right.ps1 | File | 13.78 KB | 0644 |
|
| win_user_right.py | File | 3.24 KB | 0644 |
|
| win_wait_for.ps1 | File | 9.56 KB | 0644 |
|
| win_wait_for.py | File | 4.42 KB | 0644 |
|
| win_whoami.ps1 | File | 30.96 KB | 0644 |
|
| win_whoami.py | File | 5.29 KB | 0644 |
|