diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe index ccb2979c..7d8aeb30 100644 Binary files a/.nuget/NuGet.exe and b/.nuget/NuGet.exe differ diff --git a/Baml/Baml.csproj b/Baml/Baml.csproj index 57164b5a..9deab8c6 100644 --- a/Baml/Baml.csproj +++ b/Baml/Baml.csproj @@ -1,46 +1,9 @@ - - - + + - Debug - AnyCPU - {25EE08C8-0C9D-49E3-86FE-A331E9D4F12A} - Library - Properties - Baml - Baml - v4.0 - 512 - Client + net45 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - + CecilDependencyPropertyDescriptor.cs @@ -111,21 +74,10 @@ XmlToClrNamespaceMapping.cs - - - + - - 0.10.1 - + - - + \ No newline at end of file diff --git a/Baml/Properties/AssemblyInfo.cs b/Baml/Properties/AssemblyInfo.cs index 069af9b6..8e4d0a3c 100644 --- a/Baml/Properties/AssemblyInfo.cs +++ b/Baml/Properties/AssemblyInfo.cs @@ -5,11 +5,7 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Baml")] [assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Baml")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +28,3 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Console/Obfuscar.Console.csproj b/Console/Obfuscar.Console.csproj index 82943207..e4237fc7 100644 --- a/Console/Obfuscar.Console.csproj +++ b/Console/Obfuscar.Console.csproj @@ -102,7 +102,7 @@ 5.3.0.1 - 2.0.0 + 2.0.1 diff --git a/Console/Program.cs b/Console/Program.cs index c6d2f248..0829403b 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -43,7 +43,7 @@ internal static class Program private static void ShowHelp(OptionSet optionSet) { Console.WriteLine("Obfuscar is available at https://www.obfuscar.com"); - Console.WriteLine("(C) 2007-2017, Ryan Williams and other contributors."); + Console.WriteLine("(C) 2007-2018, Ryan Williams and other contributors."); Console.WriteLine(); Console.WriteLine("obfuscar [Options] [project_file] [project_file]"); Console.WriteLine("Options:"); diff --git a/GlobalTools/GlobalTools.csproj b/GlobalTools/GlobalTools.csproj new file mode 100644 index 00000000..1dbef5e1 --- /dev/null +++ b/GlobalTools/GlobalTools.csproj @@ -0,0 +1,37 @@ + + + + Exe + netcoreapp2.1 + + true + obfuscar + .. + + Obfuscar.GlobalTool + 1.0.0-beta3 + Ryan Williams, and other contributors. + LeXtudio + Obfuscar Global Tools build + Obfuscar is a basic obfuscator for .NET assemblies. It uses massive overloading to rename metadata in .NET assemblies (including the names of methods, properties, events, fields, types and namespaces) to a minimal set, distinguishable in most cases only by signature. + https://github.com/obfuscar/obfuscar/releases + https://github.com/obfuscar/obfuscar + https://github.com/obfuscar/obfuscar + https://github.com/obfuscar/obfuscar/raw/master/Potion-icon.png + https://github.com/obfuscar/obfuscar/blob/master/LICENSE + Copyright (c) 2007 Ryan Williams Copyright (c) 2009-2018 Calvin Rien, Lex Li, RemObjects and other contributors + git + obfuscar,obfuscation + 1.0.0.1 + 1.0.0.1 + + + + + + + + + + + diff --git a/GlobalTools/Program.cs b/GlobalTools/Program.cs new file mode 100644 index 00000000..20963009 --- /dev/null +++ b/GlobalTools/Program.cs @@ -0,0 +1,161 @@ +#region Copyright (c) 2007 Ryan Williams + +/// +/// Copyright (c) 2007 Ryan Williams +/// +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Reflection; +using System.Threading.Tasks; +using Mono.Options; +using Rollbar; +using Rollbar.DTOs; + +namespace Obfuscar +{ + [SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1027:TabsMustNotBeUsed", Justification = + "Reviewed. Suppression is OK here.")] + internal static class Program + { + private static void ShowHelp(OptionSet optionSet) + { + Console.WriteLine("Obfuscar for .NET Core is available at https://www.obfuscar.com"); + Console.WriteLine("(C) 2007-2018, Ryan Williams and other contributors."); + Console.WriteLine(); + Console.WriteLine("obfuscar [Options] [project_file] [project_file]"); + Console.WriteLine("Options:"); + optionSet.WriteOptionDescriptions(Console.Out); + } + + [SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1027:TabsMustNotBeUsed", Justification = + "Reviewed. Suppression is OK here.")] + private static int Main(string[] args) + { + bool showHelp = false; + bool showVersion = false; + bool suppress = false; + + OptionSet p = new OptionSet() + .Add("h|?|help", "Print this help information.", delegate (string v) { showHelp = v != null; }) + .Add("s|suppress", "Suppress Rollbar crash report.", delegate (string v) { suppress = v != null; }) + .Add("V|version", "Display version number of this application.", + delegate (string v) { showVersion = v != null; }); + + if (args.Length == 0) + { + ShowHelp(p); + return 0; + } + + List extra; + try + { + extra = p.Parse(args); + } + catch (OptionException ex) + { + Console.WriteLine(ex.Message); + return 1; + } + + if (showHelp) + { + ShowHelp(p); + return 0; + } + + if (showVersion) + { + Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Version); + return 0; + } + + if (extra.Count < 1) + { + ShowHelp(p); + return 1; + } + + if (!suppress) + { + RegisterRollbar(); + } + + int start = Environment.TickCount; + foreach (var project in extra) + { + try + { + Console.Write("Loading project {0}...", project); + Obfuscator obfuscator = new Obfuscator(project); + Console.WriteLine("Done."); + + obfuscator.RunRules(); + + Console.WriteLine("Completed, {0:f2} secs.", (Environment.TickCount - start) / 1000.0); + } + catch (ObfuscarException e) + { + Console.WriteLine(); + Console.Error.WriteLine("An error occurred during processing:"); + Console.Error.WriteLine(e.Message); + if (e.InnerException != null) + Console.Error.WriteLine(e.InnerException.Message); + return 1; + } + } + + return 0; + } + + private static void RegisterRollbar() + { + Console.WriteLine("Note that Rollbar API is enabled by default to collect crashes. If you want to opt out, please run with -s switch"); + var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + RollbarLocator.RollbarInstance.Configure( + new RollbarConfig("1dd3cf880c5a46eeb4338dbea73f9620") + { + Environment = "production", + Transform = payload => + { + payload.Data.Person = new Person(version) + { + UserName = $"{version}" + }; + } + }); + + AppDomain.CurrentDomain.UnhandledException += (sender, args) => + { + RollbarLocator.RollbarInstance.Error(args.ExceptionObject as System.Exception); + }; + + TaskScheduler.UnobservedTaskException += (sender, args) => + { + RollbarLocator.RollbarInstance.Error(args.Exception); + }; + } + } +} diff --git a/Obfuscar.nuspec b/Obfuscar.nuspec index cd2d29db..5b02e53e 100644 --- a/Obfuscar.nuspec +++ b/Obfuscar.nuspec @@ -8,7 +8,7 @@ https://www.obfuscar.com Obfuscar Obfuscar - http://lextudio.com/images/obfuscar32.png + https://github.com/obfuscar/obfuscar/raw/master/Potion-icon.png true Obfuscar is a basic obfuscator for .NET assemblies. It uses massive overloading to rename metadata in .NET assemblies (including the names of methods, properties, events, fields, types and namespaces) to a minimal set, distinguishable in most cases only by signature. Open source obfuscar for .NET and Mono. diff --git a/Obfuscar.sln b/Obfuscar.sln index 31984713..a91f21c3 100644 --- a/Obfuscar.sln +++ b/Obfuscar.sln @@ -1,14 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28407.52 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{65D27ECD-E8FC-47CB-8CB0-819627673662}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.exe = .nuget\NuGet.exe EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Obfuscar", "Obfuscar\Obfuscar.csproj", "{F28CDDFF-5A7A-413E-809E-15FFB8766E86}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Obfuscar", "Obfuscar\Obfuscar.csproj", "{F28CDDFF-5A7A-413E-809E-15FFB8766E86}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Obfuscar.Console", "Console\Obfuscar.Console.csproj", "{275B3EED-7E70-4460-950F-96EDCA099BD4}" EndProject @@ -29,6 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution test.bat = test.bat EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GlobalTools", "GlobalTools\GlobalTools.csproj", "{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -141,6 +143,30 @@ Global {25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU {25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}.winphone_Release|Any CPU.ActiveCfg = Release|Any CPU {25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}.winphone_Release|Any CPU.Build.0 = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Release|Any CPU.ActiveCfg = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Release|Any CPU.Build.0 = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Release|Any CPU.ActiveCfg = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Release|Any CPU.Build.0 = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Release|Any CPU.ActiveCfg = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Release|Any CPU.Build.0 = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Release|Any CPU.Build.0 = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Release|Any CPU.ActiveCfg = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Release|Any CPU.Build.0 = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Release|Any CPU.ActiveCfg = Release|Any CPU + {BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Obfuscar/Obfuscar.csproj b/Obfuscar/Obfuscar.csproj index c07f113a..27a3afb6 100644 --- a/Obfuscar/Obfuscar.csproj +++ b/Obfuscar/Obfuscar.csproj @@ -1,135 +1,17 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {F28CDDFF-5A7A-413E-809E-15FFB8766E86} - Library - Properties - Obfuscar - Obfuscar - - - - - 3.5 - v4.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true + netcoreapp2.1;net45 - - True - full - False - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - True - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - + - - {25ee08c8-0c9d-49e3-86fe-a331e9d4f12a} - Baml - + + - - 0.10.1 - + + + - - + \ No newline at end of file diff --git a/Obfuscar/Obfuscator.cs b/Obfuscar/Obfuscator.cs index 199ec18d..c2caeb90 100644 --- a/Obfuscar/Obfuscator.cs +++ b/Obfuscar/Obfuscator.cs @@ -35,16 +35,15 @@ using System.Text; using System.Text.RegularExpressions; using System.Xml.Linq; -#if !__MonoCS__ +#if !NETCOREAPP2_1 using ILSpy.BamlDecompiler; #endif using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Cecil.Rocks; using Obfuscar.Helpers; -#if !__MonoCS__ +#if !NETCOREAPP2_1 using Ricciolo.StylesExplorer.MarkupReflection; - #endif namespace Obfuscar @@ -229,7 +228,11 @@ public void SaveAssemblies(bool throwException = true) try { var publicKey = strongNameKeyPair.PublicKey; +#if NETCOREAPP2_1 + throw new PlatformNotSupportedException("Signing is not supported in .NET Core Global Tools build"); +#else parameters.StrongNameKeyPair = strongNameKeyPair; +#endif info.Definition.Write(outName, parameters); } catch (ArgumentException) @@ -698,7 +701,7 @@ private List GetXamlDocuments(AssemblyDefinition library) try { -#if !__MonoCS__ +#if !NETCOREAPP2_1 using (var bamlReader = new XmlBamlReader(stream, new CecilTypeResolver(Project.Cache, library))) result.Add(XDocument.Load(bamlReader)); diff --git a/Obfuscar/Properties/AssemblyInfo.cs b/Obfuscar/Properties/AssemblyInfo.cs index 30fd957f..41d87097 100644 --- a/Obfuscar/Properties/AssemblyInfo.cs +++ b/Obfuscar/Properties/AssemblyInfo.cs @@ -33,10 +33,7 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Obfuscar")] [assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright © Ryan Williams 2007-2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/ilspy b/ilspy index 60726e97..1cd74fb3 160000 --- a/ilspy +++ b/ilspy @@ -1 +1 @@ -Subproject commit 60726e97e96f0eb966ae720e9bb60a7de97932c0 +Subproject commit 1cd74fb367998061369a447047e44e6b50bad760 diff --git a/release.ps1 b/release.ps1 index 7563c1f0..da7b6d51 100644 --- a/release.ps1 +++ b/release.ps1 @@ -1,5 +1,5 @@ Install-Module VSSetup -Scope CurrentUser -Force -$instance = Get-VSSetupInstance -All | Select-VSSetupInstance -Require 'Microsoft.Component.MSBuild' -Latest +$instance = Get-VSSetupInstance -All $installDir = $instance.installationPath $msBuild = $installDir + '\MSBuild\15.0\Bin\MSBuild.exe' if (![System.IO.File]::Exists($msBuild)) diff --git a/sign.ps1 b/sign.ps1 index f6ed2233..1af3bcc7 100644 --- a/sign.ps1 +++ b/sign.ps1 @@ -22,6 +22,10 @@ $nuget = ".\.nuget\nuget.exe" & $nuget update /self | Write-Debug & $nuget pack +Set-Location .\GlobalTools +& dotnet pack +Set-Location .. + Write-Host "Sign NuGet packages." & $nuget sign *.nupkg -CertificateSubjectName "Yang Li" -Timestamper http://timestamp.digicert.com | Write-Debug & $nuget verify -All *.nupkg | Write-Debug