From 9986f4ca65c0f67e36bb03bef3836ce4e8c7b3b7 Mon Sep 17 00:00:00 2001 From: six-two Date: Sat, 31 Aug 2024 20:27:36 +0200 Subject: [PATCH] Added Dockerfile --- .../workflows/publish-docker-container.yaml | 32 +++++++++++++++++++ Dockerfile | 14 ++++++++ README.md | 14 ++++++-- python/self_unzip_html/__init__.py | 4 +-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish-docker-container.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/publish-docker-container.yaml b/.github/workflows/publish-docker-container.yaml new file mode 100644 index 0000000..3c05bf2 --- /dev/null +++ b/.github/workflows/publish-docker-container.yaml @@ -0,0 +1,32 @@ +name: Deploy Images to GHCR + +env: + DOTNET_VERSION: '6.0.x' + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + push-store-image: + runs-on: ubuntu-latest + defaults: + run: + working-directory: './Store' + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@main + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + + - name: 'Build Inventory Image' + run: | + docker build . --tag ghcr.io/six-two/self-unzip-html:latest + docker push ghcr.io/six-two/self-unzip-html:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..54b1ddc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Create a base image +FROM python:slim +LABEL org.opencontainers.image.source="https://github.com/six-two/self-unzip.html" +RUN pip install --no-cache-dir --root-user-action=ignore pycryptodomex + +# Install the app +COPY . /app +RUN pip install --root-user-action=ignore /app + +# Just for convenience / app configuration +WORKDIR /share +VOLUME /share +ENTRYPOINT ["/usr/local/bin/self-unzip-html"] +CMD ["--help"] diff --git a/README.md b/README.md index b071b06..ed2a61b 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,22 @@ python3 -m pip install -U self-unzip-html Example usage of the pip package: ```bash -self-unzip-html -t download -o psexec.html ~/Downloads/SysinternalsSuite/PsExec.exe +self-unzip-html --download -o psexec.html ~/Downloads/SysinternalsSuite/PsExec.exe ``` Or if you wanted to password-protect the output: ```bash -self-unzip-html -t download -o psexec.html -p YourPasswordHere ~/Downloads/SysinternalsSuite/PsExec.exe +self-unzip-html --download -o psexec.html -p YourPasswordHere ~/Downloads/SysinternalsSuite/PsExec.exe +``` + +Alternatively, you can also the `Dockerfile`: +```bash +docker build -t self-unzip-html . +``` + +Usage of docker image: +```bash +docker run --rm -v "$PWD:/share" self-unzip-html --download -o psexec.html ./PsExec.exe ``` You can show all flags with the `--help` flag and can see some example commands in `./test.sh`. diff --git a/python/self_unzip_html/__init__.py b/python/self_unzip_html/__init__.py index 4005cdc..a9c3bee 100755 --- a/python/self_unzip_html/__init__.py +++ b/python/self_unzip_html/__init__.py @@ -175,7 +175,7 @@ def replace_in_template(self, library_code: str, glue_code: str, payload_code: s def main() -> None: # @TODO: Support multiple input files for certain options (download, driveby, etc)? - ap = argparse.ArgumentParser() + ap = argparse.ArgumentParser(description="This tools can create self-decompressing HTML pages, that can be used to minify documents or circumvent web proxy download restrictions and filtering.") # ap_input = ap.add_argument_group("input options") # ap_input_mutex = ap_input.add_mutually_exclusive_group(required=True) ap.add_argument("file", help="the file to encode. Use '-' to read from standard input") @@ -208,7 +208,7 @@ def main() -> None: initial_page_contents_mutex = ap_template.add_mutually_exclusive_group() initial_page_contents_mutex.add_argument("--html", metavar="HTML_STRING", help="the HTML to show when the page is first loaded or if the unpacking fails") initial_page_contents_mutex.add_argument("--html-file", metavar="FILE", help="like --html, but read the contents from the given file") - ap_template.add_argument("--obscure-action", action="store_true", help="obscures the action that is performed decoding and basically evaling the code") + ap_template.add_argument("--obscure-action", action="store_true", help="obscures the action JavaScript code") args = ap.parse_args() if args.quiet: