From aa8cb268b074bc19142121479cd525477af92f13 Mon Sep 17 00:00:00 2001 From: Itamai Date: Fri, 19 Jul 2019 19:19:11 +0200 Subject: [PATCH] Added 2 new charsets in randomstring function. --- OpenBullet/Pages/StackerBlocks/PageBlockFunction.xaml.cs | 2 +- RuriLib/Blocks/BlockFunction.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenBullet/Pages/StackerBlocks/PageBlockFunction.xaml.cs b/OpenBullet/Pages/StackerBlocks/PageBlockFunction.xaml.cs index 8d2f188..68067f4 100644 --- a/OpenBullet/Pages/StackerBlocks/PageBlockFunction.xaml.cs +++ b/OpenBullet/Pages/StackerBlocks/PageBlockFunction.xaml.cs @@ -115,7 +115,7 @@ namespace OpenBullet.Pages.StackerBlocks { "Constant", "This will just return anything written in the input string and store it in a variable, after possibly replacing all the input variables.\nUse this to chain constants and variables together." }, { "Hash", "The input string will be hashed with the selected function. Remember you can chain variables if you need a salt." }, { "HMAC", "" }, - { "RandomString", "?l = Lowercase, ?u = Uppercase, ?d = Digit, ?s = Symbol, ?h = Hex (Lowercase), ?a = Any"}, + { "RandomString", "?l = Lowercase, ?u = Uppercase, ?d = Digit, ?s = Symbol, ?h = Hex (Lowercase), ?m = Upper + Digits, ?i = Lower + Upper + Digits, ?a = Any"}, { "Translate", "Format like headers (this: that), one per line." }, { "Compute", "Calculates the value of a math expression, for example (6+3)*5 will return 45." }, { "RSA", "Thanks to TheLittleTrain17 for this implementation" }, diff --git a/RuriLib/Blocks/BlockFunction.cs b/RuriLib/Blocks/BlockFunction.cs index 15b4a8e..ca58824 100644 --- a/RuriLib/Blocks/BlockFunction.cs +++ b/RuriLib/Blocks/BlockFunction.cs @@ -614,13 +614,15 @@ namespace RuriLib break; case Function.RandomString: - var reserved = new string[] { "?l", "?u", "?d", "?s", "?h", "?a" }; + var reserved = new string[] { "?l", "?u", "?d", "?s", "?h", "?a", "?i", "?m" }; var lowercase = "abcdefghijklmnopqrstuvwxyz"; var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var digits = "0123456789"; var symbols = "\\!\"£$%&/()=?^'{}[]@#,;.:-_*+"; var hex = digits + "abcdef"; var allchars = lowercase + uppercase + digits + symbols; + var meinchars = uppercase + digits; + var itachars = lowercase + uppercase + digits; outputString = localInputString; while (reserved.Any(r => outputString.Contains(r))){ @@ -636,6 +638,11 @@ namespace RuriLib outputString = ReplaceFirst(outputString, "?h", hex[data.rand.Next(0, hex.Length)].ToString()); else if (outputString.Contains("?a")) outputString = ReplaceFirst(outputString, "?a", allchars[data.rand.Next(0, allchars.Length)].ToString()); + else if (outputString.Contains("?i")) + outputString = ReplaceFirst(outputString, "?i", itachars[data.rand.Next(0, itachars.Length)].ToString()); + else if (outputString.Contains("?m")) + outputString = ReplaceFirst(outputString, "?m", meinchars[data.rand.Next(0, meinchars.Length)].ToString()); + } break;