|
Metroidn1f
|
 |
« on: February 07, 2010, 08:02:01 AM » |
|
If this is aloud, I am going to use this topic for all my help that I need that has to do with HTA. If that is not aloud, I am sorry, you can go ahead and delete. I have just learned a lot from this forum. Help #1. Is it possible to password protect a HTA window for use? What I want to happen is, when the HTA is opened, before it is able to be used, you have to enter the password, if you do not know the password it will not work. Also if possible, could it be the same theme as the HTA window? And could the characters be masked out? I know there is a password thing that can be added to open the HTA, but it is like really basic, I don't think you can change that theme or mask the characters. Here is my script that I would like to add the password to use too. <Title>PasswordConfrmation</Title> <HTA:APPLICATION ID="Passconfrm" SCROLL="No" SCROLLFLAT="No" SingleInstance="Yes" ShowInTaskbar="Yes" SysMenu="Yes" MaximizeButton="No" MinimizeButton="No" Border="Thin" BORDERSTYLE="Complex" INNERBORDER="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="MainApp" Icon="%SystemRoot%\winhlp32.exe"> <STYLE type="text/css"> BODY { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Lucida Console; Color:#FFFFFF; BackGround-Color:#000000; Margin-Top:12; Margin-Bottom:0; Margin-Left:10; Margin-Right:12; Padding-Top:0; Padding-Bottom:0; Padding-Left:0; Padding-Right:0; Text-Align:Left; Vertical-Align:Top; } TD.Type1 { Margin-Left:0; Padding-Left:0; } BUTTON { Height:18pt; width:60pt; Cursor:Hand; Font:8.25pt; Font-weight:Bold; Font-family:Lucida Console; Color:#000000; Text-Align:Center; Vertical-Align:Middle; BackGround-Color:#FFFFFF; Margin:0; Padding:0; Border-Left:1px; Border-Right:2px; Border-Top:1px; Border-Bottom:2px; } </STYLE> <script Language='VBSCRIPT'> '-> Scripting Objects Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%Temp%") & "\PassConfrmation.bat" '-> Resize And Move Window Dim Wth :Wth = int(452) Dim Hht :Hht = int(180) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) '-> Count Down Display Varibles Dim idTimer Dim C1 :C1 = 4 Dim D1 :D1 = 1 '-> Text Display Varible Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#FFFFFF;Font-Weight:Bold;'>" '-> OnLoad Action Function Window_OnLoad() txt1.innerHTML = F1 & "****************************************************</FONT>" txt2.innerHTML = F1 & "This Scirpt was created by Metroidn1f.</FONT>" txt3.innerHTML = F1 & "(Franky Magliocco)</FONT>" txt4.innerHTML = F1 & "****************************************************</FONT>" txt5.innerHTML = F1 & "Click Continue, to continue.</FONT>" End Function '-> Count Down Function Function Counter() Do C1 = C1 -1 D1 = D1 -1 document.focus() ' Makes 1 Threw 9 Look like 01, 02 ETC If Len(C1) = 1 Then C1 = "0" & C1 If Len(C1) = 2 Then C1 = C1 txt5.innerHTML = Replace(F1,"002060","955900") & "Continuing in "& C1 &".</FONT>" Loop Until D1 = 0 D1 = 1 If C1 = -1 Then Window.Close() Exit Function End if idTimer = window.setTimeout("Counter", 1000, "VBScript") End Function '-> Continue Button Action Function Continue_Action() Bttn_01.Disabled = True Counter() '-> Create The Temp Cmd File For Continue Set Ts = Fso.CreateTextFile(Cmd) Ts.WriteLine "SET REPLY=metroid.3" Ts.Close Exit Function End Function </SCRIPT> <BODY Scroll='No'> <!-- txt1 Display --> <Table><TD Class='Type1'><Span ID='txt1'></Span></TD></Table> <!-- txt2 Display --> <CENTER><Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table></CENTER> <!-- txt3 Display --> <CENTER><Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table></CENTER> <!-- txt4 Display --> <Table><TD Class='Type1'><Span ID='txt4'></Span></TD></Table> <!-- txt5 Display --> <CENTER><Table><TD Class='Type1'><Span ID='txt5'></Span></TD></Table></CENTER> <!-- Button Display --> <Table Style='Margin-Top:8pt;' Align='Center'> <!-- Button 01 --> <TD><BUTTON ID='Bttn_01' OnClick='Continue_Action()'>Continue</BUTTON></TD> </Table> </BODY>
|
|
|
|
|
Logged
|
I might only be 16, but I am really smart with computers!
|
|
|
|
|
BJseal91
|
 |
« Reply #1 on: February 07, 2010, 12:17:58 PM » |
|
not sure try this
Sub Run(ByVal sFile) Dim shell
Set shell = CreateObject("WScript.Shell") shell.Run Chr(34) & sFile & Chr(34), 1, false Set shell = Nothing End Sub
Dim storedPassword storedPassword ="Password"
password = InputBox("Please type the Password.") if password = storedPassword Then
Else WScript.Echo "That was the wrong Password!" End if
put this
Else WScript.Echo "That was the wrong Password!" End if
wright at the end of the script when closing the script this is certainly it for .vbs files
and should work in hta set the password to what you want it to be change the word "password" to what ever
let us know unfortunity i am not good a hta programming
speak soon
|
|
|
|
|
Logged
|
|
|
|
|
Metroidn1f
|
 |
« Reply #2 on: February 07, 2010, 12:38:43 PM » |
|
Thanks. But I get this error.
Line 82 Char 1 Syntax error.
I used Adobe Dreamweaver to view it so on the side it will display the line numbers. I will highlight it in red. If this does not work, I have another idea. If it is not to much to ask, could you re-right this script so it can be .vbs? You don't have to, I just do not know anything about .vbs. I was up hours last night searching for a solution but I could not find anything. But ya, if this does not work, could you re-right it to be .vbs? Hopefully keeping the same theme and the messages.
<Title>PasswordConfrmation</Title> <HTA:APPLICATION ID="Passconfrm" SCROLL="No" SCROLLFLAT="No" SingleInstance="Yes" ShowInTaskbar="Yes" SysMenu="Yes" MaximizeButton="No" MinimizeButton="No" Border="Thin" BORDERSTYLE="Complex" INNERBORDER="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="MainApp" Icon="%SystemRoot%\winhlp32.exe"> <STYLE type="text/css"> BODY { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Lucida Console; Color:#FFFFFF; BackGround-Color:#000000; Margin-Top:12; Margin-Bottom:0; Margin-Left:10; Margin-Right:12; Padding-Top:0; Padding-Bottom:0; Padding-Left:0; Padding-Right:0; Text-Align:Left; Vertical-Align:Top; } TD.Type1 { Margin-Left:0; Padding-Left:0; } BUTTON { Height:18pt; width:60pt; Cursor:Hand; Font:8.25pt; Font-weight:Bold; Font-family:Lucida Console; Color:#000000; Text-Align:Center; Vertical-Align:Middle; BackGround-Color:#FFFFFF; Margin:0; Padding:0; Border-Left:1px; Border-Right:2px; Border-Top:1px; Border-Bottom:2px; } </STYLE> <script Language='VBSCRIPT'> Sub Run(ByVal sFile) Dim shell
Set shell = CreateObject("WScript.Shell") shell.Run Chr(34) & sFile & Chr(34), 1, false Set shell = Nothing End Sub
Dim storedPassword storedPassword ="Password"
password = InputBox("Please type the Password.") if password = storedPassword Then
Else WScript.Echo "That was the wrong Password!" End if
put this
Else WScript.Echo "That was the wrong Password!" End if '-> Scripting Objects Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%Temp%") & "\PassConfrmation.bat" '-> Resize And Move Window Dim Wth :Wth = int(452) Dim Hht :Hht = int(180) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) '-> Count Down Display Varibles Dim idTimer Dim C1 :C1 = 4 Dim D1 :D1 = 1 '-> Text Display Varible Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#FFFFFF;Font-Weight:Bold;'>" '-> OnLoad Action Function Window_OnLoad() txt1.innerHTML = F1 & "****************************************************</FONT>" txt2.innerHTML = F1 & "This Scirpt was created by Metroidn1f.</FONT>" txt3.innerHTML = F1 & "(Franky Magliocco)</FONT>" txt4.innerHTML = F1 & "****************************************************</FONT>" txt5.innerHTML = F1 & "Click Continue, to continue.</FONT>" End Function '-> Count Down Function Function Counter() Do C1 = C1 -1 D1 = D1 -1 document.focus() ' Makes 1 Threw 9 Look like 01, 02 ETC If Len(C1) = 1 Then C1 = "0" & C1 If Len(C1) = 2 Then C1 = C1 txt5.innerHTML = Replace(F1,"002060","955900") & "Continuing in "& C1 &".</FONT>" Loop Until D1 = 0 D1 = 1 If C1 = -1 Then Window.Close() Exit Function End if idTimer = window.setTimeout("Counter", 1000, "VBScript") End Function '-> Continue Button Action Function Continue_Action() Bttn_01.Disabled = True Counter() '-> Create The Temp Cmd File For Continue Set Ts = Fso.CreateTextFile(Cmd) Ts.WriteLine "SET REPLY=metroid.3" Ts.Close Exit Function End Function </SCRIPT> <BODY Scroll='No'> <!-- txt1 Display --> <Table><TD Class='Type1'><Span ID='txt1'></Span></TD></Table> <!-- txt2 Display --> <CENTER><Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table></CENTER> <!-- txt3 Display --> <CENTER><Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table></CENTER> <!-- txt4 Display --> <Table><TD Class='Type1'><Span ID='txt4'></Span></TD></Table> <!-- txt5 Display --> <CENTER><Table><TD Class='Type1'><Span ID='txt5'></Span></TD></Table></CENTER> <!-- Button Display --> <Table Style='Margin-Top:8pt;' Align='Center'> <!-- Button 01 --> <TD><BUTTON ID='Bttn_01' OnClick='Continue_Action()'>Continue</BUTTON></TD> </Table> </BODY>
|
|
|
|
« Last Edit: February 07, 2010, 12:48:39 PM by Metroidn1f »
|
Logged
|
I might only be 16, but I am really smart with computers!
|
|
|
|
|
|
BJseal91
|
 |
« Reply #3 on: February 08, 2010, 12:52:27 AM » |
|
Hi there I will make some points
Else WScript.Echo "That was the wrong Password!" End if should be put at the bottom of the page it is the last writing to go on the page after # </Table> </BODY> Else WScript.Echo "That was the wrong Password!" End if
like that I could write it in .vbs but you would not have text like you do in hta it is diffrent all together
also could you post the path of the log.log
and also the extention of the file i.e log.txt & the format of the document
and a clear statment of what you want to achive and the objective of the ida so it can help me to write the script
example I want log.log to open and put a line of text with the date each time it opens so i can monitor the file
the file dose .....................................
and that is the reasion for the script
this will help a lot to understand what you want so i can help you and write it in .vbs
which I am happy to do
also the file will not have coulor and other text it will be basic information given or what you are trying to
achive as you will appricate HTA is a diffrent language and I have never come across it untill now so I dont know much about it unfortunity other than it is hta and html based and jarva based language
hope this helps you understand what i am after in order to help you
speak soon Kind Regards
Bradley
|
|
|
|
|
Logged
|
|
|
|
|
BJseal91
|
 |
« Reply #4 on: February 12, 2010, 12:16:33 PM » |
|
Hi How are you are you ok with that
|
|
|
|
|
Logged
|
|
|
|
|
Metroidn1f
|
 |
« Reply #5 on: February 12, 2010, 12:34:12 PM » |
|
Ya, what ever way it can work. But just have a couple more questions, I will answer yours too. Is it possible to deny access to the hta from vbs, until the password is correctly typed into the vbs? Is it possible to do what I want to do, (Which will be listed below) with Java, which will allow the customized text and background color?
Okay here is what I want to do. There is no log. All I want to happen is. I have this batch file, but before use, it prompt for a password, which I could not get to be hidden while it was typed into the prompt, so I turned to hta, which now I know wont work. So now all the vbs, Java or what ever is going to do is ask me for the password, I type it into the vbs or java, and hopefully it can be hidden while it is typed. And if it is typed correctly you would press "Ok", and it would make a bat file in the %Temp% directory saying SET REPLY=metroid.3 . The batch file will then call the batch file that was just made to verify that the password was typed in correctly and there for can go on to the rest of the batch.
|
|
|
|
|
Logged
|
I might only be 16, but I am really smart with computers!
|
|
|
|
Metroidn1f
|
 |
« Reply #6 on: February 12, 2010, 03:28:34 PM » |
|
Never mind, I have figured it out. I was looking at the password script that you gave me, the one that was on the Microsoft sight, and another one that I fond on the Internet a while ago, and figured it out. It is not password protected, like it still opens, but it asks for a password in it, so if I typed the password right, and click continue, it will continue, if I type it wrong, I will get a message pop up saying "Wrong!" If I get it wrong greater the 6 times, it will close the window. Here is what I came up with, works and everything.
<Title>PasswordConfrmation</Title> <HTA:APPLICATION ID="Passconfrm" SCROLL="No" SCROLLFLAT="No" SingleInstance="Yes" ShowInTaskbar="Yes" SysMenu="Yes" MaximizeButton="No" MinimizeButton="No" Border="Thin" BORDERSTYLE="Complex" INNERBORDER="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="MainApp" Icon="%SystemRoot%\winhlp32.exe"> <STYLE type="text/css"> BODY { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Lucida Console; Color:#FFFFFF; BackGround-Color:#000000; Margin-Top:12; Margin-Bottom:0; Margin-Left:10; Margin-Right:12; Padding-Top:0; Padding-Bottom:0; Padding-Left:0; Padding-Right:0; Text-Align:Left; Vertical-Align:Top; } TD.Type1 { Margin-Left:0; Padding-Left:0; } BUTTON { Height:18pt; width:60pt; Cursor:Hand; Font:8.25pt; Font-weight:Bold; Font-family:Lucida Console; Color:#000000; Text-Align:Center; Vertical-Align:Middle; BackGround-Color:#FFFFFF; Margin:0; Padding:0; Border-Left:1px; Border-Right:2px; Border-Top:1px; Border-Bottom:2px; } </STYLE> <script Language='VBSCRIPT'> '-> Scripting Objects Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%Temp%") & "\PassConfrmation.bat" '-> Resize And Move Window Dim Wth :Wth = int(452) Dim Hht :Hht = int(222) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) '-> Count Down Display Varibles Dim idTimer Dim C1 :C1 = 4 Dim D1 :D1 = 1 '-> Text Display Varible Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#FFFFFF;Font-Weight:Bold;'>" '-> OnLoad Action Function Window_OnLoad() txt1.innerHTML = F1 & "****************************************************</FONT>" txt2.innerHTML = F1 & "This Scirpt was created by Metroidn1f.</FONT>" txt3.innerHTML = F1 & "(Franky Magliocco)</FONT>" txt4.innerHTML = F1 & "****************************************************</FONT>" txt5.innerHTML = F1 & "Enter Password.</FONT>" txt6.innerHTML = F1 & "Click Continue, to continue.</FONT>" End Function '-> Count Down Function Function Counter() Do C1 = C1 -1 D1 = D1 -1 document.focus() ' Makes 1 Threw 9 Look like 01, 02 ETC If Len(C1) = 1 Then C1 = "0" & C1 If Len(C1) = 2 Then C1 = C1 txt6.innerHTML = Replace(F1,"002060","955900") & "Continuing in "& C1 &".</FONT>" Loop Until D1 = 0 D1 = 1 If C1 = -1 Then Window.Close() Exit Function End if idTimer = window.setTimeout("Counter", 1000, "VBScript") End Function PssWrd="metroid.3" NTries=0 '-> Continue Button Action Function Continue_Action() If PssWrd=PssWrdArea.Value Then Bttn_01.Disabled = True '-> Create The Temp Cmd File For Continue Set Ts = Fso.CreateTextFile(Cmd) Ts.WriteLine "SET REPLY=metroid.3" Ts.Close Counter() Else MsgBox "Wrong!" NTries=NTries + 1 If NTries > 6 Then MsgBox "You have reached the max amount of tries." Window.Close() End If End If Exit Function End Function </SCRIPT> <BODY Scroll='No'> <!-- txt1 Display --> <Table><TD Class='Type1'><Span ID='txt1'></Span></TD></Table> <!-- txt2 Display --> <Center><Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table></Center> <!-- txt3 Display --> <Center><Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table></Center> <!-- txt4 Display --> <Table><TD Class='Type1'><Span ID='txt4'></Span></TD></Table> <!-- txt5 Display --> <Center><Table><TD Class='Type1'><Span ID='txt5'></Span></TD></Table></Center> <Center><TD><Input Type="Password" Name="PssWrdArea"><Size="12"></Input></TD></Center> <!-- txt6 Display --> <Center><Table><TD Class='Type1'><Span ID='txt6'></Span></TD></Table></Center> <!-- Button Display --> <Table Style='Margin-Top:8pt;' Align='Center'> <!-- Button 01 --> <TD><Button ID='Bttn_01' OnClick='Continue_Action()'>Continue</Button></TD> </Table> </BODY>
|
|
|
|
|
Logged
|
I might only be 16, but I am really smart with computers!
|
|
|
|
BJseal91
|
 |
« Reply #7 on: February 14, 2010, 01:19:03 PM » |
|
Pleased it worked and you solved your problem
|
|
|
|
|
Logged
|
|
|
|
|
Metroidn1f
|
 |
« Reply #8 on: February 20, 2010, 08:05:12 AM » |
|
Is there any type of scripting notepad that lists the line numbers on the side? Except Adobe Dreamweave, it takes to much RAM. I want something that is portable and does not use as much resources.
|
|
|
|
|
Logged
|
I might only be 16, but I am really smart with computers!
|
|
|
|