public static void Query(string Username, string Password, string Domain, string ComputerName, object Hive, string Subkey, string Valuename, string Value, object Access) { try { if (Valuename == null) { if (CheckAccess.Check(Username, Password, Domain, ComputerName, Hive, Subkey, Access)) { StdRegProv.EnumValues.Get(Username, Password, Domain, ComputerName, Hive, Subkey); } else { Console.WriteLine($"[-] Error: Do not have permissions to query {Subkey}"); Environment.Exit(1); } } else { if (CheckAccess.Check(Username, Password, Domain, ComputerName, Hive, Subkey, Access)) { object Valuetype = null; int val = EnumValues.GetValue(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); switch (val) { case (1): Valuetype = ValueType.String; break; case (2): Valuetype = ValueType.ExtendedString; break; case (3): Valuetype = ValueType.Binary; break; case (4): Valuetype = ValueType.DWORD; break; case (7): Valuetype = ValueType.MultiString; break; case (11): Valuetype = ValueType.QWORD; break; } switch (Valuetype) { case (ValueType.String): StdRegProv.String.Get(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); break; case (ValueType.ExtendedString): ExString.Get(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); break; case (ValueType.Binary): Binary.Get(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); break; case (ValueType.DWORD): Dword.Get(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); break; case (ValueType.MultiString): MultiString.Get(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); break; case (ValueType.QWORD): Qword.Get(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); break; default: Console.WriteLine($"[-] Error: Do not have permissions to query {Subkey}"); Environment.Exit(1); break; } } else { Console.WriteLine($"[-] Error: Do not have permissions to query {Subkey}"); Environment.Exit(1); } } } catch (Exception e) { Console.WriteLine($"[-] Error: {e.Message}"); } }
public static void Write(string Username, string Password, string Domain, string ComputerName, object Hive, string Subkey, string Valuename, string Value, string Type, object Access) { try { if (CheckAccess.Check(Username, Password, Domain, ComputerName, Hive, Subkey, Access)) { object Valuetype = null; if (Type != null) { switch (Type.ToLower()) { case ("string"): Valuetype = ValueType.String; break; case ("exstring"): Valuetype = ValueType.ExtendedString; break; case ("binary"): Valuetype = ValueType.Binary; break; case ("dword"): Valuetype = ValueType.DWORD; break; case ("multistring"): Valuetype = ValueType.MultiString; break; case ("qword"): Valuetype = ValueType.QWORD; break; } } else { int val = EnumValues.GetValue(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename); switch (val) { case (1): Valuetype = ValueType.String; break; case (2): Valuetype = ValueType.ExtendedString; break; case (3): Valuetype = ValueType.Binary; break; case (4): Valuetype = ValueType.DWORD; break; case (7): Valuetype = ValueType.MultiString; break; case (11): Valuetype = ValueType.QWORD; break; } } switch (Valuetype) { case (ValueType.String): StdRegProv.String.Set(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename, Value); break; case (ValueType.ExtendedString): ExString.Set(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename, Value); break; case (ValueType.Binary): Binary.Set(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename, Convert.FromBase64String(Value)); break; case (ValueType.DWORD): Dword.Set(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename, Convert.ToUInt32(Value)); break; case (ValueType.MultiString): MultiString.Set(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename, Value.Split(',')); break; case (ValueType.QWORD): Qword.Set(Username, Password, Domain, ComputerName, Hive, Subkey, Valuename, Convert.ToUInt64(Value)); break; default: Console.WriteLine($"[-] Error: Do not have permissions to query {Subkey}"); Environment.Exit(1); break; } } else { Console.WriteLine($"[-] Error: Do not have permissions to set {Subkey}"); Environment.Exit(1); } } catch (Exception e) { Console.WriteLine($"[-] Error: {e.Message}"); } }