aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/TerminalBackend.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS_TheReturn/TerminalBackend.cs')
-rw-r--r--ShiftOS_TheReturn/TerminalBackend.cs50
1 files changed, 32 insertions, 18 deletions
diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs
index 8be54d0..f78d7a5 100644
--- a/ShiftOS_TheReturn/TerminalBackend.cs
+++ b/ShiftOS_TheReturn/TerminalBackend.cs
@@ -139,29 +139,29 @@ namespace ShiftOS.Engine
{
if (Shiftorium.UpgradeAttributesUnlocked(type))
{
- if (KernelWatchdog.IsSafe(type))
+ foreach (var a in type.GetCustomAttributes(false))
{
- foreach (var a in type.GetCustomAttributes(false))
+ if (a is Namespace)
{
- if (a is Namespace)
+ var ns = a as Namespace;
+ if (text.Split('.')[0] == ns.name)
{
- var ns = a as Namespace;
- if (text.Split('.')[0] == ns.name)
+ if (KernelWatchdog.IsSafe(type))
{
foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static))
{
if (Shiftorium.UpgradeAttributesUnlocked(method))
{
- if (KernelWatchdog.IsSafe(method))
+ if (CanRunRemotely(method, isRemote))
{
- if (CanRunRemotely(method, isRemote))
+ foreach (var ma in method.GetCustomAttributes(false))
{
- foreach (var ma in method.GetCustomAttributes(false))
+ if (ma is Command)
{
- if (ma is Command)
+ var cmd = ma as Command;
+ if (text.Split('.')[1] == cmd.name)
{
- var cmd = ma as Command;
- if (text.Split('.')[1] == cmd.name)
+ if (KernelWatchdog.IsSafe(method))
{
var attr = method.GetCustomAttribute<CommandObsolete>();
@@ -245,23 +245,37 @@ namespace ShiftOS.Engine
return (bool)method.Invoke(null, new object[] { });
}
}
+ else
+ {
+ Console.WriteLine("<watchdog> You cannot run this command.");
+ KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir.");
+ return true;
+ }
}
+
+
}
}
- else
- {
- Console.WriteLine(text + " cannot be ran in a remote session");
- return true;
- }
}
-
+ else
+ {
+ Console.WriteLine(text + " cannot be ran in a remote session");
+ return true;
+ }
}
+
}
+
+ }
+ else
+ {
+ Console.WriteLine("<watchdog> You cannot run this command.");
+ KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir.");
+ return true;
}
}
}
}
-
}
}
}