hosted Posted August 26, 2009 Report Posted August 26, 2009 Is there a linux script to pull the provisioning password per domain? (like the password script) Quote
Vodia PBX Posted August 26, 2009 Report Posted August 26, 2009 Is there a linux script to pull the provisioning password per domain? (like the password script) So far no. But the http://kiwi.pbxnsip.com/index.php/Password_Overview (sorry I can't find it in the knowledge database) should be a very good template for this. Quote
pbxuser911 Posted October 12, 2009 Report Posted October 12, 2009 is it possible to be able to also add that it should include the Domain name in the results when using the following script #!/bin/bash # Show the passwords of all users: function get_xml() { gawk -v tag=$1 'BEGIN{regex="<" tag ">([^<]*)</" tag ">";}{ match($0, regex, m); for(i = 1;; i++) { if(!(i in m)) break; printf("%s\n",m[i]);}}' $2 } for user in users/*.xml do name=${user:6} # only the name idx=${name%.xml} # only the number type=$(get_xml type $user) if [ "$type" == extensions ]; then id=$(get_xml id $user) primary=$(get_xml alias $user) dialplan=$(get_xml dial_plan $user) if [ -z "$dialplan" ]; then plan="Default" else plan=$(get_xml name dial_plan/$dialplan.xml) fi password=$(get_xml password extensions/$id.xml) pin=$(get_xml mb_pin extensions/$id.xml) username=$(get_xml name user_alias/$primary.xml) if [ -z "$pin" ]; then echo $username $password \($plan\) else echo $username $password \($plan\) [$pin] fi fi done Quote
pbx support Posted October 12, 2009 Report Posted October 12, 2009 is it possible to be able to also add that it should include the Domain name in the results when using the following script This should do the domain name #!/bin/bash # Show the passwords of all users: function get_xml() { gawk -v tag=$1 'BEGIN{regex="<" tag ">([^<]*)</" tag ">";}{ match($0, regex, m); for(i = 1;; i++) { if(!(i in m)) break; printf("%s\n",m[i]);}}' $2 } for user in users/*.xml do name=${user:6} # only the name idx=${name%.xml} # only the number type=$(get_xml type $user) if [ "$type" == extensions ]; then id=$(get_xml id $user) primary=$(get_xml alias $user) domain=$(get_xml domain user_alias/$primary.xml) for d in domain_alias/*.xml do dom=$(get_xml domain $d) if [ -z "$dom" -a "$dom" == "$domain" ]; then domain_name=$(get_xml name $d) break fi done dialplan=$(get_xml dial_plan $user) if [ -z "$dialplan" ]; then plan="Default" else plan=$(get_xml name dial_plan/$dialplan.xml) fi password=$(get_xml password extensions/$id.xml) pin=$(get_xml mb_pin extensions/$id.xml) username=$(get_xml name user_alias/$primary.xml) if [ -z "$pin" ]; then echo $username $password \($plan\) else echo $username $password \($plan\) [$pin] fi fi done Quote
pbxuser911 Posted October 12, 2009 Report Posted October 12, 2009 doesnt show the domain name also it works much slower then the original code, this one takes time in between the results Quote
pbxuser911 Posted October 19, 2009 Report Posted October 19, 2009 doesnt show the domain name also it works much slower then the original code, this one takes time in between the results Quote
pbx support Posted October 20, 2009 Report Posted October 20, 2009 doesnt show the domain namealso it works much slower then the original code, this one takes time in between the results If you echo the 'domain_name', it will show the domain name. It will be slower (depending on the number of accounts and/or number of domain) because, it has to run another loop for every account. Quote
pbxuser911 Posted October 20, 2009 Report Posted October 20, 2009 can you write that script and post it? i am not familiar with how to write the scripts Quote
pbxuser911 Posted October 22, 2009 Report Posted October 22, 2009 ok, i added the following codes, but it only shows the domain alias, not the full name also its extremely slow, the one i posted on top was much quicker #!/bin/bash # Show the passwords of all users: function get_xml() { gawk -v tag=$1 'BEGIN{regex="<" tag ">([^<]*)</" tag ">";}{ match($0, regex, m); for(i = 1;; i++) { if(!(i in m)) break; printf("%s\n",m[i]);}}' $2 } for user in users/*.xml do name=${user:6} # only the name idx=${name%.xml} # only the number type=$(get_xml type $user) if [ "$type" == extensions ]; then id=$(get_xml id $user) primary=$(get_xml alias $user) domain=$(get_xml domain user_alias/$primary.xml) for d in domain_alias/*.xml do dom=$(get_xml domain $d) if [ -z "$dom" -a "$dom" == "$domain" ]; then domain_name=$(get_xml name $d) break fi done dialplan=$(get_xml dial_plan $user) if [ -z "$dialplan" ]; then plan="Default" else plan=$(get_xml name dial_plan/$dialplan.xml) fi password=$(get_xml password extensions/$id.xml) pin=$(get_xml mb_pin extensions/$id.xml) username=$(get_xml name user_alias/$primary.xml) if [ -z "$pin" ]; then echo $domain $username $password \($plan\) else echo $domain $username $password \($plan\) [$pin] fi fi done Quote
pbxuser911 Posted October 27, 2009 Report Posted October 27, 2009 can anyone onhere that knows linux write the shell script that will show the all the passwords for all domains and accounts, but also include which domain it is for? Quote
hosted Posted November 3, 2009 Author Report Posted November 3, 2009 I always made the first 3 characters represent the domain then the remainder are random. so when I run the script I see what domain.. thats the extent of my hack/scripting skills. Quote
hosted Posted November 7, 2009 Author Report Posted November 7, 2009 I just use the one posted in the wiki. yea that script above is pretty CPU intense. nice -19 i say Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.