Skip to content

Commit

Permalink
Merge pull request #74 from irsdl/master
Browse files Browse the repository at this point in the history
improving BF minifier
  • Loading branch information
pwntester authored Apr 23, 2020
2 parents 3a50615 + f1849bd commit 215aae3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ysoserial/Generators/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public const string
NotBridgeNotDerived = "Not bridge or derived",
NotBridgeButDervied = "Not bridge but derived", // Bridge has dervied meaning in it too
BridgeAndDerived = "Bridge and dervied",
Mask = "It relies on other gadgets and is not a real gadget on its own (not really bridged or derived)", // We hide these in normal help as they are only valuable for research purposes - example is ResourceSet
Dummy = "It relies on other gadgets and is not a real gadget on its own (not bridged or derived either)", // We hide these in normal help as they are only valuable for research purposes - example is ResourceSet
None="";
}
}
2 changes: 1 addition & 1 deletion ysoserial/Generators/ResourceSetGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override string Finders()

public override List<string> Labels()
{
return new List<string> { GadgetTypes.Mask }; // It works because we have a hashtable that holds the actual gadget!
return new List<string> { GadgetTypes.Dummy }; // It works because we have a hashtable that holds the actual gadget!
}

public override OptionSet Options()
Expand Down
8 changes: 8 additions & 0 deletions ysoserial/Helpers/BinaryFormatterMinifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ public static string AssemblyOrTypeNameMinifier(string strInput)
strInput = strInput_simpleCorlibAsm;
}

if (strInput.Contains(",mscorlib"))
{
string strInput_removedMSCORLIB = strInput.Replace(",mscorlib", "");

if (IsValid(strInput_removedMSCORLIB, isAssemblyString))
strInput = strInput_removedMSCORLIB;
}

return strInput;
}

Expand Down
6 changes: 6 additions & 0 deletions ysoserial/Helpers/TestingArena/TestingArenaHome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
using ysoserial.Helpers.ModifiedVulnerableBinaryFormatters;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Collections.Specialized;
using System.Reflection;
using System.Windows.Data;
using System.Runtime.Serialization;

namespace ysoserial.Helpers.TestingArena
{
Expand All @@ -36,13 +40,15 @@ public override OptionSet Options()
public void Start(InputArgs inputArgs)
{
this.inputArgs = inputArgs;
// Add your function here perhaps - some examples:
//MinimiseTCDJsonAndRun();
//ManualTCDGPayload4Minifying();
//TextFormatterMinifying();
//ActivitySurrogateSelector();
Console.ReadLine();
}


private void ActivitySurrogateSelector()
{
string myApp = "TestConsoleApp_YSONET";
Expand Down
2 changes: 1 addition & 1 deletion ysoserial/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ private static void ShowHelp()
ObjectHandle container = Activator.CreateInstance(null, "ysoserial.Generators." + g + "Generator");
Generator gg = (Generator)container.Unwrap();

if (gg.Labels().Contains(GadgetTypes.Mask) && !show_fullhelp)
if (gg.Labels().Contains(GadgetTypes.Dummy) && !show_fullhelp)
{
// We hide the Mask gadgets in normal help as they are not that important!
continue;
Expand Down

0 comments on commit 215aae3

Please sign in to comment.