Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- index.html +182 -167
index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>vY Agent
|
| 8 |
<!-- Importando Fontes e Ícones -->
|
| 9 |
<link
|
| 10 |
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;600;800&display=swap"
|
|
@@ -213,8 +213,8 @@
|
|
| 213 |
left: 0;
|
| 214 |
width: 100%;
|
| 215 |
height: 100%;
|
| 216 |
-
background: rgba(5, 5, 5, 0.
|
| 217 |
-
backdrop-filter: blur(
|
| 218 |
z-index: 50;
|
| 219 |
display: flex;
|
| 220 |
flex-direction: column;
|
|
@@ -443,7 +443,7 @@
|
|
| 443 |
|
| 444 |
.msg.system {
|
| 445 |
align-self: center;
|
| 446 |
-
background: rgba(0,0,0,0.1);
|
| 447 |
color: #666;
|
| 448 |
font-size: 0.75rem;
|
| 449 |
padding: 2px 8px;
|
|
@@ -466,6 +466,39 @@
|
|
| 466 |
outline: none;
|
| 467 |
}
|
| 468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 469 |
/* --- Footer --- */
|
| 470 |
footer {
|
| 471 |
height: 30px;
|
|
@@ -486,117 +519,33 @@
|
|
| 486 |
|
| 487 |
/* --- Animations & Utilities --- */
|
| 488 |
@keyframes pulse {
|
| 489 |
-
0% {
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
}
|
| 493 |
-
|
| 494 |
-
70% {
|
| 495 |
-
opacity: 0.7;
|
| 496 |
-
box-shadow: 0 0 0 6px rgba(0, 255, 157, 0);
|
| 497 |
-
}
|
| 498 |
-
|
| 499 |
-
100% {
|
| 500 |
-
opacity: 1;
|
| 501 |
-
box-shadow: 0 0 0 0 rgba(0, 255, 157, 0);
|
| 502 |
-
}
|
| 503 |
}
|
| 504 |
|
| 505 |
@keyframes loading {
|
| 506 |
-
0% {
|
| 507 |
-
|
| 508 |
-
}
|
| 509 |
-
|
| 510 |
-
50% {
|
| 511 |
-
width: 100%;
|
| 512 |
-
}
|
| 513 |
-
|
| 514 |
-
100% {
|
| 515 |
-
width: 0;
|
| 516 |
-
}
|
| 517 |
}
|
| 518 |
|
| 519 |
-
@keyframes blink {
|
| 520 |
|
| 521 |
-
|
| 522 |
-
100% {
|
| 523 |
-
opacity: 1;
|
| 524 |
-
}
|
| 525 |
-
|
| 526 |
-
50% {
|
| 527 |
-
opacity: 0;
|
| 528 |
-
}
|
| 529 |
-
}
|
| 530 |
-
|
| 531 |
-
.cursor {
|
| 532 |
-
display: inline-block;
|
| 533 |
-
width: 8px;
|
| 534 |
-
height: 15px;
|
| 535 |
-
background: var(--primary);
|
| 536 |
-
animation: blink 1s infinite;
|
| 537 |
-
vertical-align: middle;
|
| 538 |
-
}
|
| 539 |
|
| 540 |
/* Notifications */
|
| 541 |
-
.toast-container {
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
right: 20px;
|
| 545 |
-
display: flex;
|
| 546 |
-
flex-direction: column;
|
| 547 |
-
gap: 10px;
|
| 548 |
-
z-index: 1000;
|
| 549 |
-
}
|
| 550 |
-
|
| 551 |
-
.toast {
|
| 552 |
-
background: var(--bg-panel-lighter);
|
| 553 |
-
border-left: 4px solid var(--primary);
|
| 554 |
-
color: var(--text-main);
|
| 555 |
-
padding: 15px 20px;
|
| 556 |
-
border-radius: 4px;
|
| 557 |
-
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
| 558 |
-
font-size: 0.9rem;
|
| 559 |
-
animation: slideIn 0.3s ease;
|
| 560 |
-
display: flex;
|
| 561 |
-
align-items: center;
|
| 562 |
-
gap: 10px;
|
| 563 |
-
}
|
| 564 |
-
|
| 565 |
-
@keyframes slideIn {
|
| 566 |
-
from {
|
| 567 |
-
transform: translateX(100%);
|
| 568 |
-
opacity: 0;
|
| 569 |
-
}
|
| 570 |
-
|
| 571 |
-
to {
|
| 572 |
-
transform: translateX(0);
|
| 573 |
-
opacity: 1;
|
| 574 |
-
}
|
| 575 |
-
}
|
| 576 |
|
| 577 |
/* Responsive */
|
| 578 |
@media (max-width: 1024px) {
|
| 579 |
-
main {
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
}
|
| 584 |
-
|
| 585 |
-
.dashboard {
|
| 586 |
-
order: 2;
|
| 587 |
-
}
|
| 588 |
-
|
| 589 |
-
.sidebar {
|
| 590 |
-
order: 1;
|
| 591 |
-
}
|
| 592 |
-
|
| 593 |
-
.right-panel {
|
| 594 |
-
order: 3;
|
| 595 |
-
}
|
| 596 |
-
|
| 597 |
-
.metrics-grid {
|
| 598 |
-
grid-template-columns: 1fr;
|
| 599 |
-
}
|
| 600 |
}
|
| 601 |
</style>
|
| 602 |
</head>
|
|
@@ -607,7 +556,7 @@
|
|
| 607 |
<header>
|
| 608 |
<div class="brand">
|
| 609 |
<i class="fa-solid fa-robot"></i>
|
| 610 |
-
<span>vY AGENT <span style="font-weight:400; opacity: 0.7;">//
|
| 611 |
</div>
|
| 612 |
<div class="status-badge">
|
| 613 |
<div class="status-dot"></div>
|
|
@@ -623,20 +572,20 @@
|
|
| 623 |
<!-- Sidebar: Controls -->
|
| 624 |
<section class="panel sidebar">
|
| 625 |
<div class="control-group">
|
| 626 |
-
<h3><i class="fa-solid fa-terminal"></i>
|
| 627 |
<div class="btn-grid">
|
| 628 |
<button onclick="runCommand('reboot')" id="btnReboot" disabled>
|
| 629 |
<i class="fa-solid fa-power-off"></i> Reboot
|
| 630 |
</button>
|
| 631 |
-
<button onclick="runCommand('
|
| 632 |
-
<i class="fa-solid fa-network-wired"></i> Ping
|
| 633 |
-
</button>
|
| 634 |
-
<button class="danger" onclick="runCommand('shutdown')" id="btnShutdown" disabled>
|
| 635 |
<i class="fa-solid fa-skull"></i> Shutdown
|
| 636 |
</button>
|
| 637 |
<button onclick="runCommand('screenshot')" id="btnScreen" disabled>
|
| 638 |
<i class="fa-solid fa-camera"></i> Screen
|
| 639 |
</button>
|
|
|
|
|
|
|
|
|
|
| 640 |
</div>
|
| 641 |
</div>
|
| 642 |
|
|
@@ -651,31 +600,24 @@
|
|
| 651 |
</div>
|
| 652 |
|
| 653 |
<div class="control-group">
|
| 654 |
-
<h3><i class="fa-
|
| 655 |
-
<div class="input-group">
|
| 656 |
-
<input type="text" id="webSearchInput" placeholder="Ex: Preço Bitcoin...">
|
| 657 |
-
<button onclick="webSearch()" id="btnSearch" disabled>
|
| 658 |
-
<i class="fa-solid fa-rocket"></i> Buscar
|
| 659 |
-
</button>
|
| 660 |
-
</div>
|
| 661 |
-
</div>
|
| 662 |
-
|
| 663 |
-
<div class="control-group">
|
| 664 |
-
<h3><i class="fa-solid fa-shield-halved"></i> Segurança</h3>
|
| 665 |
<div style="font-size: 0.8rem; color: var(--text-muted);">
|
| 666 |
<p>Chave de Sessão: <span style="font-family: var(--font-mono);">AES-256-ENC</span></p>
|
| 667 |
<p>Auditoria: <span style="color: var(--primary);">Ativa (7 Dias)</span></p>
|
| 668 |
<p>Firewall: <span style="color: var(--primary);">Bloqueado (C2)</span></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
</div>
|
| 670 |
</div>
|
| 671 |
</section>
|
| 672 |
|
| 673 |
<!-- Center: Dashboard -->
|
| 674 |
<section class="panel dashboard">
|
| 675 |
-
|
| 676 |
<!-- Scan Overlay -->
|
| 677 |
<div id="scanOverlay">
|
| 678 |
-
<div class="scan-text" id="scanText">INICIANDO
|
| 679 |
<div class="scan-loader">
|
| 680 |
<div class="scan-bar" id="scanBar"></div>
|
| 681 |
</div>
|
|
@@ -701,11 +643,11 @@
|
|
| 701 |
</div>
|
| 702 |
<div class="metric-card">
|
| 703 |
<div class="metric-title">
|
| 704 |
-
<span>
|
| 705 |
-
<i class="fa-solid fa-
|
| 706 |
</div>
|
| 707 |
-
<div class="metric-value" id="
|
| 708 |
-
<div style="font-size: 0.7rem; color: var(--
|
| 709 |
</div>
|
| 710 |
</div>
|
| 711 |
|
|
@@ -718,12 +660,11 @@
|
|
| 718 |
</div>
|
| 719 |
<div class="browser-content" id="browserContent">
|
| 720 |
<div style="text-align: center; margin-top: 50px;">
|
| 721 |
-
<h2 style="color: #333;">
|
| 722 |
-
<p style="color: #666; margin-top: 10px;">
|
| 723 |
</div>
|
| 724 |
</div>
|
| 725 |
</div>
|
| 726 |
-
|
| 727 |
</section>
|
| 728 |
|
| 729 |
<!-- Right: Logs & Chat -->
|
|
@@ -751,8 +692,7 @@
|
|
| 751 |
|
| 752 |
<!-- Footer -->
|
| 753 |
<footer>
|
| 754 |
-
<span>Built with anycoder</span> | <a href="https://huggingface.co/spaces/akhaliq/anycoder"
|
| 755 |
-
target="_blank">huggingface.co/spaces/akhaliq/anycoder</a>
|
| 756 |
</footer>
|
| 757 |
|
| 758 |
<!-- Toast Container -->
|
|
@@ -763,9 +703,12 @@
|
|
| 763 |
const state = {
|
| 764 |
cpuHistory: new Array(20).fill(0),
|
| 765 |
ramHistory: new Array(20).fill(0),
|
| 766 |
-
isOnline: false,
|
| 767 |
scanProgress: 0,
|
| 768 |
-
socketInterval: null
|
|
|
|
|
|
|
|
|
|
| 769 |
};
|
| 770 |
|
| 771 |
// --- Funções de Utilidade ---
|
|
@@ -808,6 +751,16 @@
|
|
| 808 |
entry.innerHTML = content;
|
| 809 |
terminal.insertBefore(entry, terminal.lastElementChild);
|
| 810 |
terminal.scrollTop = terminal.scrollHeight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 811 |
}
|
| 812 |
|
| 813 |
function addBotMessage(text) {
|
|
@@ -828,38 +781,62 @@
|
|
| 828 |
chat.scrollTop = chat.scrollHeight;
|
| 829 |
}
|
| 830 |
|
| 831 |
-
// --- IA MOCK (
|
| 832 |
function processAIResponse(userText) {
|
| 833 |
const lowerText = userText.toLowerCase();
|
| 834 |
|
| 835 |
-
// Lógica simples de "Cérebro" do Agente
|
| 836 |
if (lowerText.includes('status')) {
|
| 837 |
-
return `Status do Sistema: CPU ${state.cpuHistory[19]}%, RAM ${state.ramHistory[19]}GB. Rede estável.`;
|
| 838 |
} else if (lowerText.includes('screenshot')) {
|
| 839 |
return `Captura de ecrã enviada. [Arquivo: screenshot_${Date.now()}.png]`;
|
| 840 |
} else if (lowerText.includes('shutdown') || lowerText.includes('off')) {
|
| 841 |
return `Comando recebido. Iniciando procedimento de desligamento seguro...`;
|
| 842 |
} else if (lowerText.includes('help')) {
|
| 843 |
-
return `Comandos disponíveis: /status, /screenshot, /shutdown, /reboot.`;
|
| 844 |
-
} else if (lowerText.includes('
|
| 845 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 846 |
} else {
|
| 847 |
return `Comando "${userText}" reconhecido pelo núcleo vY. A aguardar confirmação externa.`;
|
| 848 |
}
|
| 849 |
}
|
| 850 |
|
| 851 |
-
// ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 852 |
async function runSystemScan() {
|
| 853 |
const overlay = document.getElementById('scanOverlay');
|
| 854 |
const bar = document.getElementById('scanBar');
|
| 855 |
const text = document.getElementById('scanText');
|
| 856 |
const statusBadge = document.getElementById('systemStatus');
|
| 857 |
|
| 858 |
-
// Atualiza UI para estado de scan
|
| 859 |
overlay.style.opacity = '1';
|
| 860 |
overlay.style.pointerEvents = 'all';
|
| 861 |
|
| 862 |
-
// Atualiza botões para estado desabilitado
|
| 863 |
document.querySelectorAll('button').forEach(b => b.disabled = true);
|
| 864 |
|
| 865 |
const steps = [
|
|
@@ -870,6 +847,7 @@
|
|
| 870 |
{ msg: "SCANNING NETWORK INTERFACE...", delay: 3000 },
|
| 871 |
{ msg: "VERIFYING SECURITY PROTOCOLS...", delay: 3600 },
|
| 872 |
{ msg: "CONNECTING TO AI CORE...", delay: 4000 },
|
|
|
|
| 873 |
{ msg: "COMPLETE", delay: 4500 }
|
| 874 |
];
|
| 875 |
|
|
@@ -880,28 +858,51 @@
|
|
| 880 |
bar.style.width = '0%';
|
| 881 |
}
|
| 882 |
|
| 883 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 884 |
const cpuCores = navigator.hardwareConcurrency || 4;
|
| 885 |
const ramTotal = navigator.deviceMemory ? (navigator.deviceMemory * 1024) : 8192;
|
| 886 |
const ramGB = (ramTotal / 1024).toFixed(1);
|
| 887 |
const osInfo = navigator.platform;
|
| 888 |
const browserInfo = navigator.userAgent.split(')')[0] + ')';
|
| 889 |
|
| 890 |
-
// Análise de Dados
|
| 891 |
logToTerminal(`Sistema Operacional: ${osInfo}`, 'info');
|
| 892 |
logToTerminal(`Navegador: ${browserInfo}`, 'info');
|
| 893 |
logToTerminal(`CPU Detetada: ${cpuCores} Threads`, 'info');
|
| 894 |
logToTerminal(`RAM Total: ${ramGB} GB`, 'info');
|
| 895 |
|
| 896 |
-
// Atualiza Valores Iniciais
|
| 897 |
document.getElementById('cpuValue').innerText = `${cpuCores} Cores`;
|
| 898 |
document.getElementById('ramValue').innerText = `${ramGB} GB`;
|
| 899 |
|
| 900 |
-
// Inicia gráficos com valores iniciais
|
| 901 |
state.cpuHistory = new Array(20).fill(cpuCores * 2);
|
| 902 |
state.ramHistory = new Array(20).fill(parseFloat(ramGB) * 0.4);
|
| 903 |
|
| 904 |
-
// Finaliza Scan
|
| 905 |
overlay.style.opacity = '0';
|
| 906 |
overlay.style.pointerEvents = 'none';
|
| 907 |
|
|
@@ -909,25 +910,22 @@
|
|
| 909 |
statusBadge.innerHTML = `<div class="status-dot"></div> <span>ONLINE - AI ACTIVE</span>`;
|
| 910 |
statusBadge.style.color = 'var(--primary)';
|
| 911 |
|
| 912 |
-
// Habilita botões
|
| 913 |
document.querySelectorAll('button').forEach(b => b.disabled = false);
|
| 914 |
|
| 915 |
-
showToast('Diagnóstico concluído.
|
| 916 |
addBotMessage('Sistema online. Aguardando comandos.');
|
| 917 |
|
| 918 |
-
// --- SIMULAÇÃO DE WEBSOCKETS (Real-time Data Stream) ---
|
| 919 |
startDataStream();
|
| 920 |
}
|
| 921 |
|
| 922 |
-
// Simula um servidor WebSocket enviando dados de hardware
|
| 923 |
function startDataStream() {
|
| 924 |
if (state.socketInterval) clearInterval(state.socketInterval);
|
| 925 |
|
| 926 |
state.socketInterval = setInterval(() => {
|
| 927 |
if (!state.isOnline) return;
|
| 928 |
|
| 929 |
-
// Simula flutuação baseada nos dados reais
|
| 930 |
const baseCpu = navigator.hardwareConcurrency || 4;
|
|
|
|
| 931 |
const cpu = Math.floor(Math.random() * 20) + (baseCpu * 1.5);
|
| 932 |
const ram = (Math.random() * 1.5 + parseFloat(document.getElementById('ramValue').innerText)).toFixed(1);
|
| 933 |
|
|
@@ -942,6 +940,10 @@
|
|
| 942 |
|
| 943 |
updateChart('cpuChart', state.cpuHistory, 100);
|
| 944 |
updateChart('ramChart', state.ramHistory, 16);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 945 |
}, 1000);
|
| 946 |
}
|
| 947 |
|
|
@@ -984,12 +986,6 @@
|
|
| 984 |
document.querySelector('.status-dot').style.background = 'var(--danger)';
|
| 985 |
document.querySelector('.status-dot').style.animation = 'none';
|
| 986 |
break;
|
| 987 |
-
case 'ping':
|
| 988 |
-
const ping = Math.floor(Math.random() * 20) + 5;
|
| 989 |
-
logToTerminal(`Ping: ${ping}ms para gateway.`, 'info');
|
| 990 |
-
addBotMessage(`Resposta do vY: Ping de ${ping}ms.`);
|
| 991 |
-
showToast(`Ping: ${ping}ms`, 'success');
|
| 992 |
-
break;
|
| 993 |
case 'screenshot':
|
| 994 |
logToTerminal('Capturando ecrã completo...', 'info');
|
| 995 |
showToast('Screenshot enviado para o Telegram.', 'success');
|
|
@@ -1001,7 +997,32 @@
|
|
| 1001 |
`;
|
| 1002 |
addBotMessage('Enviado: captura_tela_2023.png');
|
| 1003 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1004 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1005 |
}
|
| 1006 |
|
| 1007 |
function typeText() {
|
|
@@ -1051,33 +1072,27 @@
|
|
| 1051 |
}, 800);
|
| 1052 |
}
|
| 1053 |
|
| 1054 |
-
// --- Chat com Simulação de Rede (
|
| 1055 |
function sendChat() {
|
| 1056 |
const input = document.getElementById('chatInput');
|
| 1057 |
const text = input.value.trim();
|
| 1058 |
if (!text) return;
|
| 1059 |
|
| 1060 |
-
// 1. UI: Mostra mensagem do usuário
|
| 1061 |
addUserMessage(text);
|
| 1062 |
logToTerminal(`Telegram API: Mensagem "${text}" enviada.`, 'info');
|
| 1063 |
input.value = '';
|
| 1064 |
|
| 1065 |
-
// 2. UI: Feedback de envio
|
| 1066 |
const loadingMsg = document.createElement('div');
|
| 1067 |
loadingMsg.className = 'msg system';
|
| 1068 |
loadingMsg.innerText = 'Enviando...';
|
| 1069 |
document.getElementById('chatMessages').appendChild(loadingMsg);
|
| 1070 |
document.getElementById('chatMessages').scrollTop = document.getElementById('chatMessages').scrollHeight;
|
| 1071 |
|
| 1072 |
-
// 3. Simula delay de rede e processamento de IA
|
| 1073 |
setTimeout(() => {
|
| 1074 |
loadingMsg.remove();
|
| 1075 |
-
|
| 1076 |
-
// Processa com a "IA Mock"
|
| 1077 |
const response = processAIResponse(text);
|
| 1078 |
addBotMessage(response);
|
| 1079 |
-
|
| 1080 |
-
}, 1000 + Math.random() * 1000); // Delay aleatório entre 1s e 2s
|
| 1081 |
}
|
| 1082 |
|
| 1083 |
document.getElementById('chatInput').addEventListener('keypress', function(e) {
|
|
|
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>vY Agent v4.0 | Sistema Autônomo</title>
|
| 8 |
<!-- Importando Fontes e Ícones -->
|
| 9 |
<link
|
| 10 |
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;600;800&display=swap"
|
|
|
|
| 213 |
left: 0;
|
| 214 |
width: 100%;
|
| 215 |
height: 100%;
|
| 216 |
+
background: rgba(5, 5, 5, 0.9);
|
| 217 |
+
backdrop-filter: blur(8px);
|
| 218 |
z-index: 50;
|
| 219 |
display: flex;
|
| 220 |
flex-direction: column;
|
|
|
|
| 443 |
|
| 444 |
.msg.system {
|
| 445 |
align-self: center;
|
| 446 |
+
background: rgba(0, 0, 0, 0.1);
|
| 447 |
color: #666;
|
| 448 |
font-size: 0.75rem;
|
| 449 |
padding: 2px 8px;
|
|
|
|
| 466 |
outline: none;
|
| 467 |
}
|
| 468 |
|
| 469 |
+
/* --- Video Preview Area --- */
|
| 470 |
+
.video-container {
|
| 471 |
+
width: 100%;
|
| 472 |
+
height: 120px;
|
| 473 |
+
background: #000;
|
| 474 |
+
border-radius: 8px;
|
| 475 |
+
margin-top: 10px;
|
| 476 |
+
overflow: hidden;
|
| 477 |
+
border: 1px solid var(--border);
|
| 478 |
+
position: relative;
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
video {
|
| 482 |
+
width: 100%;
|
| 483 |
+
height: 100%;
|
| 484 |
+
object-fit: cover;
|
| 485 |
+
opacity: 0.6;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
.video-recording-indicator {
|
| 489 |
+
position: absolute;
|
| 490 |
+
top: 5px;
|
| 491 |
+
right: 5px;
|
| 492 |
+
background: var(--danger);
|
| 493 |
+
color: white;
|
| 494 |
+
font-size: 0.7rem;
|
| 495 |
+
padding: 2px 6px;
|
| 496 |
+
border-radius: 4px;
|
| 497 |
+
font-weight: bold;
|
| 498 |
+
display: none;
|
| 499 |
+
animation: blink 1s infinite;
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
/* --- Footer --- */
|
| 503 |
footer {
|
| 504 |
height: 30px;
|
|
|
|
| 519 |
|
| 520 |
/* --- Animations & Utilities --- */
|
| 521 |
@keyframes pulse {
|
| 522 |
+
0% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.7); }
|
| 523 |
+
70% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(0, 255, 157, 0); }
|
| 524 |
+
100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 255, 157, 0); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
}
|
| 526 |
|
| 527 |
@keyframes loading {
|
| 528 |
+
0% { width: 0; }
|
| 529 |
+
50% { width: 100%; }
|
| 530 |
+
100% { width: 0; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
}
|
| 532 |
|
| 533 |
+
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
|
| 534 |
|
| 535 |
+
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--primary); animation: blink 1s infinite; vertical-align: middle; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 536 |
|
| 537 |
/* Notifications */
|
| 538 |
+
.toast-container { position: fixed; bottom: 40px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
|
| 539 |
+
.toast { background: var(--bg-panel-lighter); border-left: 4px solid var(--primary); color: var(--text-main); padding: 15px 20px; border-radius: 4px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); font-size: 0.9rem; animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 10px; }
|
| 540 |
+
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 541 |
|
| 542 |
/* Responsive */
|
| 543 |
@media (max-width: 1024px) {
|
| 544 |
+
main { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow-y: auto; }
|
| 545 |
+
.dashboard { order: 2; }
|
| 546 |
+
.sidebar { order: 1; }
|
| 547 |
+
.right-panel { order: 3; }
|
| 548 |
+
.metrics-grid { grid-template-columns: 1fr; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 549 |
}
|
| 550 |
</style>
|
| 551 |
</head>
|
|
|
|
| 556 |
<header>
|
| 557 |
<div class="brand">
|
| 558 |
<i class="fa-solid fa-robot"></i>
|
| 559 |
+
<span>vY AGENT <span style="font-weight:400; opacity: 0.7;">// AUTÔNOMO v4.0</span></span>
|
| 560 |
</div>
|
| 561 |
<div class="status-badge">
|
| 562 |
<div class="status-dot"></div>
|
|
|
|
| 572 |
<!-- Sidebar: Controls -->
|
| 573 |
<section class="panel sidebar">
|
| 574 |
<div class="control-group">
|
| 575 |
+
<h3><i class="fa-solid fa-terminal"></i> Controlo de Sistema</h3>
|
| 576 |
<div class="btn-grid">
|
| 577 |
<button onclick="runCommand('reboot')" id="btnReboot" disabled>
|
| 578 |
<i class="fa-solid fa-power-off"></i> Reboot
|
| 579 |
</button>
|
| 580 |
+
<button onclick="runCommand('shutdown')" id="btnShutdown" disabled>
|
|
|
|
|
|
|
|
|
|
| 581 |
<i class="fa-solid fa-skull"></i> Shutdown
|
| 582 |
</button>
|
| 583 |
<button onclick="runCommand('screenshot')" id="btnScreen" disabled>
|
| 584 |
<i class="fa-solid fa-camera"></i> Screen
|
| 585 |
</button>
|
| 586 |
+
<button onclick="runCommand('record')" id="btnRecord" disabled>
|
| 587 |
+
<i class="fa-solid fa-video"></i> Record 1s
|
| 588 |
+
</button>
|
| 589 |
</div>
|
| 590 |
</div>
|
| 591 |
|
|
|
|
| 600 |
</div>
|
| 601 |
|
| 602 |
<div class="control-group">
|
| 603 |
+
<h3><i class="fa-solid fa-shield-halved"></i> Segurança e Logs</h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
<div style="font-size: 0.8rem; color: var(--text-muted);">
|
| 605 |
<p>Chave de Sessão: <span style="font-family: var(--font-mono);">AES-256-ENC</span></p>
|
| 606 |
<p>Auditoria: <span style="color: var(--primary);">Ativa (7 Dias)</span></p>
|
| 607 |
<p>Firewall: <span style="color: var(--primary);">Bloqueado (C2)</span></p>
|
| 608 |
+
<div class="video-container">
|
| 609 |
+
<video id="videoPreview" autoplay muted playsinline></video>
|
| 610 |
+
<div id="recIndicator" class="video-recording-indicator">REC ●</div>
|
| 611 |
+
</div>
|
| 612 |
</div>
|
| 613 |
</div>
|
| 614 |
</section>
|
| 615 |
|
| 616 |
<!-- Center: Dashboard -->
|
| 617 |
<section class="panel dashboard">
|
|
|
|
| 618 |
<!-- Scan Overlay -->
|
| 619 |
<div id="scanOverlay">
|
| 620 |
+
<div class="scan-text" id="scanText">INICIANDO KERNEL...</div>
|
| 621 |
<div class="scan-loader">
|
| 622 |
<div class="scan-bar" id="scanBar"></div>
|
| 623 |
</div>
|
|
|
|
| 643 |
</div>
|
| 644 |
<div class="metric-card">
|
| 645 |
<div class="metric-title">
|
| 646 |
+
<span>AUTONOMY</span>
|
| 647 |
+
<i class="fa-solid fa-brain"></i>
|
| 648 |
</div>
|
| 649 |
+
<div class="metric-value" id="autoValue" style="color: var(--accent);">ACTIVE</div>
|
| 650 |
+
<div style="font-size: 0.7rem; color: var(--text-muted); margin-top: 5px;">Status do Núcleo: Monitorizando</div>
|
| 651 |
</div>
|
| 652 |
</div>
|
| 653 |
|
|
|
|
| 660 |
</div>
|
| 661 |
<div class="browser-content" id="browserContent">
|
| 662 |
<div style="text-align: center; margin-top: 50px;">
|
| 663 |
+
<h2 style="color: #333;">vY Agent v4.0</h2>
|
| 664 |
+
<p style="color: #666; margin-top: 10px;">Sistema Operacional Autônomo.</p>
|
| 665 |
</div>
|
| 666 |
</div>
|
| 667 |
</div>
|
|
|
|
| 668 |
</section>
|
| 669 |
|
| 670 |
<!-- Right: Logs & Chat -->
|
|
|
|
| 692 |
|
| 693 |
<!-- Footer -->
|
| 694 |
<footer>
|
| 695 |
+
<span>Built with anycoder</span> | <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">huggingface.co/spaces/akhaliq/anycoder</a>
|
|
|
|
| 696 |
</footer>
|
| 697 |
|
| 698 |
<!-- Toast Container -->
|
|
|
|
| 703 |
const state = {
|
| 704 |
cpuHistory: new Array(20).fill(0),
|
| 705 |
ramHistory: new Array(20).fill(0),
|
| 706 |
+
isOnline: false,
|
| 707 |
scanProgress: 0,
|
| 708 |
+
socketInterval: null,
|
| 709 |
+
autonomyMode: true,
|
| 710 |
+
mediaRecorder: null,
|
| 711 |
+
recordedChunks: []
|
| 712 |
};
|
| 713 |
|
| 714 |
// --- Funções de Utilidade ---
|
|
|
|
| 751 |
entry.innerHTML = content;
|
| 752 |
terminal.insertBefore(entry, terminal.lastElementChild);
|
| 753 |
terminal.scrollTop = terminal.scrollHeight;
|
| 754 |
+
|
| 755 |
+
// Persistência de Logs (Simulando DB)
|
| 756 |
+
saveLog(msg, type);
|
| 757 |
+
}
|
| 758 |
+
|
| 759 |
+
function saveLog(msg, type) {
|
| 760 |
+
const logs = JSON.parse(localStorage.getItem('vy_logs') || '[]');
|
| 761 |
+
logs.push({ time: getTimestamp(), msg: msg, type: type });
|
| 762 |
+
if (logs.length > 50) logs.shift(); // Manter apenas os últimos 50
|
| 763 |
+
localStorage.setItem('vy_logs', JSON.stringify(logs));
|
| 764 |
}
|
| 765 |
|
| 766 |
function addBotMessage(text) {
|
|
|
|
| 781 |
chat.scrollTop = chat.scrollHeight;
|
| 782 |
}
|
| 783 |
|
| 784 |
+
// --- IA MOCK (Autônomo) ---
|
| 785 |
function processAIResponse(userText) {
|
| 786 |
const lowerText = userText.toLowerCase();
|
| 787 |
|
|
|
|
| 788 |
if (lowerText.includes('status')) {
|
| 789 |
+
return `Status do Sistema: CPU ${state.cpuHistory[19]}%, RAM ${state.ramHistory[19]}GB. Rede estável. Autonomia: ${state.autonomyMode ? 'ON' : 'OFF'}.`;
|
| 790 |
} else if (lowerText.includes('screenshot')) {
|
| 791 |
return `Captura de ecrã enviada. [Arquivo: screenshot_${Date.now()}.png]`;
|
| 792 |
} else if (lowerText.includes('shutdown') || lowerText.includes('off')) {
|
| 793 |
return `Comando recebido. Iniciando procedimento de desligamento seguro...`;
|
| 794 |
} else if (lowerText.includes('help')) {
|
| 795 |
+
return `Comandos disponíveis: /status, /screenshot, /shutdown, /reboot, /autonomy [on/off], /logs.`;
|
| 796 |
+
} else if (lowerText.includes('autonomy') && (lowerText.includes('on'))) {
|
| 797 |
+
state.autonomyMode = true;
|
| 798 |
+
return `Autonomia ativada. O vY Agent agora monitoriza e corrige erros automaticamente.`;
|
| 799 |
+
} else if (lowerText.includes('autonomy') && (lowerText.includes('off'))) {
|
| 800 |
+
state.autonomyMode = false;
|
| 801 |
+
return `Autonomia desativada. O agente agora responde apenas a comandos diretos.`;
|
| 802 |
} else {
|
| 803 |
return `Comando "${userText}" reconhecido pelo núcleo vY. A aguardar confirmação externa.`;
|
| 804 |
}
|
| 805 |
}
|
| 806 |
|
| 807 |
+
// --- Motor de Autonomia (Regras de Negócio) ---
|
| 808 |
+
function checkAutonomyRules() {
|
| 809 |
+
if (!state.autonomyMode || !state.isOnline) return;
|
| 810 |
+
|
| 811 |
+
const currentCpu = state.cpuHistory[19];
|
| 812 |
+
|
| 813 |
+
// Regra 1: Se CPU > 90%, reiniciar serviços de fundo
|
| 814 |
+
if (currentCpu > 90) {
|
| 815 |
+
logToTerminal(`AUTONOMY ALERT: CPU Critical (${currentCpu}%). Restarting heavy services...`, 'warn');
|
| 816 |
+
addBotMessage(`Alerta de Autonomia: CPU crítica (${currentCpu}%). A reiniciar serviços pesados.`);
|
| 817 |
+
// Simula restart
|
| 818 |
+
setTimeout(() => {
|
| 819 |
+
logToTerminal('Services restarted successfully.', 'info');
|
| 820 |
+
}, 2000);
|
| 821 |
+
}
|
| 822 |
+
|
| 823 |
+
// Regra 2: Se RAM > 90%, limpar cache
|
| 824 |
+
const currentRam = state.ramHistory[19];
|
| 825 |
+
if (currentRam > 90) {
|
| 826 |
+
logToTerminal(`AUTONOMY: RAM High (${currentRam}%). Clearing browser cache...`, 'warn');
|
| 827 |
+
}
|
| 828 |
+
}
|
| 829 |
+
|
| 830 |
+
// --- Core: Sistema de Diagnóstico e Captura de Vídeo ---
|
| 831 |
async function runSystemScan() {
|
| 832 |
const overlay = document.getElementById('scanOverlay');
|
| 833 |
const bar = document.getElementById('scanBar');
|
| 834 |
const text = document.getElementById('scanText');
|
| 835 |
const statusBadge = document.getElementById('systemStatus');
|
| 836 |
|
|
|
|
| 837 |
overlay.style.opacity = '1';
|
| 838 |
overlay.style.pointerEvents = 'all';
|
| 839 |
|
|
|
|
| 840 |
document.querySelectorAll('button').forEach(b => b.disabled = true);
|
| 841 |
|
| 842 |
const steps = [
|
|
|
|
| 847 |
{ msg: "SCANNING NETWORK INTERFACE...", delay: 3000 },
|
| 848 |
{ msg: "VERIFYING SECURITY PROTOCOLS...", delay: 3600 },
|
| 849 |
{ msg: "CONNECTING TO AI CORE...", delay: 4000 },
|
| 850 |
+
{ msg: "STARTING VIDEO STREAM...", delay: 4300 },
|
| 851 |
{ msg: "COMPLETE", delay: 4500 }
|
| 852 |
];
|
| 853 |
|
|
|
|
| 858 |
bar.style.width = '0%';
|
| 859 |
}
|
| 860 |
|
| 861 |
+
// Configuração de Captura de Vídeo (1 Segundo)
|
| 862 |
+
const videoElement = document.getElementById('videoPreview');
|
| 863 |
+
try {
|
| 864 |
+
const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: false });
|
| 865 |
+
videoElement.srcObject = stream;
|
| 866 |
+
|
| 867 |
+
// Prepara MediaRecorder
|
| 868 |
+
state.mediaRecorder = new MediaRecorder(stream, { mimeType: 'video/webm; codecs=vp9' });
|
| 869 |
+
state.recordedChunks = [];
|
| 870 |
+
|
| 871 |
+
state.mediaRecorder.ondataavailable = (event) => {
|
| 872 |
+
if (event.data.size > 0) {
|
| 873 |
+
state.recordedChunks.push(event.data);
|
| 874 |
+
}
|
| 875 |
+
};
|
| 876 |
+
|
| 877 |
+
state.mediaRecorder.onstop = () => {
|
| 878 |
+
const blob = new Blob(state.recordedChunks, { type: 'video/webm' });
|
| 879 |
+
const url = URL.createObjectURL(blob);
|
| 880 |
+
logToTerminal(`VÍDEO CAPTURADO: ${blob.size} bytes (1s recording)`, 'success');
|
| 881 |
+
showToast('Vídeo capturado com sucesso.', 'success');
|
| 882 |
+
};
|
| 883 |
+
|
| 884 |
+
} catch (err) {
|
| 885 |
+
logToTerminal('Erro ao acessar câmara: ' + err.message, 'error');
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
// Coleta de Dados Reais
|
| 889 |
const cpuCores = navigator.hardwareConcurrency || 4;
|
| 890 |
const ramTotal = navigator.deviceMemory ? (navigator.deviceMemory * 1024) : 8192;
|
| 891 |
const ramGB = (ramTotal / 1024).toFixed(1);
|
| 892 |
const osInfo = navigator.platform;
|
| 893 |
const browserInfo = navigator.userAgent.split(')')[0] + ')';
|
| 894 |
|
|
|
|
| 895 |
logToTerminal(`Sistema Operacional: ${osInfo}`, 'info');
|
| 896 |
logToTerminal(`Navegador: ${browserInfo}`, 'info');
|
| 897 |
logToTerminal(`CPU Detetada: ${cpuCores} Threads`, 'info');
|
| 898 |
logToTerminal(`RAM Total: ${ramGB} GB`, 'info');
|
| 899 |
|
|
|
|
| 900 |
document.getElementById('cpuValue').innerText = `${cpuCores} Cores`;
|
| 901 |
document.getElementById('ramValue').innerText = `${ramGB} GB`;
|
| 902 |
|
|
|
|
| 903 |
state.cpuHistory = new Array(20).fill(cpuCores * 2);
|
| 904 |
state.ramHistory = new Array(20).fill(parseFloat(ramGB) * 0.4);
|
| 905 |
|
|
|
|
| 906 |
overlay.style.opacity = '0';
|
| 907 |
overlay.style.pointerEvents = 'none';
|
| 908 |
|
|
|
|
| 910 |
statusBadge.innerHTML = `<div class="status-dot"></div> <span>ONLINE - AI ACTIVE</span>`;
|
| 911 |
statusBadge.style.color = 'var(--primary)';
|
| 912 |
|
|
|
|
| 913 |
document.querySelectorAll('button').forEach(b => b.disabled = false);
|
| 914 |
|
| 915 |
+
showToast('Diagnóstico concluído. Vídeo stream iniciado.', 'success');
|
| 916 |
addBotMessage('Sistema online. Aguardando comandos.');
|
| 917 |
|
|
|
|
| 918 |
startDataStream();
|
| 919 |
}
|
| 920 |
|
|
|
|
| 921 |
function startDataStream() {
|
| 922 |
if (state.socketInterval) clearInterval(state.socketInterval);
|
| 923 |
|
| 924 |
state.socketInterval = setInterval(() => {
|
| 925 |
if (!state.isOnline) return;
|
| 926 |
|
|
|
|
| 927 |
const baseCpu = navigator.hardwareConcurrency || 4;
|
| 928 |
+
// Simula flutuação realista
|
| 929 |
const cpu = Math.floor(Math.random() * 20) + (baseCpu * 1.5);
|
| 930 |
const ram = (Math.random() * 1.5 + parseFloat(document.getElementById('ramValue').innerText)).toFixed(1);
|
| 931 |
|
|
|
|
| 940 |
|
| 941 |
updateChart('cpuChart', state.cpuHistory, 100);
|
| 942 |
updateChart('ramChart', state.ramHistory, 16);
|
| 943 |
+
|
| 944 |
+
// Verifica regras de autonomia
|
| 945 |
+
checkAutonomyRules();
|
| 946 |
+
|
| 947 |
}, 1000);
|
| 948 |
}
|
| 949 |
|
|
|
|
| 986 |
document.querySelector('.status-dot').style.background = 'var(--danger)';
|
| 987 |
document.querySelector('.status-dot').style.animation = 'none';
|
| 988 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 989 |
case 'screenshot':
|
| 990 |
logToTerminal('Capturando ecrã completo...', 'info');
|
| 991 |
showToast('Screenshot enviado para o Telegram.', 'success');
|
|
|
|
| 997 |
`;
|
| 998 |
addBotMessage('Enviado: captura_tela_2023.png');
|
| 999 |
break;
|
| 1000 |
+
case 'record':
|
| 1001 |
+
recordVideo();
|
| 1002 |
+
break;
|
| 1003 |
+
}
|
| 1004 |
+
}
|
| 1005 |
+
|
| 1006 |
+
function recordVideo() {
|
| 1007 |
+
if (!state.mediaRecorder || state.mediaRecorder.state === 'recording') {
|
| 1008 |
+
showToast('Já a gravar ou sem stream de vídeo.', 'error');
|
| 1009 |
+
return;
|
| 1010 |
}
|
| 1011 |
+
|
| 1012 |
+
state.recordedChunks = [];
|
| 1013 |
+
state.mediaRecorder.start();
|
| 1014 |
+
document.getElementById('recIndicator').style.display = 'block';
|
| 1015 |
+
|
| 1016 |
+
logToTerminal('Gravando vídeo de 1 segundo...', 'info');
|
| 1017 |
+
|
| 1018 |
+
// Grava por 1 segundo
|
| 1019 |
+
setTimeout(() => {
|
| 1020 |
+
if (state.mediaRecorder && state.mediaRecorder.state === 'recording') {
|
| 1021 |
+
state.mediaRecorder.stop();
|
| 1022 |
+
document.getElementById('recIndicator').style.display = 'none';
|
| 1023 |
+
showToast('Gravação concluída.', 'success');
|
| 1024 |
+
}
|
| 1025 |
+
}, 1000);
|
| 1026 |
}
|
| 1027 |
|
| 1028 |
function typeText() {
|
|
|
|
| 1072 |
}, 800);
|
| 1073 |
}
|
| 1074 |
|
| 1075 |
+
// --- Chat com Simulação de Rede (IA) ---
|
| 1076 |
function sendChat() {
|
| 1077 |
const input = document.getElementById('chatInput');
|
| 1078 |
const text = input.value.trim();
|
| 1079 |
if (!text) return;
|
| 1080 |
|
|
|
|
| 1081 |
addUserMessage(text);
|
| 1082 |
logToTerminal(`Telegram API: Mensagem "${text}" enviada.`, 'info');
|
| 1083 |
input.value = '';
|
| 1084 |
|
|
|
|
| 1085 |
const loadingMsg = document.createElement('div');
|
| 1086 |
loadingMsg.className = 'msg system';
|
| 1087 |
loadingMsg.innerText = 'Enviando...';
|
| 1088 |
document.getElementById('chatMessages').appendChild(loadingMsg);
|
| 1089 |
document.getElementById('chatMessages').scrollTop = document.getElementById('chatMessages').scrollHeight;
|
| 1090 |
|
|
|
|
| 1091 |
setTimeout(() => {
|
| 1092 |
loadingMsg.remove();
|
|
|
|
|
|
|
| 1093 |
const response = processAIResponse(text);
|
| 1094 |
addBotMessage(response);
|
| 1095 |
+
}, 1000 + Math.random() * 1000);
|
|
|
|
| 1096 |
}
|
| 1097 |
|
| 1098 |
document.getElementById('chatInput').addEventListener('keypress', function(e) {
|