Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to master v3.5 #54

Merged
merged 32 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
20934c7
Prepare version numbers for v3.5
OscarAkaElvis Jun 22, 2022
bb1b543
Logo extracted from powershell to ruby
arale61 Jun 27, 2022
2eaa9d9
Revert "Logo extracted from powershell to ruby"
arale61 Jul 2, 2022
ee74df7
Logo extracted from powershell to ruby
OscarAkaElvis Aug 2, 2022
f817329
Split powershell functions for menu code
arale61 Aug 3, 2022
3623e50
Update CHANGELOG.md
OscarAkaElvis Aug 3, 2022
680e58e
Don't rely on git ls-files in gemspec file
noraj Dec 8, 2022
ee8ce9b
ignore built gem
noraj Dec 8, 2022
28a1049
lint with rubocop
noraj Dec 8, 2022
e5463b4
enhance metadata & add mfa for security
noraj Dec 8, 2022
1916dba
Merge branch 'dev' into noraj/lint
noraj Dec 11, 2022
14d1972
lint
noraj Dec 11, 2022
7d44017
fix quotes
noraj Dec 14, 2022
2f3b190
Merge pull request #49 from noraj/noraj/gemspec
OscarAkaElvis Dec 20, 2022
0647b81
Merge branch 'dev' into noraj/lint
OscarAkaElvis Dec 20, 2022
78f31c4
Merge pull request #50 from noraj/noraj/lint
OscarAkaElvis Dec 20, 2022
71b8809
Merge pull request #52 from noraj/noraj/patch-42
OscarAkaElvis Dec 20, 2022
3a5d937
Update CHANGELOG.md
OscarAkaElvis Dec 20, 2022
ade1548
Fix for upload and download files
arale61 Mar 31, 2023
63ec738
Add support for using wildcards at last level of path, ie. c:/mypath/…
arale61 Apr 2, 2023
de6a507
Fix for bug in download command handler for source and dest path
arale61 Apr 2, 2023
5b0bf9b
Clean up 'put' calls with parenthesis for empty newlines.
arale61 Apr 3, 2023
186049a
Restore signature without default optiona value for 'normalize_path' …
arale61 Apr 3, 2023
cd6b908
Remove commented print_message for when upload command and add a logg…
arale61 Apr 4, 2023
b4171c4
Prevent nil of logger call in upload command
arale61 Apr 4, 2023
e069bcd
Added wildcard support for uploading files
arale61 Apr 4, 2023
eee019d
Updated CHANGELOG for upload an download improvements/fixes
arale61 Apr 4, 2023
e2e9bbc
Improvement for uploading files with upload command using wildcards, …
arale61 Apr 5, 2023
b4743d4
Fix puts in upload and download
arale61 Apr 7, 2023
15daabc
Fix empty lines printing
OscarAkaElvis Apr 14, 2023
dec841a
Fix non-controlled error on wrong certificates path when SSL enabled
OscarAkaElvis Apr 16, 2023
bd164fd
Docker image improved to support remote path completion
OscarAkaElvis Apr 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ desktop.ini
vendor/
.bundle/
.vscode/
*.gem
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inherit_mode:
merge:
- Exclude
AllCops:
TargetRubyVersion: 2.3
NewCops: enable
SuggestExtensions: false
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 3.5
- Improvements on powershell functions loading
- Improvements on gemspec file and in ruby code using Rubocop (Thanks noraj)
- Fixed issues with download and upload commands
- Added support for simple wildcard usage in upload and download commands
- Fixed non-controlled error on wrong certificates path when SSL enabled
- Docker image improved to support remote path completion

### 3.4
- Added CI files to be used in Github actions for Docker automated building
- Improvements on dynamic AMSI bypass
Expand Down
110 changes: 79 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Evil-WinRM Dockerfile

# Base image
FROM ruby:latest
FROM alpine:3.14 AS final
FROM alpine:3.14 AS build

# Credits & Data
LABEL \
Expand All @@ -13,14 +14,85 @@ LABEL \
#Env vars
ENV EVILWINRM_URL="https://github.com/Hackplayers/evil-winrm.git"

# Install dependencies
RUN gem install \
winrm \
# Install dependencies for building ruby with readline and openssl support
RUN apk --no-cache add cmake \
clang \
clang-dev \
make \
gcc \
g++ \
libc-dev \
linux-headers \
readline \
readline-dev \
yaml \
yaml-dev \
libffi \
libffi-dev \
zlib \
zlib-dev \
openssl-dev \
openssl \
bash

# Make the ruby path available
ENV PATH=$PATH:/opt/rubies/ruby-3.2.2/bin

# Get ruby-install for building ruby 3.2.2
RUN cd /tmp/ && \
wget -O /tmp/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/ && make install && \
ruby-install -c ruby 3.2.2 -- --with-readline-dir=/usr/include/readline --with-openssl-dir=/usr/include/openssl --disable-install-rdoc

# Evil-WinRM install method 1 (only one method can be used, other must be commented)
# Install Evil-WinRM (DockerHub automated build process)
RUN mkdir /opt/evil-winrm
COPY . /opt/evil-winrm

# Evil-WinRM install method 2 (only one method can be used, other must be commented)
# Install Evil-WinRM (manual image build)
# Uncomment git clone line and one of the ENV vars to select branch (master->latest, dev->beta)
#ENV BRANCH="master"
#ENV BRANCH="dev"
#RUN git clone -b ${BRANCH} ${EVILWINRM_URL}

# Install Evil-WinRM ruby dependencies
RUN gem install winrm \
winrm-fs \
stringio \
logger \
fileutils

# Clean and remove useless files
RUN rm -rf /opt/evil-winrm/resources > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.github > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/CONTRIBUTING.md > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/CODE_OF_CONDUCT.md > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/Dockerfile > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/Gemfile* > /dev/null 2>&1

# Rename script name
RUN mv /opt/evil-winrm/evil-winrm.rb /opt/evil-winrm/evil-winrm && \
chmod +x /opt/evil-winrm/evil-winrm

# Base final image
FROM final

# Install readline and other dependencies
RUN apk --no-cache add \
readline \
yaml \
libffi \
zlib \
openssl

# Make the ruby and Evil-WinRM paths available
ENV PATH=$PATH:/opt/rubies/ruby-3.2.2/bin:/opt/evil-winrm

# Copy built stuff from build image
COPY --from=build /opt /opt

# Create volume for powershell scripts
RUN mkdir /ps1_scripts
VOLUME /ps1_scripts
Expand All @@ -33,32 +105,8 @@ VOLUME /exe_files
RUN mkdir /data
VOLUME /data

# Set workdir
WORKDIR /opt/

#Evil-WinRM install method 1 (only one method can be used, other must be commented)
#Install Evil-WinRM (Docker Hub automated build process)
RUN mkdir evil-winrm
COPY . /opt/evil-winrm

#Evil-WinRM install method 2 (only one method can be used, other must be commented)
#Install Evil-WinRM (manual image build)
#Uncomment git clone line and one of the ENV vars to select branch (master->latest, dev->beta)
#ENV BRANCH="master"
#ENV BRANCH="dev"
#RUN git clone -b ${BRANCH} ${EVILWINRM_URL}

# Make script file executable
RUN chmod +x evil-winrm/*.rb

# Clean and remove useless files
RUN rm -rf /opt/evil-winrm/resources > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.github > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/CONTRIBUTING.md > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/CODE_OF_CONDUCT.md > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/Dockerfile > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/Gemfile* > /dev/null 2>&1 && \
rm -rf /tmp/* > /dev/null 2>&1
# set current working dir
WORKDIR /data

# Start command (launching Evil-WinRM)
ENTRYPOINT ["/opt/evil-winrm/evil-winrm.rb"]
ENTRYPOINT ["evil-winrm"]
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ Use it at your own servers and/or with the server owner's permission.
[@arale61]: https://twitter.com/arale61

<!-- Badges URLs -->
[Version-shield]: https://img.shields.io/badge/version-3.4-blue.svg?style=flat-square&colorA=273133&colorB=0093ee "Latest version"
[Version-shield]: https://img.shields.io/badge/version-3.5-blue.svg?style=flat-square&colorA=273133&colorB=0093ee "Latest version"
[Ruby2.3-shield]: https://img.shields.io/badge/ruby-2.3%2B-blue.svg?style=flat-square&colorA=273133&colorB=ff0000 "Ruby 2.3 or later"
[License-shield]: https://img.shields.io/badge/license-LGPL%20v3%2B-blue.svg?style=flat-square&colorA=273133&colorB=bd0000 "LGPL v3+"
[Docker-shield]: https://img.shields.io/docker/cloud/automated/oscarakaelvis/evil-winrm.svg?style=flat-square&colorA=273133&colorB=a9a9a9 "Docker rules!"
Expand Down
47 changes: 24 additions & 23 deletions evil-winrm.gemspec
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
# frozen_string_literal: true

Gem::Specification.new do |spec|
spec.name = "evil-winrm"
spec.version = '3.4'
spec.name = 'evil-winrm'
spec.version = '3.5'
spec.license = 'LGPL-3.0'
spec.authors = ["CyberVaca", "OscarAkaElvis", "Jarilaos", "Arale61"]
spec.email = ["oscar.alfonso.diaz@gmail.com"]
spec.authors = %w[CyberVaca OscarAkaElvis Jarilaos Arale61]
spec.email = ['oscar.alfonso.diaz@gmail.com']

spec.summary = "Evil-WinRM"
spec.description = "The ultimate WinRM shell for hacking/pentesting"
spec.homepage = "https://github.com/Hackplayers/evil-winrm#readme"
spec.required_ruby_version = ">= 2.3"
spec.summary = 'Evil-WinRM'
spec.description = 'The ultimate WinRM shell for hacking/pentesting'
spec.homepage = 'https://github.com/Hackplayers/evil-winrm#readme'
spec.required_ruby_version = '>= 2.3'

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/Hackplayers/evil-winrm"
spec.metadata["changelog_uri"] = "https://github.com/Hackplayers/evil-winrm/blob/master/CHANGELOG.md"
spec.metadata = {
'yard.run' => 'yard',
'changelog_uri' => 'https://github.com/Hackplayers/evil-winrm/blob/master/CHANGELOG.md',
'documentation_uri' => 'https://rubydoc.info/gems/evil-winrm',
'homepage_uri' => spec.homepage,
'source_code_uri' => 'https://github.com/Hackplayers/evil-winrm',
'rubygems_mfa_required' => 'true'
}

spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject do |f|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
end
end
spec.files = Dir['bin/*'] + ['evil-winrm.rb', 'LICENSE']
spec.bindir = "bin"
spec.executables = ["evil-winrm"]

spec.add_dependency "winrm", "~> 2.3", ">= 2.3.2"
spec.add_dependency "winrm-fs", "~> 1.3", ">= 1.3.2"
spec.add_dependency "stringio", "~> 3.0"
spec.add_dependency "logger", "~> 1.4", ">= 1.4.3"
spec.add_dependency "fileutils", "~> 1.0"
spec.add_dependency 'fileutils', '~> 1.0'
spec.add_dependency 'logger', '~> 1.4', '>= 1.4.3'
spec.add_dependency 'stringio', '~> 3.0'
spec.add_dependency 'winrm', '~> 2.3', '>= 2.3.2'
spec.add_dependency 'winrm-fs', '~> 1.3', '>= 1.3.2'

spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency 'bundler', '~> 2.0'

spec.post_install_message = "Happy hacking! :)"
spec.post_install_message = 'Happy hacking! :)'
end
Loading