/build/static/layout/Breadcrumb_cap_w.png

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.

0 Comments   [ + ] Show comments

Answers (7)

Posted by: Jsaylor 15 years ago
Second Degree Blue Belt
2
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
Second Degree Blue Belt
0
Thanks for the reply....I will try it, and let you know regarding the same.
Posted by: abking99 15 years ago
Second Degree Blue Belt
0
Hi,
it is displaying msgbox but not displaying password in it.1st time when i run this script, it gives type mismatch error at line 37
Posted by: Jsaylor 15 years ago
Second Degree Blue Belt
0
That means that it cannot find a line in your text document that contains "Patrol->"

Is that string not common to what you're looking for?
Posted by: abking99 15 years ago
Second Degree Blue Belt
0
that text contains patrol, it is the same text which i have given in the 1st post.
if i copy ur script as it is then it gives error on line 35 by mistake i said its 37.
the error line is:
strPassword = arrpassword(1)
if i remove (1) then it shows msgbox but does not show password in that
Posted by: abking99 15 years ago
Second Degree Blue Belt
0
You were right dude....your script is perfect
Posted by: Jsaylor 15 years ago
Second Degree Blue Belt
0
You can add some error trapping to it if you think that the "Patrol->" line may not exist sometimes.

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.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ