Posts Tagged ‘ Script

Dump Asterisk Realtime Voicemail users into Voicemail.conf

While I’ve been lazy about updating my site, I have not been lazy with writing new scripts and coming up with ideas to write about.

The first in the set that I’m going to make public is a script to dump your Asterisk Realtime Voicemail database users into a flat voicemail.conf file. I used this technique while troubleshooting to revert back to the standard setup while I was working on the realtime config.

#!/bin/bash
function get_mailbox {
 
   mailbox=$( mysql -u dbuser --password=dbpass asterisk -e "select mailbox from voicemail_users where uniqueid = '$i'")
   mailbox=`echo $mailbox | awk '{print $2}'`
 
}
 
function get_password {
 
    password=$(mysql -u dbuser --password=dbpass asterisk -e "select password from voicemail_users where uniqueid = '$i'")
    password=`echo $password | awk '{print $2}'`
 
}
 
function get_fullname {
 
    name=$(mysql -u dbuser --password=dbpass asterisk -e "select fullname from voicemail_users where uniqueid = '$i'")
    name=`echo $name | awk '{print $2}'`
 
}
 
function get_email {
 
    email=$(mysql -u dbuser --password=dbpass asterisk -e "select email from voicemail_users where uniqueid = '$i'")
    email=`echo $email | awk '{print $2}'`
 
}
 
function write_file {
 
    echo "$mailbox => $password,$name,$email,,attach=yes|saycid=no|envelope=no|delete=no" >> /root/test_dump.txt
 
}
 
for (( i=1; i<=151; i++))
do
get_mailbox
get_password
get_fullname
get_email
write_file
done

Rick Roll Script is Back!!! Well sorta…

Notice I used 3 exclamations in the title to convey how excited I am. I’ve been working on developing a new platform that I can better monitor for the Rick Roll Script. I’ve setup a new domain called prankforce.com which now hosts the previous script. I’ve spent a lot of time cleaning this bad boy up for production use and I’ve learned quite a bit in the process. After proving to be one of the most popular features on the site, I think that these changes will be welcomed. If you have any suggestions or questions regarding this project, please let me know.

Right now the site has the following features:

  • custom invite script
  • call logging
  • 1 hour wait between prank calls
  • blacklist of phone numbers that can’t be dialed

Coming features:

  • Message Board
  • ability to suggest new audio and vote for other suggestions (reddit style)
  • a decent UI (Sorry I’m not a designer)

Right now the site is by invite only. If want an invite, just send an email to admin@prankforce.com

Debian/Ubuntu Anti-Virus and Root Kit Scan Script

A customer requested this script, once I started working on it I realized how useful this could be. I have this setup on a weekly CRON task. The script is very simple, it updates ClamAV and RKHunter then scans the server with both and mails the results to the specified email address. If you plan on adding this script to your server, you might want to ensure that you have the correct versions of ClamAV and RKHunter.

Click here to download the script

Click Here to see the full post with install instructions

Debian/Apache2 Virtualized Host Script

I wrote this script so that I could quickly create virtualized subdomains on my server. I wrote it so that all you have to do to reuse it is simply change the first 3 lines of the file to match your server. This is version 1.o and I plan to add some more error handling and improvements further down the road. Feel free to contact me with any feedback or suggestions.

Click Here to see the full Post
or
Click Here to download the script

SSI Test Script

Often, when supporting dedicated servers, we need to check if Server Side Includes are working correctly. We wrote this very simple script that we upload on to our customers servers as test.shtml. Here’s the script:

 
<!--#echo var="DATE_LOCAL" -->

If you do not see the date displayed when browsing to your test.shtml file, check your httpd.conf file and ensure that mod_include is enabled. Restart Apache and test again, you should see the current date on the server.

Arduino Server/Service Monitor

I’ve successfully written a bash script that runs once every minute. The script detects whether or not my server is online by issuing a simple ping request. Based on results of the ping request(s), the arduino will display a green LED when the server is online or a red LED if the server is offline. I’ve also setup a cron job to execute the script once a minute, giving me up to the minute status of my server. This specific project is not terribly amazing, but the foundation for many more projects to come has laid.

Click Here for the full project page

Plesk Hack: Email and FTP Usernames and Passwords

I wrote this simple script for work. This script allows us to gather all the username and password information on the server to let us troubleshoot faster. This is an early version of the script, I plan on added more functionality to improve the speed of troubleshooting. This script was not intended for malicious purposes, please do not use it for such.

Edit: It looks like a few people out there have been publishing my code without attribution.  I really don’t mind if you post my code, but please give me credit.  The one I’ve found didn’t even change the header (with my full name in it) of the script or the “doneskies” at the end.  Have some class and give me proper attribution.

Click Here to see the script

Quick SSH Tunnel Script

I wrote this script for a friend who needs to get around a work firewall. The script uses Plink to create an SSH tunnel to a server of your choice.

I haven’t added any error handling in it, but I like how it integrates FTP in a batch script. For this script to work, you’ll need at least one server with both FTP and SSH enabled. Make sure to lock down both accounts that you use in the script, and you’ll need to make sure that plink.exe is accessible in the root of the FTP account.

Click Here to check it out

Asterisk Rick Roll Script

You know Rick Astley will never give you up, let your friends know. This was my first Asterisk Scripting project, decided to post the end results under the Asterisk header at the top of the page. Check it out, and let your friends and loved ones know that you’ll never give them up. Click here to check it out