Skip to content

Repository files navigation

🖥️ Laptop Control System

A React Native mobile app paired with a Python WebSocket server that lets you control your Windows laptop remotely from your phone — over your local Wi-Fi network.

✨ Features

  • 🔌 WebSocket-based real-time communication between phone and PC
  • Instant commands — shutdown, restart, sleep, volume & brightness control
  • 🖥️ Run any shell command on your laptop from the app
  • 🔒 Security layer — blocks dangerous commands (format, rm -rf, registry edits, etc.)
  • ⏱️ Command timeout — auto-kills commands that take too long
  • 💓 Ping/heartbeat — check server uptime from the app
  • 📱 Built with React Native 0.84 + TypeScript

🏗️ Architecture

┌─────────────────────┐        WebSocket (ws://)        ┌────────────────────────┐
│   📱 Mobile App     │  ──────────────────────────►   │   💻 Python Server      │
│  (React Native)     │  ◄──────────────────────────   │   (server.py)           │
│  Android / iOS      │       JSON responses            │   Port 8765             │
└─────────────────────┘                                 └────────────────────────┘

📋 Prerequisites

For the Python Server (Laptop)

  • Python 3.10+
  • websockets library
pip install websockets

Optional: Install nircmd for volume & brightness control commands on Windows.

For the Mobile App (Phone)


🚀 Getting Started

1. Start the Python Server on your Laptop

python server.py

You'll see output like:

============================================
   Laptop Control System — Server v2
============================================
[12:00:00] [*] Starting server…
[12:00:00] [*] Mobile app IP  : 192.168.1.100
[12:00:00] [*] Listening on   : ws://192.168.1.100:8765

Note down the IP address — you'll need it in the app.

2. Start the React Native App

Start the Metro bundler:

npm start

Then in a separate terminal, run on your device:

# Android
npm run android

# iOS (macOS only)
npm run ios

3. Connect the App to Your Server

Enter the WebSocket URL in the app:

ws://YOUR_LAPTOP_IP:8765

Make sure your phone and laptop are on the same Wi-Fi network.


🎮 Supported Commands

Built-in Shortcuts

Command Action
shutdown Shutdown the laptop in 5s
restart Restart the laptop in 5s
sleep Put the laptop to sleep
vol_up Increase system volume
vol_down Decrease system volume
bright_up Increase screen brightness
bright_down Decrease screen brightness
ping Check server connection/uptime

Custom Commands

You can send any Windows shell command directly through the app (e.g., notepad, ipconfig, tasklist).


🔒 Security

The following commands are blocked and will return an error:

  • format, del /s /f, rd /s, rmdir /s
  • rm -rf, rm -fr, mkfs, dd if=
  • Fork bombs (:(){:|:&};:)
  • shutdown /f (forced shutdown)
  • Registry edits (reg delete, bcdedit)
  • cipher /w, sfc /scannow /offbootdir

Commands also have a 10-second timeout to prevent hanging.


📁 Project Structure

LaptopControlSystem/
├── server.py          # Python WebSocket server (run on laptop)
├── App.tsx            # Main React Native app screen
├── index.js           # Entry point
├── android/           # Android native project
├── ios/               # iOS native project
├── package.json       # Node.js dependencies
└── tsconfig.json      # TypeScript config

🛠️ Tech Stack

Layer Technology
Mobile App React Native 0.84, TypeScript
Server Python 3, asyncio, websockets
Communication WebSocket (JSON messages)

🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.


📜 License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages