Skip to content

vibec0re/unic0rn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

216 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ„ UNIC0RN WEBRUNNER v2.0 - V1B3C0R3 EDITION

Run WebAssembly & Python in your browser with REAL-TIME streaming output!

Status WASI Python Rust License

โœจ Features

๐Ÿš€ Core Capabilities

  • WASI Preview 2 Components - Full std library support for WebAssembly
  • Python Runtime - 27MB WASI-compiled Python interpreter
  • Real-time Output Streaming - See output as it happens
  • INT10H Graphics Protocol - Retro graphics rendering in terminal
  • Run Groups - Organize and filter apps by category
  • WebSocket Communication - Bidirectional real-time messaging
  • File Manager - Upload, view, and manage files
  • Multi-app Support - Run multiple WASM/Python apps simultaneously

๐ŸŽจ V1B3C0R3 WebUI Features

  • Cyber-punk aesthetic with neon glow effects
  • XTerm.js terminal with CRT scanlines
  • Drag & drop upload for WASM and Python files
  • Live metrics display (CPU, Memory, Runtime)
  • Responsive 3-panel layout
  • Canvas overlay for graphics rendering

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   WebUI (Yew/WASM)                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  App List  โ”‚   Terminal    โ”‚    Controls     โ”‚   โ”‚
โ”‚  โ”‚            โ”‚   XTerm.js    โ”‚                 โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€WebSocketโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              UNIC0RN Server (Rust)                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚         Wasmtime Runtime (WASI P2)          โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚   WASM   โ”‚  Python  โ”‚   TCP Server   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚Component โ”‚  Runtime โ”‚   (Port 1337)  โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Prerequisites

  • Rust 1.75+ with wasm32-wasip2 and wasm32-unknown-unknown targets
  • Trunk for WebUI building

1. Start the Server

cargo run --bin unic0rn_server

2. Build & Serve WebUI

cd unic0rn_web_next
trunk serve --open

3. Upload & Run Apps

Via CLI:

# Upload WASM component
cargo run --bin unic0rn_cli -- upload target/wasm32-wasip2/release/app.wasm

# Upload Python script
cargo run --bin unic0rn_cli -- upload-python script.py

Via WebUI:

  • Click "UPLOAD FILE" or drag & drop
  • Select app from list
  • Click "START" to run

๐Ÿ“ Project Structure

unic0rn/
โ”œโ”€โ”€ unic0rn_server/        # Main server with Wasmtime runtime
โ”œโ”€โ”€ unic0rn_web_next/      # V2.0 WebUI (Yew + XTerm.js)
โ”œโ”€โ”€ unic0rn_cli/           # Command-line client
โ”œโ”€โ”€ unic0rn_data/          # Shared data structures
โ”œโ”€โ”€ unic0rn_sdk/           # SDK for building WASM apps
โ”œโ”€โ”€ examples/              # Example apps and demos
โ”‚   โ”œโ”€โ”€ python/           
โ”‚   โ”‚   โ”œโ”€โ”€ int10h/       # Graphics demos
โ”‚   โ”‚   โ”œโ”€โ”€ tests/        # Test scripts
โ”‚   โ”‚   โ””โ”€โ”€ interactive/  # REPL examples
โ”‚   โ””โ”€โ”€ wasm/             # WASM examples
โ””โ”€โ”€ docs/                  # Documentation

๐ŸŽฎ INT10H Graphics Protocol

Custom escape sequence protocol for rendering graphics in the terminal:

ESC[10;<cmd>;<params>h

Commands:

  • Clear (0): ESC[10;0h - Clear canvas
  • Rectangle (1): ESC[10;1;<x>;<y>;<w>;<h>;<color>h
  • Sprite (2): ESC[10;2;<x>;<y>;<w>;<h>;<base64_data>h
  • Text (3): ESC[10;3;<x>;<y>;<color>;<text>h
  • Line (4): ESC[10;4;<x1>;<y1>;<x2>;<y2>;<color>h
  • Circle (5): ESC[10;5;<x>;<y>;<radius>;<color>h

Example (Python):

# Draw a cyan rectangle
print(f"\x1b[10;1;10;10;100;50;#00FFFFh", end='', flush=True)

๐Ÿ› ๏ธ Development

Building WASM Apps

# Create new app
cargo new --lib my_app
cd my_app

# Add WASI target
rustup target add wasm32-wasip2

# Build as component
cargo build --release --target wasm32-wasip2

Running Tests

# Run all tests
cargo test --all

# Run specific example
cargo run --bin unic0rn_cli -- upload examples/python/int10h/int10h_demo.py

WebUI Development

cd unic0rn_web_next

# Development server with auto-reload
trunk serve --open

# Production build
trunk build --release

๐Ÿ“š API Documentation

WebSocket Messages

Client โ†’ Server:

enum ClientMessage {
    ListApps,
    StartApp { uuid: Uuid },
    StopApp { uuid: Uuid },
    DeleteApp { uuid: Uuid },
    UploadFile { name: String, data: Vec<u8> },
    TTYInput { uuid: Uuid, data: Vec<u8> },
}

Server โ†’ Client:

enum ServerMessage {
    AppList(Vec<AppInfo>),
    AppStarted { uuid: Uuid },
    AppStopped { uuid: Uuid, reason: String },
    AppOutput { uuid: Uuid, data: Vec<u8> },
    AppMetrics { uuid: Uuid, metrics: ResourceStats },
}

๐ŸŽจ Customization

Themes

Edit unic0rn_web_next/assets/styles/v1b3c0r3.css to customize colors:

:root {
    --cyber-pink: #FF007F;
    --cyber-cyan: #00FFFF;
    --matrix-green: #00FF41;
    --void-black: #0A0A0A;
}

Run Groups

Apps are automatically categorized by name patterns:

  • test_* โ†’ TEST group
  • demo_* โ†’ DEMO group
  • int10h_* โ†’ GFX group
  • server_* โ†’ NET group

๐Ÿ”ง Troubleshooting

No Output Captured

  • Ensure building with wasm32-wasip2 target (not wasm32-wasi)
  • Check server logs for StreamWriter messages
  • Verify WebSocket connection in browser console

WebUI Not Loading

  • Clear browser cache (Ctrl+Shift+R)
  • Check trunk serve is running on port 8080
  • Verify no CSP violations in console

Python Import Errors

  • Python runtime has limited stdlib
  • No pip/external packages available
  • Use built-in modules only

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'โœจ Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open Pull Request

๐Ÿ“„ License

MIT License - See LICENSE file

๐Ÿ™ Acknowledgments

  • Wasmtime - WebAssembly runtime
  • XTerm.js - Terminal emulator
  • Yew - Rust/WASM framework
  • Trunk - WASM web bundler

๐Ÿฆ„ V1B3C0R3 COMPLETE! ๐Ÿ’ซ

Built with ๐Ÿ’œ by the UNIC0RN team

LET'S FUCKING GOOOOO!!! ๐Ÿš€

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors