Copy password through script
Hi,
I have to search for the "Patrol->EzmeGJz3xqYSY+s+8S2On89D+tU…" from below text in which EzmeGJz3xqYSY+s+8S2On89D+tU is an encrypted password, which i want to copy and replace in another txt file, how can i do that? specially when I can not find with hardcoded value, because this password will keep changing in every month.
[replacing I can do, but I want to know how can I copy it, ]
Creating new policy ...
Site policy = 'SOFTWARE\BMC Software\Patrol\SecurityPolicy_v3.0\site…
Appl policy = 'SOFTWARE\BMC Software\Patrol\SecurityPolicy_v3.0\agen…
ModuleName C:\Program Files\BMC Software\common\security\bin_v3.0\Window…
BPW Module, Version 1.0|ess3.0.11.0|win32|Oct 24 2007|19:34:56
Patrol->EzmeGJz3xqYSY+s+8S2On89D+tU…
BPW Module, Version 1.0|ess3.0.11.0|win32|Oct 24 2007|19:34:56
Anticipated decryption error -1.
I have to search for the "Patrol->EzmeGJz3xqYSY+s+8S2On89D+tU…" from below text in which EzmeGJz3xqYSY+s+8S2On89D+tU is an encrypted password, which i want to copy and replace in another txt file, how can i do that? specially when I can not find with hardcoded value, because this password will keep changing in every month.
[replacing I can do, but I want to know how can I copy it, ]
Creating new policy ...
Site policy = 'SOFTWARE\BMC Software\Patrol\SecurityPolicy_v3.0\site…
Appl policy = 'SOFTWARE\BMC Software\Patrol\SecurityPolicy_v3.0\agen…
ModuleName C:\Program Files\BMC Software\common\security\bin_v3.0\Window…
BPW Module, Version 1.0|ess3.0.11.0|win32|Oct 24 2007|19:34:56
Patrol->EzmeGJz3xqYSY+s+8S2On89D+tU…
BPW Module, Version 1.0|ess3.0.11.0|win32|Oct 24 2007|19:34:56
Anticipated decryption error -1.
0 Comments
[ + ] Show comments
Answers (7)
Please log in to answer
Posted by:
Jsaylor
15 years ago
Provided the line "Patrol->" always precedes the password you want to copy, here is how I would do it:
strPathToTxt = inputbox("Enter path to text file here")
Set objFSO = Createobject("scripting.filesystemobject")
'\\ Evaluate if your file exists, if it does, open the file
If objFSO.fileExists(strPathToTxt) then
Set objFile = objFSO.OpenTextFile(strPathToTxt)
Else
wscript.echo "File not found!"
Wscript.quit
End if
'\\ Turn the file into a string, then split the string into an array on a line-by-line basis
strcontents = objFile.ReadAll
arrcontents = Split(strcontents, vbnewline)
'\\ Evaluate the array for lines that contain "Patrol->"
For Each strline in arrcontents
if instr(1,Lcase(strline),"patrol->",1) then
'\\ when found, split the line into an array based on the > character
arrpassword = Split(strline,">")
end if
Next
'\\ Now arrpassword(1) contains everything after ">" on the line that contained Patrol->
'\\ Set arrpassword(1) to a single string
strPassword = arrpassword(1)
'\\ Profit!
wscript.echo strPassword
Posted by:
abking99
15 years ago
Posted by:
abking99
15 years ago
Posted by:
Jsaylor
15 years ago
Posted by:
abking99
15 years ago
Posted by:
Jsaylor
15 years ago
You can add some error trapping to it if you think that the "Patrol->" line may not exist sometimes.
Something like:
Toss that in before the arrpassword(1) call, and it will exit the script and let you know that it cannot find the search string.
Something like:
If arrpassword = "" Then
wscript.echo "No password found"
wscript.quit
end if
Toss that in before the arrpassword(1) call, and it will exit the script and let you know that it cannot find the search string.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.