diff options
| author | Michael <[email protected]> | 2017-03-08 19:38:18 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-08 19:38:18 -0500 |
| commit | abe535200bb348af6288b7cc7d3405b2fea8ffa6 (patch) | |
| tree | f99c538c989c34f4d80fc2d61bcc0e7c41c591d4 /ShiftOS_TheReturn/TerminalBackend.cs | |
| parent | 2ff261328740cbb628678605b09800f22c9b67a9 (diff) | |
| download | shiftos_thereturn-abe535200bb348af6288b7cc7d3405b2fea8ffa6.tar.gz shiftos_thereturn-abe535200bb348af6288b7cc7d3405b2fea8ffa6.tar.bz2 shiftos_thereturn-abe535200bb348af6288b7cc7d3405b2fea8ffa6.zip | |
Kernel watchdog watches you more...
:notjustabluesmileyface:
Diffstat (limited to 'ShiftOS_TheReturn/TerminalBackend.cs')
| -rw-r--r-- | ShiftOS_TheReturn/TerminalBackend.cs | 50 |
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; } } } } - } } } |
