#!/usr/bin/env node // Do not copy or edit code read LICENSE First. // This Script is coded by Termux Professor (Youtuber) const readline = require('readline'); const { execSync, spawn } = require('child_process'); function clearScreen() { process.stdout.write('\x1Bc'); } function printBanner() { console.log('\x1b[1;92m ╦ ╦┬┌┐┌ \x1b[1;91m╔╦╗┌─┐┬─┐┌┬┐┬ ┬─┐ ┬'); console.log('\x1b[1;92m ║║║││││ \x1b[1;91m║ ├┤ ├┬┘││││ │┌┴┬┘'); console.log('\x1b[1;92m ╚╩╝┴┘└┘ \x1b[1;91m╩ └─┘┴└─┴ ┴└─┘┴ └─'); console.log('\x1b[1;92m [+] YouTube: \x1b[1;91mTermuxProfessor'); console.log('\x1b[1;92m [+] Github: \x1b[1;91mtermuxprofessor\x1b[1;97m'); console.log(''); } function askQuestion(query) { const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); return new Promise(resolve => rl.question(query, ans => { rl.close(); resolve(ans.trim()); })); } async function main() { clearScreen(); printBanner(); const input = await askQuestion('Does WIN10TP.iso File In Your Download Folder?(Yes/No) : '); if (/^(yes|y)$/i.test(input)) { clearScreen(); try { process.chdir(process.env.HOME || process.env.USERPROFILE); } catch (err) { console.error('Failed to change directory to home:', err.message); } try { console.log('Acquiring wake lock...'); execSync('termux-wake-lock', { stdio: 'inherit' }); console.log('Installing x11-repo...'); execSync('pkg install x11-repo -y', { stdio: 'inherit' }); console.log('Installing qemu-system-x86_64...'); execSync('pkg install qemu-system-x86_64 -y', { stdio: 'inherit' }); } catch (err) { console.error('Error during package installation:', err.message); process.exit(1); } clearScreen(); console.log('\x1b[1;92m1] Allow Storage Permission To Termux.\x1b[0m'); await new Promise(r => setTimeout(r, 3000)); clearScreen(); const ram = await askQuestion('Select RAM size In MB Ex 1GB = 1024 : '); console.log('[+] Server Is Running....'); console.log('\x1b[1;91mYour Server IP is: 127.0.0.1:2\x1b[0m'); // Run qemu-system-x86_64 with given RAM and ISO const qemuArgs = ['-m', ram, '-cdrom', 'storage/downloads/WIN10TP.iso', '-vnc', '127.0.0.1:2']; const qemu = spawn('qemu-system-x86_64', qemuArgs, { stdio: 'inherit' }); qemu.on('close', (code) => { console.log(`QEMU exited with code ${code}`); process.exit(code); }); } else if (/^(no|n)$/i.test(input)) { console.log('\x1b[1;91m1. First Download WIN10TP.iso file from this Link: \x1b[1;92mhttp://bit.ly/wintermux\x1b[0m'); console.log('2. Put WIN10TP.iso file into download folder.'); process.exit(2); } else { console.log('\x1b[1;91mInvalid Option\x1b[0m'); process.exit(1); } } main();