├── Dockerfiles ├── Dockerfile_podman └── Dockerfile_docker ├── README.md ├── entrypoint.sh └── tools.txt /Dockerfiles/Dockerfile_podman: -------------------------------------------------------------------------------- 1 | FROM docker.io/library/mono:latest 2 | 3 | RUN apt-get update && apt-get install -y git 4 | 5 | VOLUME /data 6 | 7 | COPY entrypoint.sh /entrypoint.sh 8 | COPY tools.txt /tools.txt 9 | 10 | RUN chmod +x /entrypoint.sh 11 | 12 | ENTRYPOINT ["/entrypoint.sh"] 13 | -------------------------------------------------------------------------------- /Dockerfiles/Dockerfile_docker: -------------------------------------------------------------------------------- 1 | FROM mono:latest 2 | 3 | RUN apt-get update && apt-get install -y git 4 | 5 | VOLUME /data 6 | 7 | COPY entrypoint.sh /entrypoint.sh 8 | COPY tools.txt /tools.txt 9 | 10 | RUN chmod +x /entrypoint.sh 11 | 12 | ENV DOTNET_CLI_HOME=/home/runner 13 | ENV XDG_DATA_HOME=/home/runner 14 | 15 | RUN useradd -ms /bin/bash runner 16 | USER runner 17 | 18 | ENTRYPOINT ["/entrypoint.sh"] 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CompileCSDocker 2 | Tired of booting your whole Windows VM just to compile that one tool ? 3 | Just run `csb YourTool` from Linux with any of the ones listed below. 4 | 5 | _Your favourite tool is missing ?_ Just run `csb https://git/YourFavouriteTool.git`, if it compiles then contributions are welcome 6 | 7 | Example run : 8 | 9 | ![image](https://github.com/dreamkinn/CompileCSDocker/assets/55366132/6bfc45b1-5b99-4b18-a59c-a5eb5f12ec69) 10 | 11 | ## Build and Installation 12 | Choose if you want to build for docker or podman 13 | ### Docker build 14 | ``` 15 | # Docker 16 | ./build.sh docker 17 | ``` 18 | 19 | ### Podman build 20 | ``` 21 | # Podman 22 | ./build.sh podman 23 | ``` 24 | 25 | You can set an alias in your .bashrc 26 | ``` 27 | alias csb="docker run -it -v $(pwd):/data --rm csbuild" 28 | # or 29 | alias csb="podman run -it -v $(pwd):/data --rm csbuild" 30 | ``` 31 | ## Usage 32 | ``` 33 | # With alias 34 | csb SharpHound 35 | # or 36 | csb "https://github.com/BloodHoundAD/SharpHound" 37 | 38 | # Without alias 39 | docker run -it -v $(pwd):/data --rm csbuild "https://github.com/BloodHoundAD/SharpHound" 40 | ``` 41 | Some other tools are available in `-l` but don't compile out-of-the-box. 42 | The initial tools list comes from @Aetsu's nice project OffensivePipeline : https://github.com/Aetsu/OffensivePipeline 43 | ## Compiling Out-of-the-box 44 | ``` 45 | ADCollector 46 | ADCSPwn 47 | ADFSDump 48 | ADSearch 49 | BadPotato 50 | BetterSafetyKatz 51 | DeployPrinterNightmare 52 | ForgeCert 53 | Internal-Monologue 54 | LockLess 55 | MinidumpParser 56 | NativeDump 57 | RDPThiefInject 58 | RunasCS 59 | SafetyKatz 60 | SauronEye 61 | SharpAppLocker 62 | SharpBypassUAC 63 | SharpChisel 64 | SharpChisel 65 | SharpChromium 66 | SharpCloud 67 | SharpCOM 68 | SharpCrashEventLog 69 | SharpDir 70 | SharpDump 71 | SharpEDRChecker 72 | SharpEfsPotato 73 | SharpExec 74 | SharpHandler 75 | SharpHound 76 | SharpImpersonation 77 | SharpKatz 78 | SharpLAPS 79 | SharpMiniDump 80 | SharpNamedPipePTH 81 | SharpNoPSExec 82 | SharpPrinter 83 | SharpProcessDump 84 | SharpReg 85 | SharpScribbles 86 | SharpSearch 87 | SharpSecDump 88 | SharpShares 89 | Sharp-SMBExec 90 | SharpSQLPwn 91 | SharpSvc 92 | SharpTask 93 | SharpUnhooker 94 | SharpUp 95 | SharpVeeamDecryptor 96 | SharpWebServer 97 | SharpWifiGrabber 98 | SharpWMI 99 | Shhmon 100 | SqlClient 101 | SweetPotato 102 | ThreatCheck 103 | TokenStomp 104 | TruffleSnout 105 | Watson 106 | WMIReg 107 | ``` 108 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -eq 0 ] || [ "$#" -ne 1 ]; then 4 | echo -e "\e[31m[!] Please provide an URL or tool name.\e[0m" 5 | echo -e "\e[32mUsage :\e[0m" 6 | echo -e "\e[32mcsb -l Print all tools\e[0m" 7 | echo -e "\e[32mcsb SharpHound Try to compile known tool\e[0m" 8 | echo -e "\e[32mcsb https://git/tool.git Try to compile unknown tool\e[0m" 9 | exit 10 | fi 11 | 12 | if [ "$1" == "-l" ]; then 13 | cat tools.txt 14 | exit 15 | fi 16 | 17 | url="$1" 18 | re_url='(https?)://*' 19 | if [[ ! $1 =~ $re_url ]]; then 20 | while IFS= read -r line; do 21 | tool=`echo $line | awk '{print $1}'` 22 | if [[ "$1" == $tool ]]; then 23 | url=`echo $line | awk '{print $2}'` 24 | echo -e "\e[32m[+] Found tool $1 at $url\e[0m" 25 | break 26 | fi 27 | done < tools.txt 28 | fi 29 | 30 | cd /data 31 | 32 | # Clone the repository 33 | repo_name=$(basename $url .git) 34 | if [ -d "$repo_name" ]; then 35 | echo -e "\033[38;5;208m[+] Skipping cloning, $repo_name already exists\033[0m" 36 | else 37 | echo -e "\e[32m[+] Cloning in $repo_name\e[0m" 38 | git clone $url || exit 1 39 | fi 40 | 41 | cd $repo_name 42 | 43 | # Find the .sln file 44 | sln_try=$(find . -name "*.sln" | wc -l) 45 | if [ $sln_try -eq 0 ]; then 46 | echo -e "\e[31m[!] No .sln file found, trying 'the technique of the sauvage'\e[0m" 47 | if [ -f "$repo_name.cs" ]; then 48 | echo -e "\e[32m[+] Found $repo_name.cs, trying to compile with csc...\e[0m" 49 | csc $repo_name.cs && echo -e "\e[32m[+] Compilation successful\e[0m" && exit 0 50 | exit 1 51 | elif [ -f "Program.cs" ]; then 52 | echo -e "\e[32m[+] Found Program.cs, trying to compile with csc...\e[0m" 53 | csc Program.cs && echo -e "\e[32m[+] Compilation successful\e[0m" && exit 0 54 | exit 1 55 | else 56 | echo -e "\e[31m[!] No $repo_name.cs or Program.cs file found\e[0m" && exit 0 57 | exit 1 58 | fi 59 | fi 60 | 61 | 62 | sln_build() { 63 | sln_path="$1" 64 | repo_name="$2" 65 | 66 | if [ -n "$sln_path" ]; then 67 | sln_file=$(basename $sln_path) 68 | fi 69 | 70 | echo -e "\e[32m[+] Found $sln_path, attempting build...\e[0m" 71 | 72 | # Run nuget restore 73 | echo -e "\e[32m[+] Running nuget restore for packages\e[0m" 74 | if nuget restore "$sln_path" 1>/dev/null; then 75 | echo -e "\e[32m[+] NuGet restore successful\e[0m" 76 | else 77 | echo -e "\e[31m[!] Error occurred during NuGet restore\e[0m" 78 | return 79 | fi 80 | 81 | cd /data/$repo_name 82 | 83 | # If there is a .sln file, go to the directory, run nuget restore, and then run msbuild giving the path to sln file 84 | if [ -n "$sln_file" ]; then 85 | if msbuild $sln_path -t:Rebuild -p:Configuration=Release -verbosity:quiet; then 86 | echo -e "\e[32m[+] Compilation successful\e[0m" 87 | else 88 | echo -e "\e[31m[!] Compilation failed\e[0m" 89 | return 90 | fi 91 | fi 92 | } 93 | 94 | # Get all .sln and build 95 | readarray -d '' array < <(find . -name "*.sln" -print0) 96 | 97 | for i in ${array[@]}; do 98 | sln_build $i $repo_name 99 | ret+=$((ret + $?)) 100 | done 101 | -------------------------------------------------------------------------------- /tools.txt: -------------------------------------------------------------------------------- 1 | 2 | ADCollector https://github.com/dev-2null/ADCollector 3 | ADCSPwn https://github.com/bats3c/ADCSPwn 4 | ADFSDump https://github.com/mandiant/ADFSDump 5 | ADSearch https://github.com/tomcarver16/ADSearch 6 | BadPotato https://github.com/S3cur3Th1sSh1t/BadPotato 7 | BetterSafetyKatz https://github.com/Flangvik/BetterSafetyKatz 8 | Certify https://github.com/GhostPack/Certify 9 | DeployPrinterNightmare https://github.com/Flangvik/DeployPrinterNightmare 10 | EDD https://github.com/FortyNorthSecurity/EDD 11 | ForgeCert https://github.com/GhostPack/ForgeCert 12 | Group3r https://github.com/Group3r/Group3r 13 | Internal-Monologue https://github.com/S3cur3Th1sSh1t/Internal-Monologue 14 | KrbRelay https://github.com/cube0x0/KrbRelay 15 | KrbRelayUp https://github.com/Dec0ne/KrbRelayUp 16 | LockLess https://github.com/GhostPack/LockLess 17 | MinidumpParser https://github.com/ricardojoserf/MinidumpParser 18 | NativeDump https://github.com/ricardojoserf/NativeDump 19 | PassTheCert https://github.com/AlmondOffSec/PassTheCert 20 | PurpleSharp https://github.com/mvelazc0/PurpleSharp 21 | RDPThiefInject https://github.com/S3cur3Th1sSh1t/RDPThiefInject 22 | Rubeus https://github.com/GhostPack/Rubeus 23 | RunasCS https://github.com/antonioCoco/RunasCs 24 | SafetyKatz https://github.com/GhostPack/SafetyKatz 25 | SauronEye https://github.com/vivami/SauronEye 26 | SearchOutlook https://github.com/RedLectroid/SearchOutlook 27 | Seatbelt https://github.com/GhostPack/Seatbelt 28 | SharpAppLocker https://github.com/Flangvik/SharpAppLocker 29 | SharpBypassUAC https://github.com/FatRodzianko/SharpBypassUAC 30 | SharpChisel C# Wrapper of Chisel from https://github.com/jpillora/chisel 31 | SharpChisel https://github.com/shantanu561993/SharpChisel 32 | SharpChromium https://github.com/djhohnstein/SharpChromium 33 | SharpCloud https://github.com/chrismaddalena/SharpCloud 34 | SharpCOM https://github.com/rvrsh3ll/SharpCOM 35 | SharpCookieMonster https://github.com/m0rv4i/SharpCookieMonster 36 | SharpCrashEventLog https://github.com/slyd0g/SharpCrashEventLog 37 | SharpDir https://github.com/jnqpblc/SharpDir 38 | SharpDPAPI https://github.com/GhostPack/SharpDPAPI 39 | SharpDump https://github.com/GhostPack/SharpDump 40 | SharpEDRChecker https://github.com/PwnDexter/SharpEDRChecker 41 | SharpEfsPotato https://github.com/bugch3ck/SharpEfsPotato 42 | SharPersist https://github.com/mandiant/SharPersist 43 | SharpExec https://github.com/anthemtotheego/SharpExec 44 | SharpGPOAbuse https://github.com/FSecureLABS/SharpGPOAbuse 45 | SharpHandler https://github.com/jfmaes/SharpHandler 46 | SharpHose https://github.com/ustayready/SharpHose 47 | SharpHound https://github.com/BloodHoundAD/SharpHound 48 | SharpImpersonation https://github.com/S3cur3Th1sSh1t/SharpImpersonation 49 | SharpKatz https://github.com/b4rtik/SharpKatz 50 | SharpLAPS https://github.com/swisskyrepo/SharpLAPS 51 | SharpMapExec https://github.com/cube0x0/SharpMapExec 52 | SharpMiniDump https://github.com/b4rtik/SharpMiniDump 53 | SharpMove https://github.com/0xthirteen/SharpMove 54 | SharpNamedPipePTH https://github.com/S3cur3Th1sSh1t/SharpNamedPipePTH 55 | SharpNoPSExec https://github.com/juliourena/SharpNoPSExec 56 | SharpPrinter https://github.com/rvrsh3ll/SharpPrinter 57 | SharpProcessDump https://github.com/ricardojoserf/SharpProcessDump 58 | SharpRDP https://github.com/0xthirteen/SharpRDP 59 | SharpReg https://github.com/jnqpblc/SharpReg 60 | SharpSCCM https://github.com/Mayyhem/SharpSCCM 61 | SharpScribbles https://github.com/V1V1/SharpScribbles 62 | SharpSearch https://github.com/djhohnstein/SharpSearch 63 | SharpSecDump https://github.com/G0ldenGunSec/SharpSecDump 64 | SharpShares https://github.com/djhohnstein/SharpShares 65 | Sharp-SMBExec https://github.com/checkymander/Sharp-SMBExec 66 | SharpSniper https://github.com/HunnicCyber/SharpSniper 67 | SharpSphere https://github.com/JamesCooteUK/SharpSphere 68 | SharpSpray https://github.com/jnqpblc/SharpSpray 69 | SharpSQLPwn https://github.com/lefayjey/SharpSQLPwn 70 | SharpStay https://github.com/0xthirteen/SharpStay 71 | SharpSvc https://github.com/jnqpblc/SharpSvc 72 | SharpTask https://github.com/jnqpblc/SharpTask 73 | SharpUnhooker https://github.com/S3cur3Th1sSh1t/SharpUnhooker 74 | SharpUp https://github.com/GhostPack/SharpUp 75 | SharpVeeamDecryptor https://github.com/S3cur3Th1sSh1t/SharpVeeamDecryptor 76 | SharpView https://github.com/tevora-threat/SharpView 77 | SharpWebServer https://github.com/mgeeky/SharpWebServer 78 | SharpWifiGrabber https://github.com/r3nhat/SharpWifiGrabber 79 | SharpWMI https://github.com/GhostPack/SharpWMI 80 | SharpZeroLogon https://github.com/nccgroup/nccfsas 81 | Shhmon https://github.com/matterpreter/Shhmon 82 | Snaffler https://github.com/SnaffCon/Snaffler 83 | SqlClient https://github.com/FortyNorthSecurity/SqlClient 84 | StandIn https://github.com/FuzzySecurity/StandIn 85 | SweetPotato https://github.com/CCob/SweetPotato 86 | ThreatCheck https://github.com/rasta-mouse/ThreatCheck 87 | TokenStomp https://github.com/MartinIngesen/TokenStomp 88 | TruffleSnout https://github.com/dsnezhkov/TruffleSnout 89 | Watson https://github.com/rasta-mouse/Watson 90 | Whisker https://github.com/eladshamir/Whisker 91 | winPEAS https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite 92 | WMIReg https://github.com/airzero24/WMIReg 93 | --------------------------------------------------------------------------------