diff --git a/.github/install_tests/cst-config-kali.yaml b/.github/install_tests/cst-config-kali.yaml index b33ad2db9..44be7847e 100644 --- a/.github/install_tests/cst-config-kali.yaml +++ b/.github/install_tests/cst-config-kali.yaml @@ -5,4 +5,4 @@ commandTests: - name: "mysql version" command: "mysql" args: ["--version"] - expectedOutput: ["mysql Ver 15.*10.*-MariaDB"] + expectedOutput: ["mysql from 11.*-MariaDB*"] diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index c4bf2e520..7006ac25c 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -85,7 +85,7 @@ jobs: DATABASE_USE=sqlite poetry run pytest . -v --runslow - name: Pytest coverage comment if: ${{ matrix.python-version == '3.12' }} - uses: MishaKav/pytest-coverage-comment@v1.1.52 + uses: MishaKav/pytest-coverage-comment@v1.1.53 with: pytest-coverage-path: ./pytest-coverage.txt junitxml-path: ./pytest.xml @@ -139,7 +139,7 @@ jobs: # To save CI time, only run these tests when the install script or deps changed - name: Get changed files using defaults id: changed-files - uses: tj-actions/changed-files@v45.0.3 + uses: tj-actions/changed-files@v45.0.4 - name: Build images if: contains(steps.changed-files.outputs.modified_files, 'setup/install.sh') || contains(steps.changed-files.outputs.modified_files, 'poetry.lock') run: docker compose -f .github/install_tests/docker-compose-install-tests.yml build --parallel ${{ join(matrix.images, ' ') }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0422e1e08..5d592319d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.11.7] - 2024-11-11 + +- Fix arm installs by installing dotnet and powershell manually +- Fix issue initializing some databases by removing the unused Reporting table + ## [5.11.6] - 2024-11-08 - Fixed extra character in nanodump.x64.o @@ -939,7 +944,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated shellcoderdi to newest version (@Cx01N) - Added a Nim launcher (@Hubbl3) -[Unreleased]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.11.6...HEAD +[Unreleased]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.11.7...HEAD + +[5.11.7]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.11.6...v5.11.7 [5.11.6]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.11.5...v5.11.6 diff --git a/Dockerfile b/Dockerfile index 1f8f3e0cd..61fdf3e43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ # 2) create volume storage: `docker create -v /empire --name data bcsecurity/empire` # 3) run out container: `docker run -it --volumes-from data bcsecurity/empire /bin/bash` -FROM python:3.12.2-bullseye +FROM python:3.12.6-bullseye LABEL maintainer="bc-security" LABEL description="Dockerfile for Empire server and client. https://bc-security.gitbook.io/empire-wiki/quickstart/installation#docker" diff --git a/empire/server/common/empire.py b/empire/server/common/empire.py index 85f991664..c4495f2c0 100755 --- a/empire/server/common/empire.py +++ b/empire/server/common/empire.py @@ -38,7 +38,7 @@ from . import agents, credentials, listeners, stagers -VERSION = "5.11.6 BC Security Fork" +VERSION = "5.11.7 BC Security Fork" log = logging.getLogger(__name__) diff --git a/empire/server/common/helpers.py b/empire/server/common/helpers.py index 78ba1f99a..a4d5a7f7c 100644 --- a/empire/server/common/helpers.py +++ b/empire/server/common/helpers.py @@ -41,7 +41,6 @@ import ipaddress import json import logging -import os import random import re import socket @@ -53,8 +52,6 @@ import urllib.request from datetime import datetime -import netifaces - from empire.server.utils.math_util import old_div log = logging.getLogger(__name__) @@ -602,44 +599,14 @@ def lhost(): """ Return the local IP. """ - - if os.name != "nt": - import fcntl - import struct - - def get_interface_ip(ifname): - try: - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - return socket.inet_ntoa( - fcntl.ioctl( - s.fileno(), - 0x8915, # SIOCGIFADDR - struct.pack("256s", ifname[:15].encode("UTF-8")), - )[20:24] - ) - except OSError: - return "" - - ip = "" try: - ip = socket.gethostbyname(socket.gethostname()) - except socket.gaierror: - pass + # Create a socket and connect to a remote server + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.connect(("8.8.8.8", 80)) + ip = s.getsockname()[0] + s.close() except Exception: - log.error("Unexpected error:", exc_info=True) - return ip - - if (ip == "" or ip.startswith("127.")) and os.name != "nt": - interfaces = netifaces.interfaces() - for ifname in interfaces: - if "lo" not in ifname: - try: - ip = get_interface_ip(ifname) - if ip != "": - break - except Exception: - log.error("Unexpected error:", exc_info=True) - pass + ip = "127.0.0.1" return ip diff --git a/empire/server/core/db/models.py b/empire/server/core/db/models.py index 33f151cc6..c3b435973 100644 --- a/empire/server/core/db/models.py +++ b/empire/server/core/db/models.py @@ -455,19 +455,6 @@ def __repr__(self): return f"" -class Reporting(Base): - __tablename__ = "reporting" - id = Column(Integer, Sequence("reporting_id_seq"), primary_key=True) - name = Column(String(255), nullable=False) - event_type = Column(String(255)) - message = Column(Text) - timestamp = Column(UtcDateTime, default=utcnow(), nullable=False) - taskID = Column(Integer, ForeignKey("agent_tasks.id")) - - def __repr__(self): - return f"" - - class Keyword(Base): __tablename__ = "keywords" id = Column(Integer, Sequence("keyword_seq"), primary_key=True) diff --git a/poetry.lock b/poetry.lock index 074a4166a..f30e82dcf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1360,45 +1360,6 @@ files = [ {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] -[[package]] -name = "netifaces" -version = "0.11.0" -description = "Portable network interface information." -optional = false -python-versions = "*" -files = [ - {file = "netifaces-0.11.0-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:eb4813b77d5df99903af4757ce980a98c4d702bbcb81f32a0b305a1537bdf0b1"}, - {file = "netifaces-0.11.0-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:5f9ca13babe4d845e400921973f6165a4c2f9f3379c7abfc7478160e25d196a4"}, - {file = "netifaces-0.11.0-cp27-cp27m-win32.whl", hash = "sha256:7dbb71ea26d304e78ccccf6faccef71bb27ea35e259fb883cfd7fd7b4f17ecb1"}, - {file = "netifaces-0.11.0-cp27-cp27m-win_amd64.whl", hash = "sha256:0f6133ac02521270d9f7c490f0c8c60638ff4aec8338efeff10a1b51506abe85"}, - {file = "netifaces-0.11.0-cp27-cp27mu-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:08e3f102a59f9eaef70948340aeb6c89bd09734e0dca0f3b82720305729f63ea"}, - {file = "netifaces-0.11.0-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:c03fb2d4ef4e393f2e6ffc6376410a22a3544f164b336b3a355226653e5efd89"}, - {file = "netifaces-0.11.0-cp34-cp34m-win32.whl", hash = "sha256:73ff21559675150d31deea8f1f8d7e9a9a7e4688732a94d71327082f517fc6b4"}, - {file = "netifaces-0.11.0-cp35-cp35m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:815eafdf8b8f2e61370afc6add6194bd5a7252ae44c667e96c4c1ecf418811e4"}, - {file = "netifaces-0.11.0-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:50721858c935a76b83dd0dd1ab472cad0a3ef540a1408057624604002fcfb45b"}, - {file = "netifaces-0.11.0-cp35-cp35m-win32.whl", hash = "sha256:c9a3a47cd3aaeb71e93e681d9816c56406ed755b9442e981b07e3618fb71d2ac"}, - {file = "netifaces-0.11.0-cp36-cp36m-macosx_10_15_x86_64.whl", hash = "sha256:aab1dbfdc55086c789f0eb37affccf47b895b98d490738b81f3b2360100426be"}, - {file = "netifaces-0.11.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c37a1ca83825bc6f54dddf5277e9c65dec2f1b4d0ba44b8fd42bc30c91aa6ea1"}, - {file = "netifaces-0.11.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:28f4bf3a1361ab3ed93c5ef360c8b7d4a4ae060176a3529e72e5e4ffc4afd8b0"}, - {file = "netifaces-0.11.0-cp36-cp36m-win32.whl", hash = "sha256:2650beee182fed66617e18474b943e72e52f10a24dc8cac1db36c41ee9c041b7"}, - {file = "netifaces-0.11.0-cp36-cp36m-win_amd64.whl", hash = "sha256:cb925e1ca024d6f9b4f9b01d83215fd00fe69d095d0255ff3f64bffda74025c8"}, - {file = "netifaces-0.11.0-cp37-cp37m-macosx_10_15_x86_64.whl", hash = "sha256:84e4d2e6973eccc52778735befc01638498781ce0e39aa2044ccfd2385c03246"}, - {file = "netifaces-0.11.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:18917fbbdcb2d4f897153c5ddbb56b31fa6dd7c3fa9608b7e3c3a663df8206b5"}, - {file = "netifaces-0.11.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:48324183af7f1bc44f5f197f3dad54a809ad1ef0c78baee2c88f16a5de02c4c9"}, - {file = "netifaces-0.11.0-cp37-cp37m-win32.whl", hash = "sha256:8f7da24eab0d4184715d96208b38d373fd15c37b0dafb74756c638bd619ba150"}, - {file = "netifaces-0.11.0-cp37-cp37m-win_amd64.whl", hash = "sha256:2479bb4bb50968089a7c045f24d120f37026d7e802ec134c4490eae994c729b5"}, - {file = "netifaces-0.11.0-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:3ecb3f37c31d5d51d2a4d935cfa81c9bc956687c6f5237021b36d6fdc2815b2c"}, - {file = "netifaces-0.11.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:96c0fe9696398253f93482c84814f0e7290eee0bfec11563bd07d80d701280c3"}, - {file = "netifaces-0.11.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:c92ff9ac7c2282009fe0dcb67ee3cd17978cffbe0c8f4b471c00fe4325c9b4d4"}, - {file = "netifaces-0.11.0-cp38-cp38-win32.whl", hash = "sha256:d07b01c51b0b6ceb0f09fc48ec58debd99d2c8430b09e56651addeaf5de48048"}, - {file = "netifaces-0.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:469fc61034f3daf095e02f9f1bbac07927b826c76b745207287bc594884cfd05"}, - {file = "netifaces-0.11.0-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:5be83986100ed1fdfa78f11ccff9e4757297735ac17391b95e17e74335c2047d"}, - {file = "netifaces-0.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:54ff6624eb95b8a07e79aa8817288659af174e954cca24cdb0daeeddfc03c4ff"}, - {file = "netifaces-0.11.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:841aa21110a20dc1621e3dd9f922c64ca64dd1eb213c47267a2c324d823f6c8f"}, - {file = "netifaces-0.11.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:e76c7f351e0444721e85f975ae92718e21c1f361bda946d60a214061de1f00a1"}, - {file = "netifaces-0.11.0.tar.gz", hash = "sha256:043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32"}, -] - [[package]] name = "numpy" version = "2.0.0" @@ -3396,4 +3357,4 @@ test = ["pytest"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "3e1fcd78b7d6a0ec1c3eabb7aee6c2a349f03e768e977d40335525e68e1137c5" +content-hash = "3c88435392ff46f7cba202a6eb4633fe996739a004fd3b0fc9bc0113de257c13" diff --git a/pyproject.toml b/pyproject.toml index 9ed1d9c10..23b6c4074 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "empire-bc-security-fork" -version = "5.11.6" +version = "5.11.7" description = "" authors = ["BC Security "] readme = "README.md" @@ -21,7 +21,6 @@ macholib = "^1.16.3" dropbox = "^11.36.2" pyOpenSSL = "^24.0.0" zlib_wrapper = "^0.1.3" -netifaces = "^0.11.0" jinja2 = "^3.1.3" xlutils = "^2.0.0" pyparsing = "^3.1.1" diff --git a/setup/install.sh b/setup/install.sh index fdd2e3e92..7eeeace3c 100755 --- a/setup/install.sh +++ b/setup/install.sh @@ -23,36 +23,26 @@ done function command_exists() { command -v "$1" >/dev/null 2>&1; } + function install_powershell() { echo -e "\x1b[1;34m[*] Installing PowerShell\x1b[0m" - if [ "$OS_NAME" == "DEBIAN" ]; then - # TODO Temporary until official Debian 12 support is added - VERSION_ID_2=$VERSION_ID - if [ "$VERSION_ID" == "12" ]; then - VERSION_ID_2="11" - fi - wget https://packages.microsoft.com/config/debian/"${VERSION_ID_2}"/packages-microsoft-prod.deb - sudo dpkg -i packages-microsoft-prod.deb - rm packages-microsoft-prod.deb - sudo apt-get update - sudo apt-get install -y powershell - elif [ "$OS_NAME" == "UBUNTU" ]; then - sudo apt-get update - sudo DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y wget apt-transport-https software-properties-common - wget -q "https://packages.microsoft.com/config/ubuntu/${VERSION_ID}/packages-microsoft-prod.deb" - sudo dpkg -i packages-microsoft-prod.deb - rm packages-microsoft-prod.deb - sudo apt-get update - sudo apt-get install -y powershell - elif [ "$OS_NAME" == "KALI" ]; then - sudo apt-get update && sudo apt-get -y install powershell - elif [ $OS_NAME == "PARROT" ]; then - sudo apt-get update && sudo apt-get -y install powershell + + # https://learn.microsoft.com/en-us/powershell/scripting/install/install-other-linux?view=powershell-7.4#binary-archives + ARCH=$(uname -m) + if [ "$ARCH" == "x86_64" ]; then + POWERSHELL_URL="https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-x64.tar.gz" + else + POWERSHELL_URL="https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-arm64.tar.gz" fi + curl -L -o /tmp/powershell.tar.gz $POWERSHELL_URL + sudo mkdir -p /opt/microsoft/powershell/7 + sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 + sudo chmod +x /opt/microsoft/powershell/7/pwsh + sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh + sudo mkdir -p /usr/local/share/powershell/Modules sudo cp -r "$PARENT_PATH"/empire/server/data/Invoke-Obfuscation /usr/local/share/powershell/Modules - rm -f packages-microsoft-prod.deb* } function install_mysql() { @@ -126,35 +116,36 @@ function install_bomutils() { function install_dotnet() { echo -e "\x1b[1;34m[*] Installing dotnet for C# agents and modules\x1b[0m" - if [ $OS_NAME == "UBUNTU" ]; then - wget https://packages.microsoft.com/config/ubuntu/"${VERSION_ID}"/packages-microsoft-prod.deb -O packages-microsoft-prod.deb - sudo dpkg -i packages-microsoft-prod.deb - rm packages-microsoft-prod.deb - - # If version is 22.04, we need to write an /etc/apt/preferences file - # https://github.com/dotnet/core/issues/7699 - if [ "$VERSION_ID" == "22.04" ]; then - echo -e "\x1b[1;34m[*] Detected Ubuntu 22.04, writing /etc/apt/preferences file\x1b[0m" - sudo tee -a /etc/apt/preferences <> ~/.bashrc + echo "export PATH=$PATH:$HOME/dotnet" >> ~/.bashrc + + echo "export DOTNET_ROOT=$HOME/dotnet" >> ~/.zshrc + echo "export PATH=$PATH:$HOME/dotnet" >> ~/.zshrc } function install_nim() { @@ -165,7 +156,8 @@ function install_nim() { read -r answer fi if [ "$answer" != "${answer#[Yy]}" ]; then - sudo apt-get install -y curl git gcc xz-utils + # https://github.com/dom96/choosenim/issues/303 + sudo apt-get install -y curl git gcc xz-utils libcurl4-gnutls-dev export CHOOSENIM_CHOOSE_VERSION=1.6.12 curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y echo "export PATH=$HOME/.nimble/bin:$PATH" >> ~/.bashrc @@ -305,7 +297,7 @@ if ! command_exists pyenv; then libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \ lzma lzma-dev tk-dev uuid-dev zlib1g-dev - pyenv install 3.12.2 + pyenv install 3.12.6 fi if ! command_exists poetry; then