diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..ad0b8f2 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,67 @@ +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + +name: Dev + +jobs: + build: + runs-on: windows-latest + defaults: + run: + shell: bash + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + + - name: Restore Dependencies + run: dotnet restore + + - name: Build + run: | + VERSION=${{ github.ref_name }} + dotnet build -c debug + + - name: Zip - Build + run: | + 7z a -tzip -mx9 Inveigh-net3.5-dev.zip $PWD/Inveigh/bin/debug/net35/* + 7z a -tzip -mx9 Inveigh-net4.6.2-dev.zip $PWD/Inveigh/bin/debug/net462/* + 7z a -tzip -mx9 Inveigh-net6.0-dev.zip $PWD/Inveigh/bin/debug/net6.0/* -x!*/ + + - name: Publish - Trimmed/Single File + run: | + VERSION=${{ github.ref_name }} + dotnet publish --self-contained=true -p:PublishSingleFile=true -p:PublishTrimmed=true -r linux-x64 -f net6.0 -p:AssemblyName=inveigh -c debug + dotnet publish --self-contained=true -p:PublishSingleFile=true -p:PublishTrimmed=true -r osx-x64 -f net6.0 -p:AssemblyName=inveigh -c debug + dotnet publish --self-contained=true -p:PublishSingleFile=true -p:PublishTrimmed=true -r win-x64 -f net6.0 -c debug + + - name: Zip - Publish + run: | + tar -czvf Inveigh-net6.0-linux-x64-trimmed-single-dev.tar.gz --directory=$PWD/Inveigh/bin/debug/net6.0/linux-x64/publish/ . + tar -czvf Inveigh-net6.0-osx-x64-trimmed-single-dev.tar.gz --directory=$PWD/Inveigh/bin/debug/net6.0/osx-x64/publish/ . + 7z a -tzip -mx9 Inveigh-net6.0-win-x64-trimmed-single-dev.zip $PWD/Inveigh/bin/debug/net6.0/win-x64/publish/* + + - name: Release .zip + if: "! startsWith(github.event_name, 'pull_request')" + uses: softprops/action-gh-release@v1 + with: + name: Dev Branch Debug Builds + tag_name: development + prerelease: true + files: "Inveigh*.zip" + body: | + Latest ${{ github.ref_name }} branch debug builds (${{ github.sha }}) + + - name: Release tar.gz + uses: softprops/action-gh-release@v1 + with: + tag_name: development + files: "Inveigh*.tar.gz" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b896911..f73107e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,27 +24,29 @@ jobs: - name: Restore Dependencies run: dotnet restore - - name: Build Windows + - name: Build run: | VERSION=${{ github.ref_name }} dotnet build -c release -p:Version=${VERSION:1} - - name: Zip + - name: Zip - Build run: | - 7z a -tzip -mx9 Inveigh-net3.5-win-64-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net35/* - 7z a -tzip -mx9 Inveigh-net4.6.2-win-64-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net462/* - 7z a -tzip -mx9 Inveigh-net6.0-win-64-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net6.0/* -x!*/ + 7z a -tzip -mx9 Inveigh-net3.5-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net35/* + 7z a -tzip -mx9 Inveigh-net4.6.2-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net462/* + 7z a -tzip -mx9 Inveigh-net6.0-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net6.0/* -x!*/ - - name: Publish Linux/macOS + - name: Publish - Trimmed/Single File run: | VERSION=${{ github.ref_name }} dotnet publish --self-contained=true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=${VERSION:1} -r linux-x64 -f net6.0 -p:AssemblyName=inveigh -c release dotnet publish --self-contained=true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=${VERSION:1} -r osx-x64 -f net6.0 -p:AssemblyName=inveigh -c release + dotnet publish --self-contained=true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=${VERSION:1} -r win-x64 -f net6.0 -c release - - name: Zip macOS + - name: Zip - Publish run: | tar -czvf Inveigh-net6.0-linux-x64-trimmed-single-${{ github.ref_name }}.tar.gz --directory=$PWD/Inveigh/bin/release/net6.0/linux-x64/publish/ . tar -czvf Inveigh-net6.0-osx-x64-trimmed-single-${{ github.ref_name }}.tar.gz --directory=$PWD/Inveigh/bin/release/net6.0/osx-x64/publish/ . + 7z a -tzip -mx9 Inveigh-net6.0-win-x64-trimmed-single-${{ github.ref_name }}.zip $PWD/Inveigh/bin/release/net6.0/win-x64/publish/* - name: Release .zip uses: softprops/action-gh-release@v1 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..89ed4dc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "Inveigh/Inveigh/Protocols/Quiddity"] + path = Inveigh/Inveigh/Protocols/Quiddity + url = https://192.168.99.78:3000/kevin/Quiddity.git +[submodule "Inveigh/Protocols/Inveigh/Protocols/Quiddity"] + path = Inveigh/Protocols/Inveigh/Protocols/Quiddity + url = https://192.168.99.78:3000/kevin/Quiddity.git diff --git a/Inveigh/FodyWeavers.xml b/Inveigh/FodyWeavers.xml new file mode 100644 index 0000000..5029e70 --- /dev/null +++ b/Inveigh/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Inveigh/FodyWeavers.xsd b/Inveigh/FodyWeavers.xsd new file mode 100644 index 0000000..05e92c1 --- /dev/null +++ b/Inveigh/FodyWeavers.xsd @@ -0,0 +1,141 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/Inveigh/Inveigh.csproj b/Inveigh/Inveigh.csproj index 17f6db6..7efd2f5 100644 --- a/Inveigh/Inveigh.csproj +++ b/Inveigh/Inveigh.csproj @@ -3,6 +3,7 @@ Exe net35;net462;net6.0 + AnyCPU @@ -29,8 +30,30 @@ + + + all + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + ISNET6_0 + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs index 719eac6..7a17131 100644 --- a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs @@ -295,7 +295,7 @@ internal void ReceiveClient(object parameters) } } - + if (type.Equals("Proxy")) { response.StatusCode = "407"; @@ -326,22 +326,22 @@ internal void ReceiveClient(object parameters) response.WWWAuthenticate = string.Concat("Basic realm=", HTTPRealm); } - if (!string.IsNullOrEmpty(request.Authorization) && (request.Authorization.ToUpper().StartsWith("NTLM ") || request.Authorization.ToUpper().StartsWith("NEGOTIATE ")) || (!string.IsNullOrEmpty(request.ProxyAuthorization)) && request.ProxyAuthorization.ToUpper().StartsWith("NTLM ")) + if (!string.IsNullOrEmpty(request.Authorization) && (request.Authorization.ToUpper().StartsWith("NTLM ") || request.Authorization.ToUpper().StartsWith("NEGOTIATE ")) || (!string.IsNullOrEmpty(request.ProxyAuthorization) && request.ProxyAuthorization.ToUpper().StartsWith("NTLM "))) { string authorization = request.Authorization; - + if (!string.IsNullOrEmpty(request.ProxyAuthorization)) { authorization = request.ProxyAuthorization; } NTLMNegotiate ntlm = new NTLMNegotiate(); - ntlm.ReadBytes(Convert.FromBase64String(request.Authorization.Split(' ')[1]), 0); + ntlm.ReadBytes(Convert.FromBase64String(authorization.Split(' ')[1]), 0); if (ntlm.MessageType == 1) { byte[] timestamp = BitConverter.GetBytes(DateTime.Now.ToFileTime()); - NTLMChallenge challenge = new NTLMChallenge(Challenge, NetbiosDomain, ComputerName, DNSDomain, ComputerName, DNSDomain); + NTLMChallenge challenge = new NTLMChallenge(Challenge, NetbiosDomain, ComputerName, DNSDomain, ComputerName, DNSDomain, timestamp); byte[] challengeData = challenge.GetBytes(ComputerName); ntlmChallenge = BitConverter.ToString(challenge.ServerChallenge).Replace("-", ""); string sessionTimestamp = BitConverter.ToString(timestamp).Replace("-", ""); @@ -387,7 +387,7 @@ internal void ReceiveClient(object parameters) try { - byte[] timestamp = new byte[8]; + byte[] timestamp = new byte[8]; Buffer.BlockCopy(ntlmResponse.NtChallengeResponse, 24, timestamp, 0, 8); string sessionTimestamp = BitConverter.ToString(timestamp).Replace("-", ""); ntlmChallenge = httpSessionTable[sessionTimestamp].ToString(); diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs index a6e3143..70fac9e 100644 --- a/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs @@ -49,6 +49,8 @@ class HTTPRequest public string Accept { get; set; } public string AcceptEncoding { get; set; } public string AcceptLanguage { get; set; } + public string CacheControl { get; set; } + public string ProxyConnection{ get; set; } public string Authorization { get; set; } public string ProxyAuthorization { get; set; } @@ -142,6 +144,10 @@ public void GetField(string field, string value) this.AcceptLanguage = value; break; + case "CACHE-CONTROL:": + this.ProxyConnection = value; + break; + case "AUTHORIZATION:": this.Authorization = value; break; @@ -150,6 +156,10 @@ public void GetField(string field, string value) this.ProxyAuthorization = value; break; + case "PROXY-CONNECTION:": + this.ProxyConnection = value; + break; + } } diff --git a/LICENSE b/LICENSE index 1127b2d..de58429 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2021, Kevin Robertson +Copyright (c) 2022, Kevin Robertson All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 6046448..fc352ec 100644 --- a/README.md +++ b/README.md @@ -38,27 +38,29 @@ Inveigh works with both IPv4 and IPv6 in cases where support for both is provide ## Cross-Platform Support -Inveigh's SDK style project file is setup for .NET 3.5, 4.5, and 5.0 with 5.0 being the version that also works with Linux and macOS. +Inveigh's SDK style project file is setup for .NET 3.5, 4.6.2, and 6.0 with 6.0 being the version that also works with Linux and macOS. -`net35;net45;net5.0` - -Windows is still the primary usage target, however I will attempt to support all platforms for new features going forward. For the most part, Inveigh just worked on all 3 platforms once I converted to an SDK project file. +`net35;net62;net6.0` ### Known Issues * The packet sniffer is available only on Windows due to differences in the raw socket setups. When compiled for either Linux or macOS, the packet sniffer will just be disabled. Instead, Inveigh's SMB listener can be used if port 445 is open. * macOS requires that routes are avalable for joining multicast groups. In my testing, I've had to add routes for DHCPv6 multicast in order to carry out that attack on this platform. `sudo route -nv add -net ff02::1:2 -interface en0` + +### Execution + +`dotnet Inveigh.dll` -### Linux/macOS Compiling +### Linux/macOS Platform Targeted Builds -* With .NET 5.0 installed on target system -`dotnet publish -r linux-x64 -f net5.0 -p:AssemblyName=inveigh` -`dotnet publish -r osx-x64 -f net5.0 -p:AssemblyName=inveigh` +* With .NET 6.0 installed on target system +`dotnet publish -r linux-x64 -f net6.0 -p:AssemblyName=inveigh` +`dotnet publish -r osx-x64 -f net6.0 -p:AssemblyName=inveigh` -* Without .NET 5.0 installed on target system -`dotnet publish --self-contained=true -p:PublishSingleFile=true -r linux-x64 -f net5.0 -p:AssemblyName=inveigh` -`dotnet publish --self-contained=true -p:PublishSingleFile=true -r osx-x64 -f net5.0 -p:AssemblyName=inveigh` +* Without .NET 6.0 installed on target system +`dotnet publish --self-contained=true -p:PublishSingleFile=true -r linux-x64 -f net6.0 -p:AssemblyName=inveigh` +`dotnet publish --self-contained=true -p:PublishSingleFile=true -r osx-x64 -f net6.0 -p:AssemblyName=inveigh` ## Usage