LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2015, 10:39 PM   #1
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361
Blog Entries: 3

Rep: Reputation: 48
Question Expect: admin login to Cisco SPA303 phone


Hello all.

I need to do some maintenance job with hundrerds of Cisco SPA303 ip-phones (provisioning, firmware upgrade and forced reboot). All these actions require to log in as admin with the password. You may see it on the screenshot.

For example these HTTP requests require being logged in as admin:
http://10.145.14.20/admin/upgrade?ht...1:8000/spa.bin
http://10.145.14.20/admin/reboot

The question is: what's the best way to pass credentianls automatically from a bash script? Should I use expect or something else?

Thank you.
Attached Thumbnails
Click image for larger version

Name:	spa303-auth.png
Views:	239
Size:	31.0 KB
ID:	20142  

Last edited by Lexus45; 11-26-2015 at 10:41 PM.
 
Old 11-28-2015, 11:40 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Lexus45 View Post
Hello all.
I need to do some maintenance job with hundrerds of Cisco SPA303 ip-phones (provisioning, firmware upgrade and forced reboot). All these actions require to log in as admin with the password. You may see it on the screenshot.

For example these HTTP requests require being logged in as admin:
http://10.145.14.20/admin/upgrade?ht...1:8000/spa.bin
http://10.145.14.20/admin/reboot

The question is: what's the best way to pass credentianls automatically from a bash script? Should I use expect or something else? Thank you.
I'd use curl for this...it specifically deals with web pages. This:
Code:
curl --user name:password http://web.page.com
...is all you need for a bash script. Much documentation and examples available on how to use curl.
 
1 members found this post helpful.
Old 12-01-2015, 01:11 AM   #3
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361

Original Poster
Blog Entries: 3

Rep: Reputation: 48
Thank you for the help. Though, this doesn't work )

I found how to solve the problem. Maybe somebody also needs:

Code:
curl --anyauth -u login:pass http://10.145.13.229/admin/reboot
This is for Cisco SPA303 sip-phone.
 
Old 12-01-2015, 08:24 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Lexus45 View Post
Thank you for the help. Though, this doesn't work )

I found how to solve the problem. Maybe somebody also needs:
Code:
curl --anyauth -u login:pass http://10.145.13.229/admin/reboot
This is for Cisco SPA303 sip-phone.
Ah. Very sorry I didn't provide you with the exact string you needed. The "-u" is the same as the "--user" I originally sent you, so you only added one flag to the command. Thought that doing a small bit of research on your ownwould be ok, since you asked for ideas.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Problem with expect script for telneting cisco switches s.farhan Linux - Desktop 6 02-07-2012 12:35 AM
CISCO IP Phone 7960 SERIES devUnix General 0 03-08-2011 02:35 PM
What should I expect if I were to land a job as a windows server 2k8 admin? Dogs General 16 09-24-2009 12:05 AM
LXer: Using expect to find a MAC Address on a CISCO IOS Switch LXer Syndicated Linux News 0 10-20-2008 03:10 AM
using expect scripts for remote admin jmr71769 Linux - General 3 01-21-2004 01:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration