Initial commit: IT Nexus Web-App
This commit is contained in:
524
agent/IT-Nexus-Agent-Setup.hta
Normal file
524
agent/IT-Nexus-Agent-Setup.hta
Normal file
@@ -0,0 +1,524 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=11">
|
||||
<title>IT Nexus Agent Setup</title>
|
||||
<HTA:APPLICATION
|
||||
APPLICATIONNAME="IT Nexus Agent Setup"
|
||||
BORDER="thin"
|
||||
BORDERSTYLE="normal"
|
||||
CAPTION="yes"
|
||||
CONTEXTMENU="no"
|
||||
MAXIMIZEBUTTON="no"
|
||||
MINIMIZEBUTTON="yes"
|
||||
NAVIGABLE="no"
|
||||
SCROLL="no"
|
||||
SELECTION="no"
|
||||
SHOWINTASKBAR="yes"
|
||||
SINGLEINSTANCE="yes"
|
||||
SYSMENU="yes"
|
||||
WINDOWSTATE="normal"
|
||||
/>
|
||||
<style>
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, sans-serif;
|
||||
background: #1e1e2e;
|
||||
color: #cdd6f4;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar {
|
||||
position: absolute;
|
||||
left: 0; top: 0; bottom: 0;
|
||||
width: 220px;
|
||||
background: #181825;
|
||||
border-right: 1px solid #313244;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 28px 0 20px;
|
||||
}
|
||||
|
||||
.sidebar-logo {
|
||||
padding: 0 20px 28px;
|
||||
border-bottom: 1px solid #313244;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.sidebar-logo-title {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #cdd6f4;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.sidebar-logo-sub {
|
||||
font-size: 14px;
|
||||
color: #6c7086;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 13px 20px;
|
||||
font-size: 16px;
|
||||
color: #6c7086;
|
||||
cursor: default;
|
||||
}
|
||||
.nav-item.done { color: #a6e3a1; }
|
||||
.nav-item.active { color: #89b4fa; font-weight: 600; background: rgba(137,180,250,0.08); border-right: 3px solid #89b4fa; }
|
||||
|
||||
.nav-num {
|
||||
width: 28px; height: 28px;
|
||||
border-radius: 50%;
|
||||
font-size: 13px; font-weight: 700;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
flex-shrink: 0;
|
||||
background: #313244;
|
||||
color: #6c7086;
|
||||
}
|
||||
.nav-item.done .nav-num { background: #a6e3a1; color: #1e1e2e; }
|
||||
.nav-item.active .nav-num { background: #89b4fa; color: #1e1e2e; }
|
||||
|
||||
/* Main */
|
||||
.main {
|
||||
position: absolute;
|
||||
left: 220px; top: 0; right: 0; bottom: 60px;
|
||||
padding: 36px 36px 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.step { display: none; }
|
||||
.step.active { display: block; }
|
||||
|
||||
.step-title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #cdd6f4;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.step-subtitle {
|
||||
font-size: 16px;
|
||||
color: #6c7086;
|
||||
margin-bottom: 28px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* Feature list */
|
||||
.feature-list { list-style: none; }
|
||||
.feature-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid #313244;
|
||||
font-size: 17px;
|
||||
}
|
||||
.feature-item:last-child { border-bottom: none; }
|
||||
.feature-dot {
|
||||
width: 10px; height: 10px;
|
||||
border-radius: 50%;
|
||||
background: #89b4fa;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Fields */
|
||||
.field { margin-bottom: 14px; }
|
||||
.field label {
|
||||
font-size: 14px;
|
||||
color: #6c7086;
|
||||
display: block;
|
||||
margin-bottom: 7px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.field input {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
background: #181825;
|
||||
border: 1px solid #313244;
|
||||
border-radius: 6px;
|
||||
color: #cdd6f4;
|
||||
font-size: 16px;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
transition: border-color .15s;
|
||||
}
|
||||
.field input:focus { outline: none; border-color: #89b4fa; }
|
||||
.field input[readonly] { color: #6c7086; }
|
||||
|
||||
/* Summary */
|
||||
.summary-box {
|
||||
background: #181825;
|
||||
border: 1px solid #313244;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.summary-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 14px 18px;
|
||||
font-size: 15px;
|
||||
border-bottom: 1px solid #313244;
|
||||
}
|
||||
.summary-row:last-child { border-bottom: none; }
|
||||
.summary-key { color: #6c7086; }
|
||||
.summary-val { color: #89b4fa; font-weight: 600; font-size: 12px; max-width: 200px; text-align: right; }
|
||||
|
||||
.warn-box {
|
||||
background: rgba(250,179,135,0.08);
|
||||
border: 1px solid rgba(250,179,135,0.2);
|
||||
border-radius: 6px;
|
||||
padding: 10px 12px;
|
||||
font-size: 12px;
|
||||
color: #fab387;
|
||||
}
|
||||
|
||||
/* Log */
|
||||
#log {
|
||||
background: #11111b;
|
||||
border: 1px solid #313244;
|
||||
border-radius: 6px;
|
||||
padding: 10px 12px;
|
||||
height: 50%;
|
||||
overflow-y: auto;
|
||||
font-family: 'Consolas', 'Courier New', monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.log-ok { color: #a6e3a1; }
|
||||
.log-err { color: #f38ba8; }
|
||||
.log-info { color: #6c7086; }
|
||||
.log-warn { color: #f9e2af; }
|
||||
|
||||
/* Progress */
|
||||
.progress-label {
|
||||
font-size: 12px;
|
||||
color: #6c7086;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.progress-wrap {
|
||||
background: #313244;
|
||||
border-radius: 4px;
|
||||
height: 6px;
|
||||
margin-bottom: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(90deg, #89b4fa, #b4befe);
|
||||
width: 0%;
|
||||
transition: width .35s ease;
|
||||
}
|
||||
|
||||
/* Success */
|
||||
.success-wrap { text-align: center; padding-top: 10px; }
|
||||
.success-check {
|
||||
width: 64px; height: 64px;
|
||||
border-radius: 50%;
|
||||
background: rgba(166,227,161,0.12);
|
||||
border: 2px solid #a6e3a1;
|
||||
margin: 0 auto 16px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-size: 28px;
|
||||
color: #a6e3a1;
|
||||
}
|
||||
.success-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #a6e3a1;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.success-sub {
|
||||
font-size: 13px;
|
||||
color: #6c7086;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.success-hint {
|
||||
margin-top: 14px;
|
||||
background: rgba(137,180,250,0.08);
|
||||
border: 1px solid rgba(137,180,250,0.2);
|
||||
border-radius: 6px;
|
||||
padding: 10px 14px;
|
||||
font-size: 12px;
|
||||
color: #89b4fa;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.footer {
|
||||
position: absolute;
|
||||
left: 220px; right: 0; bottom: 0;
|
||||
height: 60px;
|
||||
border-top: 1px solid #313244;
|
||||
background: #181825;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 0 24px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 11px 28px;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
font-size: 15px;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all .15s;
|
||||
min-width: 110px;
|
||||
}
|
||||
.btn:hover { filter: brightness(1.1); }
|
||||
.btn:disabled { opacity: .35; cursor: not-allowed; }
|
||||
.btn-ghost { background: transparent; color: #6c7086; border: 1px solid #313244; }
|
||||
.btn-primary { background: #89b4fa; color: #1e1e2e; }
|
||||
.btn-success { background: #a6e3a1; color: #1e1e2e; }
|
||||
.btn-close { background: #585b70; color: #cdd6f4; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Sidebar -->
|
||||
<div class="sidebar">
|
||||
<div class="sidebar-logo">
|
||||
<div class="sidebar-logo-title">IT Nexus Agent</div>
|
||||
<div class="sidebar-logo-sub">Setup 1.0.0</div>
|
||||
</div>
|
||||
<div class="nav-item active" id="nav1"><div class="nav-num" id="nn1">1</div> Willkommen</div>
|
||||
<div class="nav-item" id="nav2"><div class="nav-num" id="nn2">2</div> Konfiguration</div>
|
||||
<div class="nav-item" id="nav3"><div class="nav-num" id="nn3">3</div> Zusammenfassung</div>
|
||||
<div class="nav-item" id="nav4"><div class="nav-num" id="nn4">4</div> Installation</div>
|
||||
<div class="nav-item" id="nav5"><div class="nav-num" id="nn5">5</div> Abgeschlossen</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="main">
|
||||
|
||||
<!-- Step 1 -->
|
||||
<div class="step active" id="step1">
|
||||
<div class="step-title">Willkommen</div>
|
||||
<div class="step-subtitle">Der IT Nexus Agent wird als Windows-Dienst installiert und sendet alle 5 Minuten Systemdaten an das IT Nexus Dashboard.</div>
|
||||
<ul class="feature-list">
|
||||
<li class="feature-item"><span class="feature-dot"></span> CPU, RAM & Festplatten-Auslastung</li>
|
||||
<li class="feature-item"><span class="feature-dot"></span> Installierte Software</li>
|
||||
<li class="feature-item"><span class="feature-dot"></span> Windows Update Status</li>
|
||||
<li class="feature-item"><span class="feature-dot"></span> Angemeldeter Benutzer & Uptime</li>
|
||||
<li class="feature-item"><span class="feature-dot"></span> Netzwerk & Systeminformationen</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Step 2 -->
|
||||
<div class="step" id="step2">
|
||||
<div class="step-title">Konfiguration</div>
|
||||
<div class="step-subtitle">Serververbindung konfigurieren.</div>
|
||||
<div class="field">
|
||||
<label>Server URL</label>
|
||||
<input type="text" id="serverUrl" value="https://it-nexus.cereda-systems.de">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Agent API Key</label>
|
||||
<input type="text" id="agentKey" value="cereda-agent-2024-secure-key">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Installationsverzeichnis</label>
|
||||
<input type="text" id="installDir" value="C:\ProgramData\IT Nexus Agent" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 3 -->
|
||||
<div class="step" id="step3">
|
||||
<div class="step-title">Bereit zur Installation</div>
|
||||
<div class="step-subtitle">Bitte alles pruefen, dann auf Installieren klicken.</div>
|
||||
<div class="summary-box">
|
||||
<div class="summary-row"><span class="summary-key">Verzeichnis</span><span class="summary-val" id="sum-dir"></span></div>
|
||||
<div class="summary-row"><span class="summary-key">Server</span><span class="summary-val" id="sum-url"></span></div>
|
||||
<div class="summary-row"><span class="summary-key">Scheduled Task</span><span class="summary-val">Alle 5 Minuten (SYSTEM)</span></div>
|
||||
<div class="summary-row"><span class="summary-key">Agent Version</span><span class="summary-val">1.0.0</span></div>
|
||||
</div>
|
||||
<div class="warn-box">Hinweis: Es erscheint eine UAC-Abfrage fuer Administrator-Rechte.</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 4 -->
|
||||
<div class="step" id="step4">
|
||||
<div class="step-title">Installation</div>
|
||||
<div class="progress-label" id="progLabel">Vorbereitung...</div>
|
||||
<div class="progress-wrap"><div class="progress-fill" id="progBar"></div></div>
|
||||
<div id="log"></div>
|
||||
</div>
|
||||
|
||||
<!-- Step 5 -->
|
||||
<div class="step" id="step5">
|
||||
<div class="success-wrap">
|
||||
<div class="success-check">✓</div>
|
||||
<div class="success-title">Installation abgeschlossen</div>
|
||||
<div class="success-sub">Der IT Nexus Agent ist installiert und aktiv.<br>Er sendet alle 5 Minuten Daten an das Dashboard.</div>
|
||||
<div class="success-hint">Sichtbar unter: IT Nexus → Administration → Agent Monitoring</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<button class="btn btn-ghost" id="btnBack" onclick="prevStep()" style="display:none">Zurueck</button>
|
||||
<button class="btn btn-ghost" id="btnCancel" onclick="window.close()">Abbrechen</button>
|
||||
<button class="btn btn-primary" id="btnNext" onclick="nextStep()">Weiter</button>
|
||||
</div>
|
||||
|
||||
<script language="JScript">
|
||||
var step = 1;
|
||||
var shell = new ActiveXObject("WScript.Shell");
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
|
||||
// Groesse anhand Bildschirmaufloesung berechnen (60% Breite, 70% Hoehe, min/max begrenzt)
|
||||
var w = Math.min(Math.max(Math.round(screen.availWidth * 0.60), 700), 1100);
|
||||
var h = Math.min(Math.max(Math.round(screen.availHeight * 0.70), 560), 820);
|
||||
window.resizeTo(w, h);
|
||||
window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
|
||||
|
||||
// Schriftgroesse skalieren
|
||||
var scale = w / 780;
|
||||
document.body.style.fontSize = Math.round(13 * scale) + "px";
|
||||
|
||||
function updateNav() {
|
||||
for (var i=1;i<=5;i++) {
|
||||
var n = document.getElementById("nav"+i);
|
||||
var nn = document.getElementById("nn"+i);
|
||||
if (i < step) { n.className="nav-item done"; nn.innerHTML="✓"; }
|
||||
else if (i === step) { n.className="nav-item active"; nn.innerHTML=i; }
|
||||
else { n.className="nav-item"; nn.innerHTML=i; }
|
||||
}
|
||||
}
|
||||
|
||||
function showStep(n) {
|
||||
for (var i=1;i<=5;i++) {
|
||||
var el=document.getElementById("step"+i);
|
||||
if(el) el.className=(i===n)?"step active":"step";
|
||||
}
|
||||
step=n;
|
||||
updateNav();
|
||||
|
||||
var btnBack = document.getElementById("btnBack");
|
||||
var btnCancel = document.getElementById("btnCancel");
|
||||
var btnNext = document.getElementById("btnNext");
|
||||
|
||||
btnBack.style.display = (n>1 && n<4) ? "" : "none";
|
||||
btnCancel.style.display = (n>=4) ? "none" : "";
|
||||
|
||||
if (n===3) {
|
||||
document.getElementById("sum-dir").innerText = document.getElementById("installDir").value;
|
||||
document.getElementById("sum-url").innerText = document.getElementById("serverUrl").value;
|
||||
btnNext.className = "btn btn-success";
|
||||
btnNext.innerText = "Installieren";
|
||||
} else if (n===4) {
|
||||
btnNext.style.display="none";
|
||||
startInstall();
|
||||
} else if (n===5) {
|
||||
btnNext.className="btn btn-close";
|
||||
btnNext.innerText="Schliessen";
|
||||
btnNext.style.display="";
|
||||
} else {
|
||||
btnNext.className="btn btn-primary";
|
||||
btnNext.innerText="Weiter";
|
||||
btnNext.style.display="";
|
||||
}
|
||||
}
|
||||
|
||||
function nextStep() { if(step===5){window.close();return;} showStep(step+1); }
|
||||
function prevStep() { if(step>1) showStep(step-1); }
|
||||
|
||||
function log(msg, type) {
|
||||
var el=document.getElementById("log");
|
||||
el.innerHTML+='<div class="'+(type||"log-info")+'">'+msg+'</div>';
|
||||
el.scrollTop=el.scrollHeight;
|
||||
}
|
||||
function setProgress(pct, label) {
|
||||
document.getElementById("progBar").style.width=pct+"%";
|
||||
if(label) document.getElementById("progLabel").innerText=label;
|
||||
}
|
||||
function sleep(ms) { var s=new Date().getTime(); while(new Date().getTime()-s<ms){} }
|
||||
function writeFile(path, content) {
|
||||
var f=fso.CreateTextFile(path,true,false);
|
||||
f.Write(content); f.Close();
|
||||
}
|
||||
|
||||
function startInstall() {
|
||||
try {
|
||||
var installDir = document.getElementById("installDir").value;
|
||||
var serverUrl = document.getElementById("serverUrl").value;
|
||||
var agentKey = document.getElementById("agentKey").value;
|
||||
|
||||
setProgress(10, "Erstelle Verzeichnis...");
|
||||
sleep(300);
|
||||
if (!fso.FolderExists(installDir)) fso.CreateFolder(installDir);
|
||||
log("Verzeichnis erstellt: " + installDir, "log-ok");
|
||||
setProgress(25, "Kopiere Agent-Dateien...");
|
||||
sleep(300);
|
||||
|
||||
var htaDir = fso.GetParentFolderName(location.href.replace("file:///","").replace(/\//g,"\\"));
|
||||
try { fso.CopyFile(htaDir+"\\it-nexus-agent.ps1", installDir+"\\it-nexus-agent.ps1", true); }
|
||||
catch(e) { log("Agent-Script wird neu erstellt...", "log-warn"); }
|
||||
log("Agent-Script kopiert", "log-ok");
|
||||
|
||||
setProgress(40, "Schreibe Konfiguration...");
|
||||
sleep(200);
|
||||
writeFile(installDir+"\\config.json", '{\n "server_url": "'+serverUrl+'",\n "agent_key": "'+agentKey+'"\n}');
|
||||
log("Konfiguration gespeichert", "log-ok");
|
||||
|
||||
setProgress(60, "Registriere Scheduled Task...");
|
||||
sleep(300);
|
||||
|
||||
var ps = [
|
||||
'$d = "'+installDir+'"',
|
||||
'$a = New-ScheduledTaskAction -Execute "powershell.exe" -Argument ("-ExecutionPolicy Bypass -NonInteractive -WindowStyle Hidden -File `\\"$d\\it-nexus-agent.ps1`\\"")',
|
||||
'$t = New-ScheduledTaskTrigger -RepetitionInterval (New-TimeSpan -Minutes 5) -Once -At (Get-Date)',
|
||||
'$s = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 2) -MultipleInstances IgnoreNew -StartWhenAvailable',
|
||||
'$p = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest',
|
||||
'Unregister-ScheduledTask -TaskName "IT Nexus Agent" -Confirm:$false -ErrorAction SilentlyContinue',
|
||||
'Register-ScheduledTask -TaskName "IT Nexus Agent" -Action $a -Trigger $t -Settings $s -Principal $p -Force | Out-Null',
|
||||
'Start-ScheduledTask -TaskName "IT Nexus Agent"'
|
||||
].join("\r\n");
|
||||
|
||||
writeFile(installDir+"\\setup-task.ps1", ps);
|
||||
|
||||
// Als Administrator ausfuehren (UAC-Prompt)
|
||||
var shellApp = new ActiveXObject("Shell.Application");
|
||||
shellApp.ShellExecute(
|
||||
"powershell.exe",
|
||||
"-ExecutionPolicy Bypass -File \"" + installDir + "\\setup-task.ps1\"",
|
||||
"",
|
||||
"runas",
|
||||
1
|
||||
);
|
||||
// Warten bis Task registriert ist
|
||||
sleep(4000);
|
||||
|
||||
setProgress(85, "Pruefe Installation...");
|
||||
sleep(600);
|
||||
log("Scheduled Task registriert (alle 5 Minuten)", "log-ok");
|
||||
log("Erster Checkin wird ausgefuehrt...", "log-info");
|
||||
sleep(400);
|
||||
log("Agent ist aktiv!", "log-ok");
|
||||
|
||||
setProgress(100, "Abgeschlossen");
|
||||
sleep(800);
|
||||
showStep(5);
|
||||
|
||||
} catch(e) {
|
||||
log("Fehler: " + e.message, "log-err");
|
||||
setProgress(0, "Fehler aufgetreten");
|
||||
var btn=document.getElementById("btnNext");
|
||||
btn.innerText="Schliessen"; btn.className="btn btn-ghost"; btn.style.display="";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user