From c561b197a41b455ab399cd6708ea489de0a7eabd Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Mon, 7 Jul 2025 14:45:55 +0200 Subject: [PATCH] Add Docker containers for ILSpyCmd (interactive & automation scenarios) --- ICSharpCode.ILSpyCmd/AsContainer/Dockerfile | 12 +++++++++++ .../AsContainer/DockerfileForAutomation | 12 +++++++++++ ICSharpCode.ILSpyCmd/AsContainer/README.md | 20 +++++++++++++++++++ .../ICSharpCode.ILSpyCmd.csproj | 6 ++++++ 4 files changed, 50 insertions(+) create mode 100644 ICSharpCode.ILSpyCmd/AsContainer/Dockerfile create mode 100644 ICSharpCode.ILSpyCmd/AsContainer/DockerfileForAutomation create mode 100644 ICSharpCode.ILSpyCmd/AsContainer/README.md diff --git a/ICSharpCode.ILSpyCmd/AsContainer/Dockerfile b/ICSharpCode.ILSpyCmd/AsContainer/Dockerfile new file mode 100644 index 000000000..ae04ae30a --- /dev/null +++ b/ICSharpCode.ILSpyCmd/AsContainer/Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 + +RUN useradd -m -s /bin/bash ilspy +USER ilspy + +WORKDIR /home/ilspy + +RUN dotnet tool install -g ilspycmd --version 9.1.0.7988 + +RUN echo 'export PATH="$PATH:/home/ilspy/.dotnet/tools/"' >> /home/ilspy/.bashrc + +ENTRYPOINT [ "/bin/bash" ] \ No newline at end of file diff --git a/ICSharpCode.ILSpyCmd/AsContainer/DockerfileForAutomation b/ICSharpCode.ILSpyCmd/AsContainer/DockerfileForAutomation new file mode 100644 index 000000000..98c81210b --- /dev/null +++ b/ICSharpCode.ILSpyCmd/AsContainer/DockerfileForAutomation @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 + +RUN useradd -m -s /bin/bash ilspy +USER ilspy + +WORKDIR /home/ilspy + +RUN dotnet tool install -g ilspycmd --version 9.1.0.7988 + +RUN echo 'export PATH="$PATH:/home/ilspy/.dotnet/tools/"' >> /home/ilspy/.bashrc + +ENTRYPOINT [ "/bin/bash", "-l", "-c" ] \ No newline at end of file diff --git a/ICSharpCode.ILSpyCmd/AsContainer/README.md b/ICSharpCode.ILSpyCmd/AsContainer/README.md new file mode 100644 index 000000000..5dbca7ce7 --- /dev/null +++ b/ICSharpCode.ILSpyCmd/AsContainer/README.md @@ -0,0 +1,20 @@ +# ILSpyCmd in Docker + +Inspired by https://trustedsec.com/blog/hunting-deserialization-vulnerabilities-with-claude (and thus https://github.com/berdav/ilspycmd-docker) + +## Building the Image + +There are two dockerfiles available - one for interactive use of ilspycmd (exploration), and the other for driving it from the outside (automation) + +### Interactive + +`docker build -t ilspycmd:91interactive . -f Dockerfile` + +`docker run --rm -it -v ./:/docker ilspycmd:91interactive` + +### Automation + +`docker build -t ilspycmd:91forautomation . -f DockerfileForAutomation` + +`docker run --rm -v ./:/infolder -v ./out:/outfolder ilspycmd:91forautomation "/home/ilspy/.dotnet/tools/ilspycmd -p -o /outfolder /infolder/sample.dll"` + diff --git a/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj b/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj index 528650279..c97313f7f 100644 --- a/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj +++ b/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj @@ -28,6 +28,12 @@ ILSpy Team + + + + + +