This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
GreenByteSoftware's profile picture

[Version 5] SystemC - the thing that takes over OS work

Started by GreenByteSoftware, 24 December 2016 - 01:02 PM
GreenByteSoftware #1
Posted 24 December 2016 - 02:02 PM
SystemC

More Than Just an Init System!



Hello again,

Today I would like to present you SystemC - something that became a bit bigger than I wanted it to be. Now it's basically like an OS, a base for an OS with really cool features like services similar to SystemD ones, file permissions, PoC user support (users are saved nowhere, sudo does no authentication), sandboxing support (I want you to try to break out of it) and many more things.

Currently half of the programs are very nig rigged, just like part of the inside code (for example support for SIGKILL was very hacky).

List of programs:

Spoilerinit - initializes SystemC
systemctl - managing services
systemc-nspawn - sandboxing
ls - listing files improved
chmod - change file permissions
chown - change file owners
kill - send signals to threads
ps - show threads
sudo - should be su, switches users
texec - useful for services
whoami - prints the current user id

This was sort of a side project when not feeling doing all the game hacking or game dev stuff I'm used to doing now.

How to install? Well, for now I will not create the installer because of so many files (7, I know), but you can grab all of these from github.
Link: https://github.com/G...oftware/systemc
Install (should work): pastebin run W5ZkVYSi GreenByteSoftware systemc

So some FAQ:

SpoilerWhat's next? IDK, I am doing a lot of game hacking lately, specifically, csgo. So, this is a small side project.

What are services? Services are programs which run in the background. For example you can run something like a network command centre as a service.

How to define services? You can define them inside etc/systemc/system/ directory naming the file as somename.service. Inside, type in [Service] and in the next line ExecStart=, right after = without a space type the command you want to be executed. If you want to run the service on start, add [Unit] and in the next line type Wants=graphical.target. You will need to enable the service later. There is more, but much is not implemented yet. You can look how it looks like in actual SystemD here: https://access.redha...Unit_Files.html

How to start services? You need to use an utility called systemctl located ad bin directory. You are better of to add that directory to shell path in your startup (shell.setPath(shell.getPath().."sc_root_path/bin")). Systemctl start, stop, enable, disable do pretty much what they should do. Enable and disable toggle if the service gets started on boot.

Targets? Targets are basically the target state of the system. Currently there is only one target - graphical.target. When you run init, it defaults to this target (you can pass the target you want to run SystemC as an argument to init). The services which "want" the target and which are enabled at the same time get a directory inside the target making SystemC notice it on the next reboot and run it.

SystemC-Nspawn. What is this? It basically is the Chroot script I posted earlier but integrated with SystemC a bit.
What are the options? Basically run the command without arguments, it should show the usage. Unless you know what you are doing, you should not type the argument to not copy the ROM folder. Without SystemC, the containers should work just fine, as long as you do not use -b option.

Has SystemD come too far? Why? Will it include the full office suite?
Yes to all.

Things to do:
SpoilerAbility to delay between things to make you look cool
Timers
Other SystemC units
Fix one quirk in SystemC library's run function
SystemC Office, of course

And for the last, I made this up. Linux users might understand this.
SpoilerWhat you guys are referring to as Linux, is in fact, SystemD/Linux, or as I've recently taken to calling it, SystemD plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning SystemD system made useful by the SystemD bloat, bloat utilities and bloat system components comprising a full OS as defined by US.
Many computer users run a modified version of the SystemD system every day, realizing it very well. Through a peculiar turn of events, the version of SystemD which is widely used today is often called "Linux", and many of its users are not aware that it is basically the SystemD system, developed by the SystemD Project.
There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the SystemD awesomeness system: the whole system is basically SystemD with Linux added, or SystemD/Linux. All the so-called "Linux" distributions are really distributions of SystemD/Linux.

- Lennart Poettering 2019

Credits:
SpoilerLymia - for writing the original chroot script
Dan200 - for making the bios.lua and CraftOS
Bryan Lunduke - for somehow inspiring me to make this
Edited on 14 August 2017 - 05:13 PM
クデル #2
Posted 16 January 2017 - 03:35 AM
This should do the job, http://www.computercraft.info/forums2/index.php?/topic/17387-gitget-version-2-release/
Admicos #3
Posted 16 January 2017 - 08:55 AM
That guy who does "Linux Suc*s" talks every year - for somehow inspiring me to make this

His name is Bryan Lunduke
GreenByteSoftware #4
Posted 17 January 2017 - 04:43 PM
That guy who does "Linux Suc*s" talks every year - for somehow inspiring me to make this

His name is Bryan Lunduke
Thanks

Thank you! I knew it existed, but since this forum does not allow searches of less than 4 characters I could not find it.
H4X0RZ #5
Posted 17 January 2017 - 06:56 PM
Thank you! I knew it existed, but since this forum does not allow searches of less than 4 characters I could not find it.

you can search for more advanced stuff using google. Just search for
computercraft.info: <your query here>
and it should show you all the pages google knows of.
GreenByteSoftware #6
Posted 17 January 2017 - 08:15 PM
Thank you! I knew it existed, but since this forum does not allow searches of less than 4 characters I could not find it.

you can search for more advanced stuff using google. Just search for
computercraft.info: <your query here>
and it should show you all the pages google knows of.
Oh yes! The good old never old google.
GreenByteSoftware #7
Posted 26 March 2017 - 07:47 PM
Hey! I happened to be bored again so I improved the system dramatically. Just read the commit message, the update contains some cool stuff!

Ok, I leave it here:
SpoilerVersion 2

Reworked the way things load.
Added getty which loads shell after all the services start. It can execute anything (just set by code) and it also prepares shell api for use. Everything seems to work with the api (at least /rom/programs/shell launches and does not crash).
Just like services, getty runs as a coroutine. It runs exactly like other services, except it is a foreground one.
Every coroutine has a PID, UID, and parent PID information. All APIs can identify who is the caller by using systemc.process table. Though, it can be overwritten and a local copy exists in systemc as _process. Also, a complete processes table can be retrieved.
Edited on 26 March 2017 - 05:47 PM
GreenByteSoftware #8
Posted 26 March 2017 - 09:13 PM
Another little update fixing some bugs.
GreenByteSoftware #9
Posted 27 March 2017 - 04:56 PM
Another day another update. Now there is a fs api replacement which uses the uid information. Also, setuid call has been added to systemc api. Sudo uses it. Just try it out.
GreenByteSoftware #10
Posted 14 August 2017 - 07:16 PM
Okay, some more changes, a lot of them actually. Now it is pretty stable and has fully working file permissions support. Also, improved sandboxing, now from my tests I could stack at least 3 sandboxes one inside the other. And other stuff, just check the commit message on github.