An open API service indexing awesome lists of open source software.

https://github.com/hi-doki/pipios

A basic simulated os/kernel idk built with Python
https://github.com/hi-doki/pipios

cli college-project command-line cryptography educational-project encryption filesystem filesystem-simulation hobby-project json mini-os open-source operating-system python simulated-os simulator user-management

Last synced: 20 days ago
JSON representation

A basic simulated os/kernel idk built with Python

Awesome Lists containing this project

README

        

# PiPiOS


Views




PiPiOS is a simulated operating system built with Python, featuring a simple file system, user management, and a command-line interface. It allows users to create directories, edit files, manage user accounts, and more.

---

## Features

- **File System**:
- Create directories and files.
- Edit files using a simple text editor (`nano`).
- Save the filesystem structure in a JSON file.

- **User Management**:
- Create users with encrypted passwords.
- Differentiate between admin and non-admin users.
- Login and logout functionality with a secure login screen.

- **Command-Line Interface**:
- Commands like `cd`, `ls`, `mkdir`, `nano`, `login`, `logout`, and more.
- Dynamic paths with support for relative and absolute navigation.

---

## Main Commands

| Command|Description|Syntax|Example|
|--------|-----------|-------|------|
|**`cd`**|Change the current directory.| `cd `| `cd ~\users\admin\Home\Documents`|
|**`ls`**|List the contents of the current directory.| `ls`| `ls`|
|**`mkdir`**|Create a new directory.| `mkdir `| `mkdir my_folder`|
|**`nano`**|Edit or create a file using a simple text editor.| `nano `| `nano cool.txt`|
|**`read_file`**|Display the contents of a file.| `read_file `| `read_file cool.txt`|
|**`create_user`**|Create a new user. (Admins only).| `create_user `| `create_user alice pass123`|
|**`login`**|Log in to an existing user account.| `login `| `login admin admin123`|
|**`logout`**|Log out from the current session.| `logout`| `logout`|
|**`help`**|Display a list of all available commands with usage examples.| `help`| `help`|

---

## How It Works

### File System
- The file system is represented as a nested dictionary and is saved/loaded from `filesystem.json`.
- Directories are stored as nested dictionaries, and files are stored as key-value pairs where the value is the file content.

### User Management
- User accounts are stored in `users.json`, with encrypted passwords using the `cryptography` library.
- Only logged-in users can access the file system.
- Admin users have additional permissions (e.g., creating new users).

---

## Getting Started

### Prerequisites
- Python 3.7 or higher
- Install dependencies:
```bash
pip install cryptography
```

### Running PiPiOS
1. Clone the repository:
```bash
git clone https://github.com/hi-doki/PiPiOS.git
cd PiPiOS
```
2. Run the main script:
```bash
python pipios.py
```

### Example Usage
1. Log in as the default admin (`admin` with password `admin123`).
2. Create a new user:
```plaintext
~ > create_user alice password123 True
```
3. Switch to the new user:
```plaintext
~ > logout
~ > login alice password123
```

---

## File Structure
```plaintext
.\
├── pipios.py # Main script to run PiPiOS
├── filesystem.json # JSON file representing the file system structure
├── users.json # JSON file storing user data (encrypted passwords)
├── secret.key # Encryption key for securing user passwords
```

---

## Future Features
- Add permissions for user-specific directories and files.
- Improve the file editor with more functionality.
- Implement file copy, move, and delete commands.

---

## License
This project is licensed under the MIT License. See `LICENSE` for more details.

---

## Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.