Aptivi - Deprecated Manuals
ProjectsWebsiteBlog
Nitrocid KS v0.0.24 - Manual
Nitrocid KS v0.0.24 - Manual
  • History of KS
  • Kernel Simulator
  • Introduction to the Kernel
  • toc
  • arguments
    • Command line arguments for KS
    • Kernel arguments for KS
    • Preboot Command line arguments for KS
  • commands
    • Commands for (S)FTP client for KS
    • Commands-for-KS
    • Brief overview of HTTP shell
    • Brief overview of hex editor shell
    • Brief overview of JSON shell
    • Brief overview of mail shell
    • Brief overview of RSS shell
    • Test shell commands
    • Brief overview of text editor shell
    • Brief overview of ZIP shell
    • hex
      • addbyte hex editor shell command
      • addbytes hex editor shell command
      • clear hex editor shell command
      • delbyte hex editor shell command
      • delbytes hex editor shell command
      • exit hex editor shell command
      • exitnosave hex editor shell command
      • print hex editor shell command
      • querybyte hex editor shell command
      • replace hex editor shell command
      • save hex editor shell command
    • http
      • delete HTTP command
      • get HTTP command
      • getstring HTTP command
      • setsite HTTP command
    • json
      • addproperty JSON shell command
      • clear JSON shell command
      • delproperty JSON shell command
      • exit JSON shell command
      • exitnosave JSON shell command
      • print JSON shell command
      • save JSON shell command
    • mail
      • cd mail command
      • exit mail command
      • list mail command
      • lsdirs mail command
      • mkdir mail command
      • mv mail command
      • mvall mail command
      • read mail command
      • readenc mail command
      • ren mail command
      • rm mail command
      • rmall mail command
      • rmdir mail command
      • send mail command
      • sendenc mail command
    • rss
      • articleinfo RSS command
      • bookmark RSS command
      • chfeed RSS command
      • feedinfo RSS command
      • list RSS command
      • listbookmark RSS command
      • read RSS command
      • unbookmark RSS command
    • sftp
      • cdl (S)FTP command
      • cdr (S)FTP command
      • connect (S)FTP command
      • del (S)FTP command
      • disconnect (S)FTP command
      • get (S)FTP command
      • lsl (S)FTP command
      • lsr (S)FTP command
      • put (S)FTP command
      • pwdl (S)FTP command
      • pwdr (S)FTP command
      • quickconnect (S)FTP command
      • ftponly
        • cp FTP command
        • getfolder FTP command
        • mv FTP command
        • perm FTP command
        • putfolder (S)FTP command
        • type FTP command
    • text
      • addline text editor shell command
      • addlines text editor shell command
      • clear text editor shell command
      • delcharnum text editor shell command
      • delline text editor shell command
      • delword text editor shell command
      • editline text editor shell command
      • exit text editor shell command
      • exitnosave text editor shell command
      • print text editor shell command
      • querychar text editor shell command
      • queryword text editor shell command
      • querywordregex text editor shell command
      • replace text editor shell command
      • replaceinline text editor shell command
      • replaceinlineregex text editor shell command
      • replaceregex text editor shell command
      • save text editor shell command
    • uesh
      • adduser command
      • alias command
      • arginj command
      • beep command
      • blockdbgdev command
      • calc command
      • calendar command
      • cat command
      • cdbglog command
      • chattr command
      • chdir command
      • chhostname command
      • chlang command
      • chmal command
      • chmotd command
      • choice command
      • chpwd command
      • chusrname command
      • clearfiredevents command
      • cls command
      • colorhextorgb command
      • colorhextorgbks command
      • colorrgbtohex command
      • combine command
      • convertlineendings command
      • copy command
      • dict command
      • dirinfo command
      • disconndbgdev command
      • dismissnotif command
      • dismissnotifs command
      • echo command
      • edit command
      • exit command
      • fileinfo command
      • find command
      • firedevents command
      • ftp command
      • genname command
      • get command
      • gettimeinfo command
      • hexedit command
      • http command
      • hwinfo command
      • if command
      • input command
      • jsonbeautify command
      • jsonminify command
      • jsonshell command
      • keyinfo command
      • langman command
      • list command
      • lockscreen command
      • logout command
      • lovehate command
      • lsdbgdev command
      • lsvars command
      • mail command
      • md command
      • meteor command
      • mkfile command
      • mktheme command
      • modman command
      • modmanual command
      • move command
      • netinfo command
      • opem command
      • perm command
      • ping command
      • put command
      • rarshell command
      • rdebug command
      • reboot command
      • reloadconfig command
      • reloadsaver command
      • reportbug command
      • retroks command
      • rexec command
      • rm command
      • rmuser command
      • rss command
      • savecurrdir command
      • savescreen command
      • search command
      • searchword command
      • select command
      • set command
      • setrange command
      • setsaver command
      • setthemes command
      • settings command
      • sftp command
      • shownotifs command
      • showtd command
      • showtdzone command
      • shutdown command
      • snaker command
      • solver command
      • speedpress command
      • spellbee command
      • sshcmd command
      • sshell command
      • stopwatch command
      • sumfile command
      • sumfiles command
      • sysinfo command
      • testshell command
      • timer command
      • unblockdbgdev command
      • unitconv command
      • unzip command
      • update command
      • usermanual command
      • verify command
      • weather command
      • wrap command
      • zip command
      • zipshell command
    • unified
      • exit command
      • presets command
    • zip
      • cdir Zip command
      • chadir Zip command
      • chdir Zip command
      • get Zip command
      • list Zip command
      • pack Zip command
  • config
    • Configuration for KS
    • Screensaver settings for KS
    • Splash settings for KS
  • development
    • Custom splash guide
    • Events for Mod Developers
    • Mod Dependencies
    • Mod manual page
    • Modding guide
    • Screensaver modding guide
  • diagnostics
    • Kernel testing
    • Remote debugging guide
  • misc
    • Output redirection
    • Placeholders
    • Splashes
    • Studying Payslip virus
  • releases
    • Compatibility notes for first-gen KS
    • Compatibility notes for second-gen KS
    • Release-Notes-for-First-Generation-KS
    • Release-Notes-for-Second-Generation-KS
  • ueshdevelopment
    • Shell-scripting
    • UESH conditions
  • utilities
    • KSConverter
    • KSJsonifyLocales
Powered by GitBook
On this page
  • What is the mod for the kernel?
  • Mod format
  • How to start your own mod on Visual Studio?
  • Optional Stuff
  • Example
  • Hello World on Mod Start, and Goodbye World on Mod Stop
  • More Examples
Edit on GitHub
  1. development

Modding guide

Last updated 6 months ago

What is the mod for the kernel?

The mod is the kernel extension file that loads on boot and adds extensions to the kernel, the shell, and everything. It can also respond to events.

This is useful if you want to add your own extensions to the kernel, like event handlers for the kernel.

[!TIP] To get started to our Kernel Simulator API, visit .

Mod format

The mods have the file extension of .dll, and can support more than one code file for each mod. This will allow you to make bigger mods that can't fit on one source file, or if you want to separate some parts of the big source code to multiple fragments.

How to start your own mod on Visual Studio?

[!NOTE] We recommend following the template repository for making your own mod .

If you're going to make your mod, follow these steps:

  1. On the Start Page, click on New Project

  2. Click on Class Library (.NET Framework) or Class Library, select VB or C#, and name your mod or modpack. Select Framework as .NET Framework 4.8 or .NET 6.0. When you're finished, click Create.

  3. Right-click on References in the Solution Explorer, and press Manage NuGet packages...

  4. Go to Browse, and find Kernel Simulator and install it.

  5. You will see that your KS executable files are added to the references. In your project file, this will be added:

    <PackageReference Include="KS">
      <Version>0.0.23.0</Version>
    </PackageReference>
  1. The code will be ready in your ModName codefile:

Public Class ModName
    'Your code here
End Class

Now, follow these steps to create your first mod:

  1. Between the Public Class... and the End Class lines, let Visual Studio know that you're going to create your KS mod by writing: Implements IScript

  2. Define properties for mod information by putting below the Implements IScript:

Property Commands As Dictionary(Of String, CommandInfo) Implements IScript.Commands
Property ModPart As String Implements IScript.ModPart
Property Def As String Implements IScript.Def
Property Name As String Implements IScript.Name
Property Version As String Implements IScript.Version
  1. Make your start mod sub named StartMod() that implements the IScript.StartMod, by writing:

Sub StartMod() Implements IScript.StartMod
    'If you're going to add commands, write your commands here. Explain what are your commands and what they're going to do.
    Commands = New Dictionary(Of String, CommandInfo) From {{"command", New CommandInfo("command", ShellType.Shell, "", {"<Required> [Optional]"}, True, 1, New MyModCommand)}, ...}

    'Replace ModName with your mod name whatever you like, but it SHOULD reflect the mod purpose. You can also use verbs, adjectives, space galaxy names, and so on. This field is required.
    Name = "ModName"

    'You can specify your mod version, but it should follow the versioning guidelines and you can find it on the Internet. This field is required.
    Version = "1.0"

    'Specify the shell command type
    CmdType = ShellCommandType.Shell
    
    'The name of the mod part
    ModPart = "Main"

    'Your code below
End Sub
  1. Replace every 'Your code below comment with your code. Repeat this step on all the interface subs

  2. Make your mod stop sub named StopMod() that implements the IScript.StopMod, by writing: (You can leave it blank)

Sub StopMod() Implements IScript.StopMod
    'Your code below
End Sub
  1. Make a command handler, which can be one of the following forms: i) If you're making your commands in your mod, make a class that implements both CommandExecutor and ICommand for each command and include your statements for each:

Class MyModCommand
    Inherits CommandExecutor
    Implements ICommand

    Public Overrides Sub Execute(StringArgs As String, ListArgs() As String, ListArgsOnly As String(), ListSwitchesOnly As String()) Implements ICommand.Execute
        'Your code below for your command
    End Sub

End Class

ii) If you're making your commands which handle text arguments, write the response code below:

Class MyModCommand
    Inherits CommandExecutor
    Implements ICommand

    Public Overrides Sub Execute(StringArgs As String, ListArgs() As String, ListArgsOnly As String(), ListSwitchesOnly As String()) Implements ICommand.Execute
        If StringArgs = "Something" Then
            'Write your code
        endif
    End Sub

End Class

iii) If you're making your commands which handle subsequent arguments, write the response code below:

Class MyModCommand
    Inherits CommandExecutor
    Implements ICommand

    Public Overrides Sub Execute(StringArgs As String, ListArgs() As String, ListArgsOnly As String(), ListSwitchesOnly As String()) Implements ICommand.Execute
        If ListArgsOnly(0) = "Arg1" Then
            'Write your code for the first argument
        endif
    End Sub

End Class
  1. Make an event handler code for your mod, which can be one of the following: i) If you're making your event handler which handles what happened in the kernel, write the handle code below:

Sub InitEvents(ByVal ev As String) Implements IScript.InitEvents
    'Replace EventName with events that are found on "Events for Mod Developers"
    If ev = "EventName" Then
        'Your code below
    endif
End Sub

ii) If you're handling multiple events, write the handle code below:

Sub InitEvents(ByVal ev As String) Implements IScript.InitEvents
    'Replace EventName with events that are found on "Events for Mod Developers"
    If ev = "EventName" Then
        'Your code below
    ElseIf ev = "AnotherEvent" Then
        'Your code below
    endif
End Sub

iii) IMPORTANT NOTICE! Never try to use infinite loops in handlers unless you're making infinite loops that exits if the specified condition is met, or in the test environment. That will lock the kernel up.

  1. Make the same event handler code, but this time, with arguments provided:

Sub InitEvents(ByVal ev As String, ParamArray Args As Object()) Implements IScript.InitEvents
    'Replace EventName with events that are found on "Events for Mod Developers"
    If ev = "EventName" Then
        'Your code below
    ElseIf ev = "AnotherEvent" Then
        'Your code below
    endif
End Sub
  1. Right-click on the solution and press Build.

  2. Copy the output .dll file to KSMods directory in your profile folder (/home/<user>/ in Linux, and Users\<user>\ in Windows)

  3. Run your Kernel Simulator you've just referenced to in your project.

Optional Stuff

  1. You can make your subs anywhere on the class, but if:

    • they're on the different class, make a separate code file for it:

Public Class AnotherClass
    'Your definitions below, and so your subs, functions, interfaces, etc.
End Class
  • they're trying to re-initialize the mod by re-calling StartMod(), Try so on your test environment first, then the production environment if that worked properly.

  1. The new subs or functions should meet the following conditions:

    • They shouldn't make an infinite loop unless you're making them that exits if specified conditions are met

    • They shouldn't try to cause errors with the kernel.

    • If you're an exploiter and are making the exploit code for the kernel, do so on your test environment first then the production environment, then make your CVE report so we get attention and fix that quickly.

    • If your mod is going to extend the kernel, place your extension codes on separate subs

    • Put your sub call on one of the four subs that implements the IScript interface. Ex. If you're going to make a sub that's going to be called on mod start, place your sub call on the StartMod() sub, and then your code on your sub.

  2. If you're going to add imports, these rules must be met:

    • Don't import "KS" by itself. KS does that automatically

    • When importing modules/classes like TextWriterColor, it's written like this: Imports KS.Misc.Writers.TextWriterColor

  3. You can add dependencies for your mods.

Example

Here is the simplest example of how to make a mod:

Hello World on Mod Start, and Goodbye World on Mod Stop

Hello World is the popular starting example for all of the programmers. These examples usually start with printing the "Hello World" string to the console output or command prompt. To make your first Hello World mod, follow the project creation steps, then follow these steps:

  1. Write below the (assuming that your mod name is HelloGuys) Public Class HelloGuys: Implements IScript

Public Class HelloGuys
    Implements IScript
End Class
  1. Write above the Public Class HelloGuys:

    Imports KS.ConsoleBase.ColorTools
    Imports KS.Misc.Writers.ConsoleWriters
    Imports KS.Modifications
    Imports KS.Shell.ShellBase
  1. Make your start mod event handler by writing:

    Property Commands As Dictionary(Of String, CommandInfo) Implements IScript.Commands
    Property ModPart As String Implements IScript.ModPart
    Property Name As String Implements IScript.Name
    Property Version As String Implements IScript.Version
    Sub StartMod() Implements IScript.StartMod
        Name = "HelloGuys"
        Version = "1.0"
        ModPart = "Main"
        W("Hello World", True, GetConsoleColor(ColTypes.Neutral))
    End Sub
  1. Make your stop event handler by writing:

    Sub StopMod() Implements IScript.StopMod
        W("Goodbye World", True, GetConsoleColor(ColTypes.Neutral))
    End Sub
  1. Since we're not implementing commands nor event handlers, we're going to leave these blank:

    Sub InitEvents(ByVal ev As String) Implements IScript.InitEvents
    End Sub
    Sub InitEvents(ByVal ev As String, ParamArray Args As Object()) Implements IScript.InitEvents
    End Sub
  1. The code should look like this in VB:

    Imports KS.ConsoleBase.ColorTools
    Imports KS.Misc.Writers.ConsoleWriters
    Imports KS.Modifications
    Imports KS.Shell.ShellBase

    Public Class HelloGuys
        Implements IScript
        Property Commands As Dictionary(Of String, CommandInfo) Implements IScript.Commands
        Property ModPart As String Implements IScript.ModPart
        Property Name As String Implements IScript.Name
        Property Version As String Implements IScript.Version
        Sub StartMod() Implements IScript.StartMod
            Name = "HelloGuys"
            Version = "1.0"
            ModPart = "Main"
            Write("Hello World", True, GetConsoleColor(ColTypes.Neutral))
        End Sub
        Sub StopMod() Implements IScript.StopMod
            Write("Goodbye World", True, GetConsoleColor(ColTypes.Neutral))
        End Sub
        Sub InitEvents(ev As String) Implements IScript.InitEvents
        End Sub
        Sub InitEvents(ev As String, ParamArray Args As Object()) Implements IScript.InitEvents
        End Sub
    End Class

...Or in C#:

    using System.Collections.Generic;
    using KS.ConsoleBase;
    using KS.Modifications;
    using KS.Shell.ShellBase;
    using KS.Misc.Writers.ConsoleWriters;

    public class HelloGuys : IScript
    {
        public Dictionary<string, CommandInfo> Commands { get; set; }
        public string ModPart { get; set; }
        public string Name { get; set; }
        public string Version { get; set; }
        public void StartMod()
        {
            Name = "HelloGuys";
            Version = "1.0";
            ModPart = "Main";
            TextWriterColor.Write("Hello World", true, ColorTools.ColTypes.Neutral);
        }
        public void StopMod()
        {
            TextWriterColor.Write("Goodbye World", true, ColorTools.ColTypes.Neutral);
        }
        public void InitEvents(string ev)
        {
        }
        public void InitEvents(string ev, params object[] Args)
        {
        }
    }
  1. Right-click on the solution and press Build.

  2. Run the target KS once you copied the generated .dll file.

More Examples

You can also add manual page files to your mods. Consult the for more info.

If you want to check out more examples, feel free to check them out in the respository in GitHub.

this page
here
Mod Manual Page
KSModExamples