Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating PBX Password Changes

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
HELP,

I have been tasked with changing passwords in our PBX’s. I have started a script file, but ran out of idea’s (oh yeah and kind of reached my limitation too). Any help provided would be greatly appreciated.

Here is what I need to do:

1. Provide an Edit Box to Enter the New Password assigned to the String TextStr
2. Log into the PBX with the Known Logon $USERID and Password $PASSWORD.
3. Next enter the Modify Login_Profile Command "MOD LOGIN_PROFILE^M".
4. The system Prompts you for the New Password "PASSWORD: ", then asks you to confirm it "RETYPE PASSWORD: ". Enter the String TextStr for Both Prompts.
5. Next the Families and Sections section comes up (Shows the Administrator authorizations for this particular Login). A PERIOD and Ctrl-J Steps through this section. Once completed you are automatically moved to the next section (Step-5)
6. The Verbs and Nouns Section comes up (this is a list of the specific Commands authorized). I need to Step though this Section by entering a PERIOD and Ctrl-J (this is done until the “MD “ at the Start of the Line changes to a “CR “). Entering a PERIOD and Ctrl-J , completes this task and takes you back to the “COMMAND:” Prompt.
7. Finally entering a “BYE^M” takes you to the % (Percent) Prompt.
8. The PBX,if it has a Standby CPU installed will run Backups (shown by: AUTO STANDBY UPDATES IN PROGRESS, once the Backups are Completed (AUTO STANDBY UPDATES COMPLETED) enter “BYE^M” to move back to the Login Screen.
9. Hang Up
10. Is there a way I can Update the Dialing Directory automatically (ie. Set TextStr = $PASSWORD)??


Below is an Example of the Prompts from my Capture File:

COMMAND: MOD LOGON_PROFILE
NAME (1-12 CHARS): TRAFFIC

PASSWORD:
RETYPE PASSWORD:


F A M I L I E S A N D S E C T I O N S
FAMILY SEC FAMILY SEC FAMILY SEC
--------------- --- --------------- --- --------------- ---
MD SYSTEM_ADMIN ALL SYSTEM_MAINT ALL DATA_MANAGER ALL
MD DATA_MAINT ALL ACD_ADMIN ALL
CR .


V E R B S A N D N O U N S
VERB NOUN NOUN NOUN
--------------- ------------------ ------------------ ------------------
MD LIST SPEED FEAT_CODE FIRST_DIGIT
MD LIST .ARAM COS_FEAT SLI
MD .ODIFY TRAF_INTERVAL
MD .OUNT SPEED FEAT_CODE FIRST_DIGIT
MD .OAD STBY
MD .LEAR ERRH TRAF RPET
MD .ET TRAF
MD .ONITOR TRAF EXTEN TRK
MD .IAG
MD .NFG
CR .

Here is the Script File I Have so Far:


Code:
proc main
string TextStr
integer Event
if $CONNECTOPEN ; check for connection...

WHEN TARGET 0 "NO MATCH" CALL iLogoff
WHEN TARGET 1 " F A M I L I E S A N D S E C T I O N S" CALL CtrlJ
WHEN TARGET 2 " V E R B S A N D N O U N S" CALL CtrlJ
WHEN TARGET 3 "AUTO STANDBY UPDATES IN PROGRESS - CNFG ACTIVITY WILL BE SUSPENDED." Call WaitLogoff

; Define and display dialog with edit box.
dialogbox 0 286 116 127 55 11 " Enter the NEW Password"
editbox 1 18 12 91 12 TextStr
pushbutton 2 40 31 50 14 "OK"
enddialog
while 1
dlgevent 0 Event ; Read dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase

case 1 ; Edit box was changed.
endcase
default ; Exit event selected.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.
if not nullstr TextStr ; See that TextStr isn't empty.
else
usermsg "No text entered."
endif
usermsg "Proceed to the COMMAND Prompt!"
transmit "MOD LOGON_PROFILE^M"
waitfor "NAME (1-12 CHARS): ^]"
transmit "TRAFFIC^M"
waitfor "PASSWORD: ^]"
if nullstr TextStr
Transmit "LONESTAR^M"
waitfor "RETYPE PASSWORD: ^]"
Transmit "LONESTAR^M"
else
strcat TextStr "^M"
Transmit TextStr
waitfor "RETYPE PASSWORD: ^]"
transmit TextStr
endif

waitfor "COMMAND: ^]"
transmit "by^M"
waitfor "% ^]"
transmit "by^M"
else
errormsg " The modem has lost the connection.. Please Reconnect."
halt
endif
hangup
endproc

proc CtrlJexit
transmit ".^J"
endproc

proc CtrlJ
string CmdPrmpt
integer i
CmdPrmpt = "COMMAND: ^]"
WHEN TARGET 4 "CR ^]" CALL CtrlJexit
for i = 1 upto CmdPrmpt
transmit ".^J"
endfor
endproc

proc iLogoff
transmit "BYE^M"
waitfor "% ^]"
transmit "BYE^M"
hangup
usermsg "the TRAFFIC Login was NOT Configured!"
halt
endproc

proc WaitLogoff
waitfor "AUTO STANDBY UPDATES COMPLETED" FOREVER
transmit "BYE^M"
hangup
usermsg "the TRAFFIC Login was NOT Configured!"
halt
endproc
Code:

Any and all help or suggestions will be greatly appreciated.

 
I didn't have time to step through your code, but how close are you to being complete and what do you lack? If you aren't very far into the script, you can use Procomm's Script Recorder to record the basic framework (what you sent out in response to what the remote system sent to you), and then add any necessary UI and other components.

To enable the Script Recorder, select the Tools | Scripts | Start Recorder menu item. Procomm Plus will now monitor all incoming data and your outgoing responses to that data. Start performing the tasks (keyboard-based only!) that you want Procomm Plus to record. Once done, select the Tools | Scripts | Stop Recorder menu item. You will be prompted to save your recorded script. When you view your script, you will see that it is composed of waitfor/transmit commands. If all looks well, either copy and paste portions of your recorded script into your existing script or vice versa, whichever seems easiest for you.
aspect@aspectscripting.com
 
Well,

I need to Find some way to send the Ctrl-J for each line that starts with "MD ", until the "MD " changes to "CD ". (probably something like a For Next Loop, I'm not very good at those yet). Next How to Move the New Password (that temporaraly resides in the TextStr to the Connection Directory, USERID and PASSWORD Fields. I guess these are the most fundamental problems I have. The Script recorder won't help me with these issues. Everything else seems to work so far.

Appreciate any Help you can provide.


 
To place the contents of the TextStr variable into the userid and password fields of a Connection Directory entry, the below snippet should do the trick:

set dialentry access DATA "test"
set userid TextStr
set password TextStr
dialsave

This would set the logon and username for the data entry named test.

If ever need to retrieve the information, you would use:

set dialentry access DATA "test"
fetch userid TextStr
<do any necessary commands now that you have the userid>
fetch password TextStr
<now you have the password>

Are the number and placement of the lines that start with MD consistent, or can this vary from record to record? You could use something like:

when target 0 &quot;MD&quot; MATCHCASE call ctrlj (located at the beginning of your main script)

proc ctrlj
transmit &quot;^J&quot;
endproc

This would send a Ctrl-J each time &quot;MD&quot; was received. You would then just need your script to wait for the &quot;CD&quot; at the appropriate part.

Another option is to read a line at a time from the modem using the rget command, then use the strfind command to search that line for CD or MD. Depending on the result of the search, you would know what to send. You could then resume with waitfor/transmit statements for the remainder of the script.
aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top