From cc24db3ff51ac9830df926faed86639f6f3a069c Mon Sep 17 00:00:00 2001 From: makikvues Date: Tue, 2 Feb 2021 17:48:06 +0100 Subject: [PATCH] - cleanup & updates --- winPEAS/winPEASexe/NotUsed.ruleset | 343 --------- .../winPEAS/3rdParty/MicroJson/JsonParser.cs | 541 -------------- .../3rdParty/MicroJson/JsonSerializer.cs | 664 ------------------ .../winPEAS/3rdParty/MicroJson/README.md | 66 -- .../Watson/VulnerabilityCollection.cs | 13 +- .../winPEAS/3rdParty/Watson/Watson.cs | 28 +- winPEAS/winPEASexe/winPEAS/Checks/Checks.cs | 7 - .../winPEASexe/winPEAS/Checks/FilesInfo.cs | 4 + .../winPEASexe/winPEAS/Checks/NetworkInfo.cs | 8 +- .../winPEASexe/winPEAS/Checks/SystemInfo.cs | 14 +- .../winPEASexe/winPEAS/Helpers/Beaprint.cs | 1 - .../winPEAS/Helpers/Search/SearchHelper.cs | 12 + .../Info/NetworkInfo/NetworkConnection.cs | 12 +- .../Info/SystemInfo/NamedPipes/NamedPipes.cs | 15 +- .../Browsers/Decryptor/GCDecryptor.cs | 4 +- 15 files changed, 65 insertions(+), 1667 deletions(-) delete mode 100644 winPEAS/winPEASexe/NotUsed.ruleset delete mode 100644 winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonParser.cs delete mode 100644 winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonSerializer.cs delete mode 100644 winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/README.md diff --git a/winPEAS/winPEASexe/NotUsed.ruleset b/winPEAS/winPEASexe/NotUsed.ruleset deleted file mode 100644 index 175e55b..0000000 --- a/winPEAS/winPEASexe/NotUsed.ruleset +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonParser.cs b/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonParser.cs deleted file mode 100644 index a06c0f0..0000000 --- a/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonParser.cs +++ /dev/null @@ -1,541 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; - -namespace winPEAS._3rdParty.MicroJson -{ - // - // JsonParser.cs - // - // Author: - // Michael Ganss - // - // Copyright (c) 2011 Michael Ganss - // - // 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. - namespace MicroJson - { -#pragma warning disable 1591 - public class ParserException : Exception - { - public int Line { get; private set; } - public int Column { get; private set; } - - public ParserException(string msg, int line, int col) - : base(msg) - { - Line = line; - Column = col; - } - } - - public interface ILogger - { - void WriteLine(string message, params object[] arguments); - } - - public class TextWriterLogger : ILogger - { - public TextWriter Writer { get; set; } - - public TextWriterLogger(TextWriter writer) - { - Writer = writer; - } - - public void WriteLine(string message, params object[] arguments) - { - if (arguments != null && arguments.Length > 0) - Writer.WriteLine(message, arguments); - else - Writer.WriteLine(message); - } - } -#pragma warning restore 1591 - - /// - /// Parses JSON into POCOs. - /// - public class JsonParser - { - string Input { get; set; } - int InputLength { get; set; } - int Pos { get; set; } - int Line { get; set; } - int Col { get; set; } - - /// - /// Gets or sets the logger. - /// - /// - /// The logger. - /// - public ILogger Logger { get; set; } - - /// - /// Gets or sets a value indicating whether to collect line info during parsing. - /// - /// - /// true if line info should be collected during parsing; otherwise, false. - /// - public bool CollectLineInfo { get; set; } - - /// - /// Parse the specified JSON text. - /// - /// - /// The JSON text to parse. - /// - public object Parse(string text) - { - if (text == null) - throw BuildParserException("input is null"); - - Input = text; - InputLength = text.Length; - Pos = 0; - Line = 1; - Col = 1; - - var o = Value(); - - SkipWhitespace(); - - if (Pos != InputLength) - throw BuildParserException("extra characters at end"); - - return o; - } - - private void WriteLineLog(string msg, params object[] args) - { - if (Logger != null) - { - Logger.WriteLine(msg, args); - } - } - - private ParserException BuildParserException(string msg) - { - if (CollectLineInfo) - { - return new ParserException(string.Format(CultureInfo.InvariantCulture, "Parse error: {0} at line {1}, column {2}.", msg, Line, Col), Line, Col); - } - else - { - return new ParserException("Parse error: " + msg + ".", 0, 0); - } - } - - private void AdvanceInput(int n) - { - if (CollectLineInfo) - { - for (int i = Pos; i < Pos + n; i++) - { - var c = Input[i]; - - if (c == '\n') - { - Line++; - Col = 1; - } - else - { - Col++; - } - } - } - - Pos += n; - } - - private string Accept(string s) - { - var len = s.Length; - - if (Pos + len > InputLength) - { - return null; - } - - if (Input.IndexOf(s, Pos, len, StringComparison.Ordinal) != -1) - { - var match = Input.Substring(Pos, len); - AdvanceInput(len); - return match; - } - - return null; - } - - private char Expect(char c) - { - if (Pos >= InputLength || Input[Pos] != c) - { - throw BuildParserException("expected '" + c + "'"); - } - - AdvanceInput(1); - - return c; - } - - private object Value() - { - SkipWhitespace(); - - if (Pos >= InputLength) - { - throw BuildParserException("input contains no value"); - } - - var nextChar = Input[Pos]; - - if (nextChar == '"') - { - AdvanceInput(1); - return String(); - } - else if (nextChar == '[') - { - AdvanceInput(1); - return List(); - } - else if (nextChar == '{') - { - AdvanceInput(1); - return Dictionary(); - } - else if (char.IsDigit(nextChar) || nextChar == '-') - { - return Number(); - } - else - { - return Literal(); - } - } - - private object Number() - { - int currentPos = Pos; - bool dotSeen = false; - - Accept(c => c == '-', ref currentPos); - ExpectDigits(ref currentPos); - - if (Accept(c => c == '.', ref currentPos)) - { - dotSeen = true; - ExpectDigits(ref currentPos); - } - - if (Accept(c => (c == 'e' || c == 'E'), ref currentPos)) - { - Accept(c => (c == '-' || c == '+'), ref currentPos); - ExpectDigits(ref currentPos); - } - - var len = currentPos - Pos; - var num = Input.Substring(Pos, len); - - if (dotSeen) - { - decimal d; - if (decimal.TryParse(num, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent, CultureInfo.InvariantCulture, out d)) - { - WriteLineLog("decimal: {0}", d); - AdvanceInput(len); - return d; - } - else - { - double dbl; - if (double.TryParse(num, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent, CultureInfo.InvariantCulture, out dbl)) - { - WriteLineLog("double: {0}", dbl); - AdvanceInput(len); - return dbl; - } - - throw BuildParserException("cannot parse decimal number"); - } - } - else - { - int i; - if (int.TryParse(num, NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent, CultureInfo.InvariantCulture, out i)) - { - WriteLineLog("int: {0}", i); - AdvanceInput(len); - return i; - } - else - { - long l; - if (long.TryParse(num, NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent, CultureInfo.InvariantCulture, out l)) - { - WriteLineLog("long: {0}", l); - AdvanceInput(len); - return l; - } - - throw BuildParserException("cannot parse integer number"); - } - } - } - - private bool Accept(Predicate predicate, ref int pos) - { - if (pos < InputLength && predicate(Input[pos])) - { - pos++; - return true; - } - - return false; - } - - private void ExpectDigits(ref int pos) - { - int start = pos; - while (pos < InputLength && char.IsDigit(Input[pos])) pos++; - if (start == pos) throw BuildParserException("not a number"); - } - - private string String() - { - int currentPos = Pos; - StringBuilder sb = new StringBuilder(); - - while (true) - { - if (currentPos >= InputLength) - { - throw BuildParserException("unterminated string"); - } - - var c = Input[currentPos]; - - if (c == '"') - { - var len = currentPos - Pos; - AdvanceInput(len + 1); - WriteLineLog("string: {0}", sb); - return sb.ToString(); - } - else if (c == '\\') - { - currentPos++; - - if (currentPos >= InputLength) - { - throw BuildParserException("unterminated escape sequence string"); - } - - c = Input[currentPos]; - - switch (c) - { - case '"': - case '/': - case '\\': - sb.Append(c); - break; - case 'b': - sb.Append('\b'); - break; - case 'f': - sb.Append('\f'); - break; - case 'n': - sb.Append('\n'); - break; - case 'r': - sb.Append('\r'); - break; - case 't': - sb.Append('\t'); - break; - case 'u': - currentPos += 4; - if (currentPos >= InputLength) - throw BuildParserException("unterminated unicode escape in string"); - else - { - int u; - if (!int.TryParse(Input.Substring(currentPos - 3, 4), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out u)) - throw BuildParserException("not a well-formed unicode escape sequence in string"); - sb.Append((char)u); - } - break; - default: - throw BuildParserException("unknown escape sequence in string"); - } - } - else if ((int)c < 0x20) - { - throw BuildParserException("control character in string"); - } - else - { - sb.Append(c); - } - - currentPos++; - } - } - - private object Literal() - { - if (Accept("true") != null) - { - WriteLineLog("bool: true"); - return true; - } - - if (Accept("false") != null) - { - WriteLineLog("bool: false"); - return false; - } - - if (Accept("null") != null) - { - WriteLineLog("null"); - return null; - } - - throw BuildParserException("unknown token"); - } - - private IList List() - { - WriteLineLog("list: ["); - - List list = new List(); - - SkipWhitespace(); - if (IsNext(']')) - { - AdvanceInput(1); return list; - } - - object obj = null; - do - { - SkipWhitespace(); - obj = Value(); - if (obj != null) - { - list.Add(obj); - SkipWhitespace(); - if (IsNext(']')) break; - Expect(','); - } - } - while (obj != null); - - Expect(']'); - - WriteLineLog("]"); - - return list; - } - - private IDictionary Dictionary() - { - WriteLineLog("Dictionary: {"); - - Dictionary dict = new Dictionary(); - - SkipWhitespace(); - if (IsNext('}')) - { - AdvanceInput(1); return dict; - } - - KeyValuePair? kvp = null; - do - { - SkipWhitespace(); - - kvp = KeyValuePair(); - - if (kvp.HasValue) - { - dict[kvp.Value.Key] = kvp.Value.Value; - } - - SkipWhitespace(); - if (IsNext('}')) break; - Expect(','); - } - while (kvp != null); - - Expect('}'); - - WriteLineLog("}"); - - return dict; - } - - private KeyValuePair? KeyValuePair() - { - Expect('"'); - - var key = String(); - - SkipWhitespace(); - - Expect(':'); - - var obj = Value(); - - return new KeyValuePair(key, obj); - } - - private void SkipWhitespace() - { - int n = Pos; - while (IsWhiteSpace(n)) n++; - if (n != Pos) - { - AdvanceInput(n - Pos); - } - } - - private bool IsWhiteSpace(int n) - { - if (n >= InputLength) return false; - char c = Input[n]; - return c == ' ' || c == '\t' || c == '\r' || c == '\n'; - } - - private bool IsNext(char c) - { - return Pos < InputLength && Input[Pos] == c; - } - } - } - -} diff --git a/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonSerializer.cs b/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonSerializer.cs deleted file mode 100644 index 9fd9174..0000000 --- a/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/JsonSerializer.cs +++ /dev/null @@ -1,664 +0,0 @@ -// -// JsonSerializer.cs -// -// Author: -// Michael Ganss -// -// Copyright (c) 2011 Michael Ganss -// -// 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. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Globalization; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using winPEAS._3rdParty.MicroJson.MicroJson; - -namespace winPEAS._3rdParty.MicroJson -{ - /// - /// Serializes and deserializes JSON. - /// - public class JsonSerializer - { - /// - /// Deserializes JSON text into an object of the specified type. - /// - /// - /// An object of the specified type deserialized from JSON. - /// - /// - /// The JSON text. - /// - /// - /// The type to deserialize into. - /// - public static T DeserializeObject(string text) - { - return new JsonSerializer().Deserialize(text); - } - - /// - /// Serializes an object into JSON text. - /// - /// - /// The JSON text that represents the object. - /// - /// - /// The object to serialize. - /// - public static string SerializeObject(object obj) - { - return new JsonSerializer().Serialize(obj); - } - - /// - /// Deserializes JSON text into an object of the specified type. - /// - /// - /// An object of the specified type deserialized from JSON. - /// - /// - /// The JSON text. - /// - /// - /// The type to deserialize into. - /// - public T Deserialize(string text) - { - return Deserialize(text, new JsonParser()); - } - - /// - /// Deserializes JSON text into an object of the specified type. - /// - /// - /// An object of the specified type deserialized from JSON. - /// - /// - /// The JSON text. - /// - /// - /// The parser to use. - /// - /// - /// The type to deserialize into. - /// - public T Deserialize(string text, JsonParser parser) - { - if (parser == null) - { - throw new ArgumentException("An invalid argument was specified.", "parser"); - } - - var o = parser.Parse(text); - return (T)Deserialize(o, typeof(T)); - } - - /// - /// Constructor. - /// - public JsonSerializer() - { - TypeInfoPropertyName = "@type"; - } - - /// - /// - /// Gets or sets a value indicating whether to serialize and deserialize type information - /// for derived classes. - /// - /// - /// When a derived class is serialized and no additional type information is serialized - /// a deserializer does not know the derived class the object originated from. Setting this property to true emits - /// type information in an additional property whose name is indicated by and - /// deserializing honors this property. Type information is emitted only for types which are derived classes or implement - /// an interface. - /// - /// - /// The type information includes only the class name (no namespace, assembly information etc.) in order to be potentially compatible - /// with other implementations. When deserializing, the type indicated by the type information is searched only in the assembly where the base - /// type is located. - /// - /// The default is false. - /// - public bool UseTypeInfo { get; set; } - - /// - /// Gets or sets a property name where additional type information is serialized to and deserialized from. - /// The default is "@type". - /// - public string TypeInfoPropertyName { get; set; } - - /// - /// Deserializes generic POCO object into an object of the specified type. - /// - /// - /// An object of the specified type deserialized from POCO. - /// - /// - /// The POCO. - /// - /// - /// The type to deserialize into. - /// - public T Deserialize(object value) - { - return (T)Deserialize(value, typeof(T)); - } - - static Regex DateTimeRegex = new Regex(@"^/Date\((-?\d+)\)/$"); - - private Dictionary TypeCache = new Dictionary(); - - private object Deserialize(object from, Type type) - { - if (from == null) - return null; - - var dict = from as IDictionary; - if (dict != null) - { - if (UseTypeInfo) - { - object typeNameObject; - - if (dict.TryGetValue(TypeInfoPropertyName, out typeNameObject)) - { - var typeName = typeNameObject as string; - - if (!string.IsNullOrEmpty(typeName)) - { - Type derivedType; - - if (!TypeCache.TryGetValue(typeName, out derivedType)) - { - derivedType = type.Assembly.GetTypes() - .FirstOrDefault(t => t != type && type.IsAssignableFrom(t) && string.Equals(t.Name, typeName, StringComparison.OrdinalIgnoreCase)); - TypeCache[typeName] = derivedType ?? typeof(object); - } - - if (derivedType != null && derivedType != typeof(object)) type = derivedType; - } - } - } - - var to = Activator.CreateInstance(type); - DeserializeDictionary(dict, to); - return to; - } - - var list = from as IList; - if (list != null) - { - if (type.IsArray) - { - var elementType = type.GetElementType(); - var arr = Array.CreateInstance(elementType, list.Count); - DeserializeArray(list, arr, elementType); - return arr; - } - else - { - var to = (IList)Activator.CreateInstance(type); - DeserializeList(list, to); - return to; - } - } - - if (typeof(IList).IsAssignableFrom(type)) - { - var to = (IList)Activator.CreateInstance(type); - var itemType = to.GetType().GetProperty("Item").PropertyType; - to.Add(Deserialize(from, itemType)); - return to; - } - - if (type.IsEnum) - { - return Enum.Parse(type, from.ToString(), true); - } - - if (type == typeof(DateTime)) - { - var date = from as string; - if (date != null) - { - Match dateTimeMatch = DateTimeRegex.Match(date); - if (dateTimeMatch.Success) - { - var ticks = long.Parse(dateTimeMatch.Groups[1].Value, NumberFormatInfo.InvariantInfo); - var epochTicks = (ticks * 10000) + 621355968000000000; - return new DateTime(epochTicks, DateTimeKind.Utc).ToLocalTime(); - } - } - } - - if (type == typeof(Guid)) - { - var guid = from as string; - if (guid != null) - { - Guid g; - if (Guid.TryParse(guid, out g)) - return g; - } - } - - if (type == typeof(Uri)) - { - var uri = from as string; - if (uri != null) - { - Uri u; - if (Uri.TryCreate(uri, UriKind.RelativeOrAbsolute, out u)) - return u; - } - } - - if (!type.IsAssignableFrom(from.GetType())) - { - // Nullable handling - if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - type = type.GetGenericArguments()[0]; - } - - return Convert.ChangeType(from, type, CultureInfo.InvariantCulture); - } - - return from; - } - - private void DeserializeArray(IList from, Array to, Type itemType) - { - for (int i = 0; i < from.Count; i++) - { - to.SetValue(Deserialize(from[i], itemType), i); - } - } - - private void DeserializeList(IList from, IList to) - { - var itemType = to.GetType().GetProperty("Item").PropertyType; - foreach (var item in from) - { - to.Add(Deserialize(item, itemType)); - } - } - - private void DeserializeDictionary(IEnumerable> from, object to) - { - var type = to.GetType(); - - var dict = to as IDictionary; - if (dict != null) - { - var valType = typeof(object); - while (type != typeof(object)) - { - if (type.IsGenericType) - { - valType = type.GetGenericArguments()[1]; - break; - } - - type = type.BaseType; - } - - foreach (var pair in from) - { - dict[pair.Key] = Deserialize(pair.Value, valType); - } - } - else - { - foreach (var pair in from) - { - var member = GetMember(type, pair.Key); - if (member != null) - { - member.Set(to, Deserialize(pair.Value, member.Type)); - } - } - } - } - - class SetterMember - { - public Type Type { get; set; } - public Action Set { get; set; } - } - - private Dictionary MemberCache = new Dictionary(); - - private SetterMember GetMember(Type type, string name) - { - SetterMember member; - var key = name + type.GetHashCode(); - if (!MemberCache.TryGetValue(key, out member)) - { - var fieldInfo = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); - if (fieldInfo != null) - { - member = new SetterMember - { - Type = fieldInfo.FieldType, - Set = (o, v) => fieldInfo.SetValue(o, v) - }; - - MemberCache[key] = member; - } - else - { - var propertyInfo = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); - if (propertyInfo != null && propertyInfo.CanWrite) - { - member = new SetterMember - { - Type = propertyInfo.PropertyType, - Set = (o, v) => propertyInfo.SetValue(o, v, null) - }; - - MemberCache[key] = member; - } - else - { - MemberCache[key] = null; - - } - } - } - - return member; - } - - /// - /// Serialize the specified object into JSON. - /// - /// - /// The object to serialize. - /// - public string Serialize(object obj) - { - if (obj == null) return "null"; - - var list = obj as IList; - if (list != null && !(obj is IEnumerable>)) - { - var sb = new StringBuilder("["); - if (list.Count > 0) - { - sb.Append(string.Join(",", list.Cast().Select(i => Serialize(i)).ToArray())); - } - sb.Append("]"); - return sb.ToString(); - } - - var str = obj as string; - if (str != null) - { - return @"""" + EscapeString(str) + @""""; - } - - if (obj is int) - { - return obj.ToString(); - } - - var b = obj as bool?; - if (b.HasValue) - { - return b.Value ? "true" : "false"; - } - - if (obj is decimal) - { - return ((IFormattable)obj).ToString("G", NumberFormatInfo.InvariantInfo); - } - - if (obj is double || obj is float) - { - return ((IFormattable)obj).ToString("R", NumberFormatInfo.InvariantInfo); - } - - if (obj is Enum) - { - return @"""" + EscapeString(obj.ToString()) + @""""; - } - - if (obj is char) - { - return @"""" + obj + @""""; - } - - if (obj.GetType().IsPrimitive) - { - return (string)Convert.ChangeType(obj, typeof(string), CultureInfo.InvariantCulture); - } - - if (obj is DateTime) - { - return SerializeDateTime(obj); - } - - if (obj is Guid) - { - return @"""" + obj + @""""; - } - - if (obj is Uri) - { - return @"""" + obj + @""""; - } - - return SerializeComplexType(obj); - } - - private static string SerializeDateTime(object o) - { - var d = (DateTime)o; - var ticks = (d.ToUniversalTime().Ticks - 621355968000000000) / 10000; - return @"""\/Date(" + ticks + @")\/"""; - } - - private static string EscapeString(string src) - { - var sb = new StringBuilder(); - - foreach (var c in src) - { - if (c == '"' || c == '\\') - { - sb.Append('\\'); - sb.Append(c); - } - else if ((int)c < 0x20) // control character - { - var u = (int)c; - switch (u) - { - case '\b': - sb.Append("\\b"); - break; - case '\f': - sb.Append("\\f"); - break; - case '\n': - sb.Append("\\n"); - break; - case '\r': - sb.Append("\\r"); - break; - case '\t': - sb.Append("\\t"); - break; - default: - sb.Append("\\u"); - sb.Append(u.ToString("X4", NumberFormatInfo.InvariantInfo)); - break; - } - } - else - sb.Append(c); - } - - return sb.ToString(); - } - - private string SerializeComplexType(object o) - { - var s = new StringBuilder("{"); - - if (o is IDictionary || o is IEnumerable>) - { - SerializeDictionary(o, s); - } - else - { - SerializeProperties(o, s); - } - - s.Append("}"); - - return s.ToString(); - } - - private void SerializeProperties(object o, StringBuilder s) - { - var type = o.GetType(); - var members = GetMembers(type); - - if (UseTypeInfo && ((type.BaseType != typeof(object) && type.BaseType != null) || type.GetInterfaces().Any())) - { - // emit type info - s.Append(@""""); - s.Append(TypeInfoPropertyName); - s.Append(@""":"""); - s.Append(type.Name); - s.Append(@""","); - } - - foreach (var member in members) - { - object val = member.Get(o); - - if (val != null && (member.DefaultValue == null || !val.Equals(member.DefaultValue))) - { - var v = Serialize(val); - s.Append(@""""); - s.Append(member.Name); - s.Append(@""":"); - s.Append(v); - s.Append(","); - } - } - - if (s.Length > 0 && s[s.Length - 1] == ',') s.Remove(s.Length - 1, 1); - } - - private void SerializeDictionary(object o, StringBuilder s) - { - IEnumerable> kvps; - var dict = o as IDictionary; - if (dict != null) - kvps = dict.Keys.Cast().Select(k => new KeyValuePair(k.ToString(), dict[k])); - else - kvps = (IEnumerable>)o; - - // work around MonoTouch Full-AOT issue - var kvpList = kvps.ToList(); - kvpList.Sort((e1, e2) => string.Compare(e1.Key, e2.Key, StringComparison.OrdinalIgnoreCase)); - - foreach (var kvp in kvpList) - { - s.Append(@""""); - s.Append(kvp.Key); - s.Append(@""":"); - s.Append(Serialize(kvp.Value)); - s.Append(","); - } - - if (s.Length > 0 && s[s.Length - 1] == ',') - s.Remove(s.Length - 1, 1); - } - - class GetterMember - { - public string Name { get; set; } - public Func Get { get; set; } - public object DefaultValue { get; set; } - } - - private Dictionary MembersCache = new Dictionary(); - - private GetterMember[] GetMembers(Type type) - { - GetterMember[] members; - - if (!MembersCache.TryGetValue(type, out members)) - { - var props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase) - .Where(p => p.CanWrite) - .Select(p => BuildGetterMember(p)); - - var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase) - .Select(f => BuildGetterMember(f)); - - members = props.Concat(fields).OrderBy(g => g.Name, StringComparer.OrdinalIgnoreCase).ToArray(); - - MembersCache[type] = members; - } - - return members; - } - - private static GetterMember BuildGetterMember(PropertyInfo p) - { - var defaultAttribute = p.GetCustomAttributes(typeof(DefaultValueAttribute), true).FirstOrDefault() as DefaultValueAttribute; - return new GetterMember - { - Name = p.Name, - Get = (Func)(o => p.GetValue(o, null)), - DefaultValue = defaultAttribute != null ? defaultAttribute.Value : GetDefaultValueForType(p.PropertyType) - }; - } - - private static GetterMember BuildGetterMember(FieldInfo f) - { - var defaultAttribute = f.GetCustomAttributes(typeof(DefaultValueAttribute), true).FirstOrDefault() as DefaultValueAttribute; - return new GetterMember - { - Name = f.Name, - Get = (o => f.GetValue(o)), - DefaultValue = defaultAttribute != null ? defaultAttribute.Value : GetDefaultValueForType(f.FieldType) - }; - } - - private static object GetDefaultValueForType(Type type) - { - return type.IsValueType ? Activator.CreateInstance(type) : null; - } - } -} diff --git a/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/README.md b/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/README.md deleted file mode 100644 index 5bc7a67..0000000 --- a/winPEAS/winPEASexe/winPEAS/3rdParty/MicroJson/README.md +++ /dev/null @@ -1,66 +0,0 @@ -MicroJson -========= - -[![Version](https://img.shields.io/nuget/v/MicroJson.svg)](https://www.nuget.org/packages/MicroJson) -[![Build status](https://ci.appveyor.com/api/projects/status/d71toeu341rclabr/branch/master?svg=true)](https://ci.appveyor.com/project/mganss/microjson/branch/master) -[![Coverage Status](https://coveralls.io/repos/mganss/MicroJson/badge.svg?branch=master&service=github)](https://coveralls.io/github/mganss/MicroJson?branch=master) - -MicroJson is a small library for serializing/deserializing [JSON](http://www.json.org/) strings from strongly -typed CLR objects (POCOs). It is basically a replacement for the [JavaScriptSerializer](http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx) -class for situations where you cannot or do not want to use that class. Its aim is neither to be fast nor feature-rich but -rather small and compatible with most environments. -If you are looking for a more fully featured JSON serializer, you should probably take a look at [JSON.Net](http://json.codeplex.com/). - -MicroJson consists of two source files you can just drop into your project. It has been tested in the following environments: - -- .NET 4.0 -- [Mono](http://www.mono-project.com/Main_Page) 2.10 -- [MonoTouch](http://www.xamarin.com) ([Touch.Unit](https://github.com/spouliot/Touch.Unit) tests included) -- [Mono for Android](http://www.xamarin.com) ([Andr.Unit](https://github.com/spouliot/Andr.Unit) tests included) - -Usage ------ - - public class Test - { - public string S { get; set; } - public int I { get; set; } - public List L; - } - - var json = @"{ - ""S"": ""Hello, world."", - ""I"": 4711, - ""L"": [1, 2, 3] - }"; - - var t = new JsonSerializer().Deserialize(json); - - Assert.That(t.S, Is.EqualTo("Hello, world.")); - Assert.That(4711, Is.EqualTo(t.I)); - Assert.That(new[] { 1, 2, 3 }, Is.EquivalentTo(t.L)); - - var j = new JsonSerializer().Serialize(t); - - Assert.That(j, Is.EqualTo(@"{""I"":4711,""L"":[1,2,3],""S"":""Hello, world.""}")); - -Notes ------ - -Deserialization is a two step process. First, JSON text is deserialized into generic CLR objects, i.e. -JSON arrays into `List` and JSON objects into `Dictionary`. If you only need this, then you can -just include `JsonParser.cs`. - -Type information can be preserved when de/serializing by setting the `UseTypeInfo` property to true on the `JsonSerializer` object. -This will emit the class name of a serialized object as an additional property (can be configured through the property `TypeInfoPropertyName`, default is `@type`) -for classes which are derived and/or implement an interface. - -License -------- - -[MIT X11](http://en.wikipedia.org/wiki/MIT_License) - -Used at ---------- - -[UpdateStar](http://www.updatestar.com/) diff --git a/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/VulnerabilityCollection.cs b/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/VulnerabilityCollection.cs index 91d1ce4..0ab6628 100644 --- a/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/VulnerabilityCollection.cs +++ b/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/VulnerabilityCollection.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using winPEAS.Helpers; namespace winPEAS._3rdParty.Watson { @@ -20,20 +21,24 @@ namespace winPEAS._3rdParty.Watson { foreach (Vulnerability vuln in _vulnerabilities.Where(i => i.Vulnerable)) { - Console.WriteLine(" [!] {0} : VULNERABLE", vuln.Identification); + Beaprint.BadPrint($" [!] {vuln.Identification} : VULNERABLE"); foreach (string exploit in vuln.KnownExploits) { - Console.WriteLine(" [>] {0}", exploit); + Beaprint.BadPrint($" [>] {exploit}"); } Console.WriteLine(); } if (_vulnerabilities.Any(e => e.Vulnerable)) - Console.WriteLine(" [*] Finished. Found {0} potential vulnerabilities.\r\n", _vulnerabilities.Count(i => i.Vulnerable)); + { + Beaprint.BadPrint($" [*] Finished. Found {_vulnerabilities.Count(i => i.Vulnerable)} potential vulnerabilities.\r\n"); + } else - Console.WriteLine(" [*] Finished. Found 0 vulnerabilities.\r\n"); + { + Beaprint.GoodPrint(" [*] Finished. Found 0 vulnerabilities.\r\n"); + } } private List Populate() diff --git a/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/Watson.cs b/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/Watson.cs index 48daa6a..90abce6 100644 --- a/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/Watson.cs +++ b/winPEAS/winPEASexe/winPEAS/3rdParty/Watson/Watson.cs @@ -58,24 +58,24 @@ namespace winPEAS._3rdParty.Watson #endif // List of Vulnerabilities - var vulnerabiltiies = new VulnerabilityCollection(); + var vulnerabilities = new VulnerabilityCollection(); // Check each one - CVE_2019_0836.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_0841.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1064.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1130.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1253.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1315.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1385.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1388.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2019_1405.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2020_0668.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2020_0683.Check(vulnerabiltiies, buildNumber, installedKBs); - CVE_2020_1013.Check(vulnerabiltiies, buildNumber, installedKBs); + CVE_2019_0836.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_0841.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1064.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1130.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1253.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1315.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1385.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1388.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2019_1405.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2020_0668.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2020_0683.Check(vulnerabilities, buildNumber, installedKBs); + CVE_2020_1013.Check(vulnerabilities, buildNumber, installedKBs); // Print the results - vulnerabiltiies.ShowResults(); + vulnerabilities.ShowResults(); } } } diff --git a/winPEAS/winPEASexe/winPEAS/Checks/Checks.cs b/winPEAS/winPEASexe/winPEAS/Checks/Checks.cs index a6d1770..2a7c5b8 100644 --- a/winPEAS/winPEASexe/winPEAS/Checks/Checks.cs +++ b/winPEAS/winPEASexe/winPEAS/Checks/Checks.cs @@ -16,8 +16,6 @@ namespace winPEAS.Checks public static bool IsNoColor = false; public static bool ExecCmd = false; public static bool Banner = true; - public static bool IsSearchFast = true; - public static int SearchTime = 50; public static bool IsDebug = false; // Create Dynamic blacklists @@ -120,11 +118,6 @@ namespace winPEAS.Checks Banner = false; } - if (string.Equals(arg, "searchslow", StringComparison.CurrentCultureIgnoreCase)) - { - IsSearchFast = false; - } - if (string.Equals(arg, "wait", StringComparison.CurrentCultureIgnoreCase)) { wait = true; diff --git a/winPEAS/winPEASexe/winPEAS/Checks/FilesInfo.cs b/winPEAS/winPEASexe/winPEAS/Checks/FilesInfo.cs index 8e21007..70cadfc 100644 --- a/winPEAS/winPEASexe/winPEAS/Checks/FilesInfo.cs +++ b/winPEAS/winPEASexe/winPEAS/Checks/FilesInfo.cs @@ -8,6 +8,7 @@ using winPEAS.Helpers.Search; using winPEAS.Info.UserInfo; using winPEAS.InterestingFiles; using winPEAS.KnownFileCreds; +using winPEAS.KnownFileCreds.Slack; using winPEAS.KnownFileCreds.SuperPutty; namespace winPEAS.Checks @@ -124,6 +125,7 @@ namespace winPEAS.Checks PrintPossCredsRegs, PrintUserCredsFiles, PrintOracleSQLDeveloperConfigFiles, + Slack.PrintInfo, PrintUsersInterestingFiles, PrintUsersDocsKeys, PrintRecentFiles, @@ -132,6 +134,8 @@ namespace winPEAS.Checks PrintOtherUsersInterestingFiles, PrintExecutablesInNonDefaultFoldersWithWritePermissions, }.ForEach(action => CheckRunner.Run(action, isDebug)); + + SearchHelper.CleanLists(); } void PrintCloudCreds() diff --git a/winPEAS/winPEASexe/winPEAS/Checks/NetworkInfo.cs b/winPEAS/winPEASexe/winPEAS/Checks/NetworkInfo.cs index 3e2ec69..5bd43bc 100644 --- a/winPEAS/winPEASexe/winPEAS/Checks/NetworkInfo.cs +++ b/winPEAS/winPEASexe/winPEAS/Checks/NetworkInfo.cs @@ -144,7 +144,7 @@ namespace winPEAS.Checks foreach (var tcpConnectionInfo in NetworkInfoHelper.GetTcpConnections(IPVersion.IPv4, processesByPid)) { Beaprint.AnsiPrint( - string.Format($"{formatString}", + string.Format(formatString, " TCP", tcpConnectionInfo.LocalAddress, tcpConnectionInfo.LocalPort, @@ -177,7 +177,7 @@ namespace winPEAS.Checks foreach (var tcpConnectionInfo in NetworkInfoHelper.GetTcpConnections(IPVersion.IPv6, processesByPid)) { Beaprint.AnsiPrint( - string.Format($"{formatString}", + string.Format(formatString, " TCP", $"[{tcpConnectionInfo.LocalAddress}]", tcpConnectionInfo.LocalPort, @@ -220,7 +220,7 @@ namespace winPEAS.Checks foreach (var udpConnectionInfo in NetworkInfoHelper.GetUdpConnections(IPVersion.IPv4, processesByPid)) { Beaprint.AnsiPrint( - string.Format($"{formatString}", + string.Format(formatString, " UDP", udpConnectionInfo.LocalAddress, udpConnectionInfo.LocalPort, @@ -251,7 +251,7 @@ namespace winPEAS.Checks foreach (var udpConnectionInfo in NetworkInfoHelper.GetUdpConnections(IPVersion.IPv6, processesByPid)) { Beaprint.AnsiPrint( - string.Format($"{formatString}", + string.Format(formatString, " UDP", $"[{udpConnectionInfo.LocalAddress}]", udpConnectionInfo.LocalPort, diff --git a/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs b/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs index 929fbec..9179585 100644 --- a/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs +++ b/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs @@ -577,14 +577,16 @@ namespace winPEAS.Checks try { + string formatString = " {0,-100} {1}\n"; + + Beaprint.NoColorPrint(string.Format($"{formatString}", "Name", "Sddl")); + foreach (var namedPipe in NamedPipes.GetNamedPipeInfos()) { - Beaprint.BadPrint($" Name: {namedPipe.Name}\n" + - $" Sddl: {namedPipe.Sddl}\n"); - Beaprint.PrintLineSeparator(); + Beaprint.BadPrint(string.Format(formatString, namedPipe.Name, namedPipe.Sddl)); } } - catch (Exception ex) + catch (Exception ex) { //Beaprint.PrintException(ex.Message); } @@ -602,8 +604,8 @@ namespace winPEAS.Checks { var providerPath = RegistryHelper.GetRegValue("HKLM", $"SOFTWARE\\Classes\\CLSID\\{provider}\\InprocServer32", ""); - Beaprint.BadPrint($" Provider: {provider}\n" + - $" Path: {providerPath}\n"); + Beaprint.NoColorPrint($" Provider: {provider}\n" + + $" Path: {providerPath}\n"); Beaprint.PrintLineSeparator(); } diff --git a/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs b/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs index 58c4bc6..34e1c22 100644 --- a/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs +++ b/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs @@ -107,7 +107,6 @@ namespace winPEAS.Helpers { Console.WriteLine(YELLOW + " [*] " + GREEN + "WinPEAS is a binary to enumerate possible paths to escalate privileges locally" + NOCOLOR); Console.WriteLine(LBLUE + " quiet" + GRAY + " Do not print banner" + NOCOLOR); - Console.WriteLine(LBLUE + " searchslow" + GRAY + " Sleep while searching files to not consume a notable amount of resources" + NOCOLOR); Console.WriteLine(LBLUE + " cmd" + GRAY + " Obtain wifi, cred manager and clipboard information executing CMD commands" + NOCOLOR); Console.WriteLine(LBLUE + " notcolor" + GRAY + " Don't use ansi colors (all white)" + NOCOLOR); Console.WriteLine(LBLUE + " systeminfo" + GRAY + " Search system information" + NOCOLOR); diff --git a/winPEAS/winPEASexe/winPEAS/Helpers/Search/SearchHelper.cs b/winPEAS/winPEASexe/winPEAS/Helpers/Search/SearchHelper.cs index 28e7de0..b3de8c9 100644 --- a/winPEAS/winPEASexe/winPEAS/Helpers/Search/SearchHelper.cs +++ b/winPEAS/winPEASexe/winPEAS/Helpers/Search/SearchHelper.cs @@ -203,6 +203,18 @@ namespace winPEAS.Helpers.Search SearchHelper.GroupPolicyHistory.AddRange(groupPolicyHistoryLegacyFiles); } + internal static void CleanLists() + { + SearchHelper.RootDirUsers = null; + SearchHelper.RootDirCurrentUser = null; + SearchHelper.ProgramFiles = null; + SearchHelper.ProgramFilesX86 = null; + SearchHelper.DocumentsAndSettings = null; + SearchHelper.GroupPolicyHistory = null; + + GC.Collect(); + } + internal static IEnumerable SearchUserCredsFiles() { var patterns = new List diff --git a/winPEAS/winPEASexe/winPEAS/Info/NetworkInfo/NetworkConnection.cs b/winPEAS/winPEASexe/winPEAS/Info/NetworkInfo/NetworkConnection.cs index 59ab91f..5d16708 100644 --- a/winPEAS/winPEASexe/winPEAS/Info/NetworkInfo/NetworkConnection.cs +++ b/winPEAS/winPEASexe/winPEAS/Info/NetworkInfo/NetworkConnection.cs @@ -7,13 +7,13 @@ namespace winPEAS.Info.NetworkInfo [StructLayout(LayoutKind.Sequential)] public abstract class NetworkConnection { - public virtual Protocol Protocol { get; set; } - public virtual IPAddress LocalAddress { get; set; } - public virtual ushort LocalPort { get; set; } - public virtual int ProcessId { get; set; } - public virtual string ProcessName { get; set; } + public Protocol Protocol { get; set; } + public IPAddress LocalAddress { get; set; } + public ushort LocalPort { get; set; } + public int ProcessId { get; set; } + public string ProcessName { get; set; } - public NetworkConnection( + protected NetworkConnection( Protocol protocol, IPAddress localAddress, ushort localPort, diff --git a/winPEAS/winPEASexe/winPEAS/Info/SystemInfo/NamedPipes/NamedPipes.cs b/winPEAS/winPEASexe/winPEAS/Info/SystemInfo/NamedPipes/NamedPipes.cs index b79a732..853b1bc 100644 --- a/winPEAS/winPEASexe/winPEAS/Info/SystemInfo/NamedPipes/NamedPipes.cs +++ b/winPEAS/winPEASexe/winPEAS/Info/SystemInfo/NamedPipes/NamedPipes.cs @@ -38,9 +38,8 @@ namespace winPEAS.Info.SystemInfo.NamedPipes public static IEnumerable GetNamedPipeInfos() { var namedPipes = new List(); - WIN32_FIND_DATA lpFindFileData; - var ptr = FindFirstFile(@"\\.\pipe\*", out lpFindFileData); + var ptr = FindFirstFile(@"\\.\pipe\*", out var lpFindFileData); namedPipes.Add(lpFindFileData.cFileName); while (FindNextFile(ptr, out lpFindFileData)) { @@ -52,23 +51,21 @@ namespace winPEAS.Info.SystemInfo.NamedPipes foreach (var namedPipe in namedPipes) { - FileSecurity security; string sddl; + bool isError = false; + try { - security = File.GetAccessControl(System.String.Format("\\\\.\\pipe\\{0}", namedPipe)); + var security = File.GetAccessControl($"\\\\.\\pipe\\{namedPipe}"); sddl = security.GetSecurityDescriptorSddlForm(AccessControlSections.All); } catch { + isError = true; sddl = "ERROR"; } - if (!string.IsNullOrEmpty(sddl) && !sddl.Equals("ERROR")) - { - yield return new NamedPipeInfo(namedPipe, sddl); - } - else + if (!isError && !string.IsNullOrEmpty(sddl)) { yield return new NamedPipeInfo(namedPipe, sddl); } diff --git a/winPEAS/winPEASexe/winPEAS/KnownFileCreds/Browsers/Decryptor/GCDecryptor.cs b/winPEAS/winPEASexe/winPEAS/KnownFileCreds/Browsers/Decryptor/GCDecryptor.cs index 7b6f766..73c7856 100644 --- a/winPEAS/winPEASexe/winPEAS/KnownFileCreds/Browsers/Decryptor/GCDecryptor.cs +++ b/winPEAS/winPEASexe/winPEAS/KnownFileCreds/Browsers/Decryptor/GCDecryptor.cs @@ -3,10 +3,10 @@ using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; +using System.Web.Script.Serialization; using winPEAS._3rdParty.BouncyCastle.crypto.engines; using winPEAS._3rdParty.BouncyCastle.crypto.modes; using winPEAS._3rdParty.BouncyCastle.crypto.parameters; -using winPEAS._3rdParty.MicroJson; namespace winPEAS.KnownFileCreds.Browsers.Decryptor { @@ -28,7 +28,7 @@ namespace winPEAS.KnownFileCreds.Browsers.Decryptor var appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);// APPDATA var path = Path.GetFullPath(appdata + localStatePath); var v = File.ReadAllText(path); - var json = new JsonSerializer().Deserialize(v); + var json = new JavaScriptSerializer().Deserialize(v); string key = json.os_crypt.encrypted_key;