Deprecated-Unsupported/HTA Projects/Sentinel-Command/Src/sentinelCommand-v1.02/sentinelCommand.hta

212 lines
6.8 KiB
HTML

<!doctype html>
<head>
<title>Sentinel Command</title>
<link rel="stylesheet" type="text/css" href="./resources/other/css.css">
<HTA:APPLICATION
ID="Sentinel Command"
VERSION="1.0"
APPLICATIONNAME="Sentinel Command"
icon = "./resources/other/favicon.ico"
SCROLL="yes"
WINDOWSTATE="normal"
border = "thin"
caption = "yes"
maximizeButton = "no"
minimizeButton = "yes"
showInTaskbar = "yes"
version = "1.0"
/>
<script language="VBScript">
Window.ReSizeTo 1050, 640
Set objCall = CreateObject("WScript.Shell")
Sub aboutMasterCommand
objCall.Run ".\resources\bin\htas\sentinelCommandAbout.hta", 1, True
End Sub
Sub aboutChoco
objCall.Run ".\resources\bin\htas\chocoAbout.hta", 1, True
End Sub
Function installChoco
Set objfsoChk = CreateObject("Scripting.FileSystemObject")
path="C:\ProgramData\chocolatey\"
exists = objfsoChk.FolderExists(path)
if (exists) then
MsgBox("Chocolatey Is Already Installed!")
Else
objCall.Run "cmd.exe /k @powershell -NoProfile -ExecutionPolicy unrestricted -Command ""iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin", 1, True
MsgBox("Chocolatey Has Been Installed!")
end if
End Function
Function searchFunc(searcher)
' Setting up a slew of variables and objects
strFileNameRaw = "C:\rawlist.txt"
strFileName = "C:\list.txt"
outFile = "C:\dlList.html"
Set objFSOW = CreateObject("Scripting.FileSystemObject")
Set objFSOR = CreateObject("Scripting.FileSystemObject")
Set write = objFSOW.CreateTextFile(outFile,True)
Set read = objFSOR.OpenTextFile(strFileName)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileNameRaw, ForReading)
Const ForReading = 1
Const ForWriting = 2
chkString = "Chocolatey"
chkString1 = "found."
' End of variables and objects declaration
' Setting up raw list from chocolatey search
commandSearch = "cmd.exe /c chocolatey list " & searcher & " > C:\rawlist.txt"
objCall.Run commandSearch, 0, True
strContents = objTS.ReadAll
objTS.Close
arrLines = Split(strContents, vbNewLine)
Set objTS = objFS.OpenTextFile(strFileName, ForWriting)
For Each strLine In arrLines
If Not(Left((LTrim(strLine)),Len(chkString)) = chkString) AND Not(Right((RTrim(strLine)),Len(chkString1)) = chkString1) Then
objTS.WriteLine strLine
End If
Next
write.Write "<!DOCTYPE HTML>" & vbCrLf &_
"<head>" & vbCrLf &_
"<style>" & vbCrLf &_
".bttnStyle {" & vbCrLf &_
"width: 80%;" & vbCrLf &_
"height: 2em;" & vbCrLf &_
"}" & vbCrLf &_
"</style>" & vbCrLf
write.Write "<script language=""vbscript"">" & vbCrLf &_
"Function cmdBtn_Click()" & vbCrLf &_
"target = window.event.srcElement.Value" & vbCrLf &_
"reply = MsgBox(""Do you wish to install ""& target, vbYesNo)" & vbCrLf &_
"Select Case reply" & vbCrLf &_
"Case vbYes" & vbCrLf &_
"Set objShell = CreateObject(""WScript.Shell"")" & vbCrLf &_
"objShell.Run ""cmd.exe /k cinst "" & target, 1, True" & vbCrLf &_
"Case vbNo" & vbCrLf &_
"End Select" & vbCrLf &_
"End Function" & vbCrLf &_
"</" &_
"script" &_
">" &_
"</head>" & vbCrLf &_
"<body style=""background:#222222;"">" & vbCrLf &_
"<center>" & vbCrLf
Do Until read.AtEndOfStream
strLine= read.ReadLine
write.Write "<input class=""bttnStyle"" type=""button"" name=""cmdBtn"" value=""" & strLine & """ onclick=""vbscript:cmdBtn_Click""><br>" & vbCrLf
Loop
write.Write "<center>" & vbCrLf &_
"</body>" & vbCrLf &_
"</html>"
write.Close
parent.ifrme.Location.Reload(True)
End Function
Function preSearchFunc(searcher)
checker = InStr(searcher,"cinst") OR InStr(searcher,"choco") OR InStr(searcher,"chocolatey")
If ( checker = 0 ) Then
searchFunc(searcher)
Else
inputVal = "cmd.exe /k " & searcher
objCall.Run inputVal, 1, True
End If
End Function
</script>
<style>
#bg {
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
z-index: -1;
}
#bg img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.bttnList {
clear:both;
float:left;
margin-left:2em;
}
</style>
</head>
<body>
<div id="bg"><img src="./resources/other/background.jpg" alt=""></div>
<div class="divStyleHeader">
<div style="float:left;width:50%">
<p class="bttn" onclick="installChoco"><font size="5">Install Chocolatey NuGet!</font></p>
<a href="resources/bin/popular.html" class="bttnList" target="ifrme" size="3">Install Popular Programs!</a>
<a href="resources/bin/exe.html" target="ifrme" class="bttnList" size="3">Exe Programs!</a>
<a href="resources/bin/bat.html" target="ifrme" class="bttnList" size="3">Bat & VBS Programs!</a>
<script language="vbscript">
Function formSubmt
searcher = document.getElementById("query").value
preSearchFunc(searcher)
End Function
</script>
<form style="float:right;">
<input name="query" type="text" >
<input type="button" value="Search/Run" onclick="formSubmt">
</form>
<a href="C:/dlList.html" target="ifrme" style="clear:both;float:right;" size="3">Search List!</a>
</div>
<div style="clear:both;float:right;width:50%">
<a href="resources/bin/ar.html" target="ifrme">
<script language="vbscript">
Function antiRootKit
searcher = "rootkit"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\ar.png" title="Anti-Rootkit" onclick="antiRootKit"></img>
</a>
<a href="resources/bin/as.html" target="ifrme">
<script language="vbscript">
Function antiSpy
searcher = "spyware"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\as.png" title="Anti-Spyware" onclick="antiSpy"></img>
</a>
<a href="resources/bin/am.html" target="ifrme">
<script language="vbscript">
Function antiMal
searcher = "malware"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\am.png" title="Anti-Malware" onclick="antiMal"></img>
</a>
<a href="resources/bin/av.html" target="ifrme">
<script language="vbscript">
Function antiVirus
searcher = "virus"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\av.png" title="Anti-Virus" onclick="antiVirus"></img>
</a>
</div>
</div>
<div class="middleFrame">
<iframe id="ifrme" name="ifrme" src="resources/bin/popular.html" style="height:25em;width:100%;" scrolling="auto" application="yes"></iframe>
</div>
<div class="BottomFrame">
<div style="margin-left:20%;">
<p class="bttnBTTM" onclick="aboutMasterCommand"><font size="5">About Sentinel Command</font></p>
<p class="bttnBTTM" onclick="aboutChoco"><font size="5">About Chocolatey NuGet</font></p>
</div>
</div>
</body>
</html>