Ok, so today I had the bright idea to get my MS SQL Server 2008 to run a stored procedure every night that emails me the results of a query so it would be waiting in my inbox first thing every Monday morning. I created the stored procedure, created the job for SQL Server Agent to run, and tried running the job. The job failed? What? I manually ran my stored procedure just to make sure it was working and it emailed me the results of the query just like it was supposed to. I looked at the history of the job and found this error:
Error formatting query, probably invalid parameters [SQLSTATE 42000] (Error 22050). The step failed.
Now wait a minute, I know my query is good because I just manually ran the stored procedure and it worked, so what is wrong? It took a minute then it hit me, the domain account that SQL Server Agent uses didn't have permission to access the database. So, I added the SQL Server Agent account to the database, gave it execute permissions on the stored procedure, and success! The job now runs successfully on schedule.
Here is what my stored procedure looks like that returns the query results in the body of the email:
EXEC msdb.dbo.sp_send_dbmail
@body = 'The first line of the message body',
@subject = 'This is the subject line',
@profile_name = 'DBMail',
@recipients = 'someone@somewhere.com',
@execute_query_database = 'DatabaseName',
@attach_query_result_as_file = 0,
@query = 'SELECT * FROM TABLE'
My notes on technology, fishing, camping, or anything else I want to write about.
Monday, June 18, 2012
Saturday, June 16, 2012
MSDART.dll and MSADOX.dll registration errors
I developed an application years ago using Visual Basic 6 and I needed to install the application on my 64 bit Windows 7 machine this weekend, but I kept getting errors while trying to run the installer. Here are the errors I received:
The procedure entry point RegEnumKeyExI could not be located in the dynamic link library MSDART.dll
and:
An error occurred while registering the file c:\windows\system32\MSADOX.dll
To solve this error, I opened SETUP.LST in a text editor and deleted the line that referenced MSADOX.dll. I saved the file, ran the installer again and the application installed without any errors. I launched the application and it ran fine.
The procedure entry point RegEnumKeyExI could not be located in the dynamic link library MSDART.dll
and:
An error occurred while registering the file c:\windows\system32\MSADOX.dll
To solve this error, I opened SETUP.LST in a text editor and deleted the line that referenced MSADOX.dll. I saved the file, ran the installer again and the application installed without any errors. I launched the application and it ran fine.
Wednesday, June 6, 2012
SNORT on Ubuntu 12.04
So I have been playing around with my new Ubuntu 12.04 box some more and I decided I wanted to install SNORT on it to do some IDS work. I followed the directions here: https://help.ubuntu.com/community/SnortIDS
but when I tried to launch SNORT using this command:
but when I tried to launch SNORT using this command:
sudo /etc/init.d/snort start
I would get a fail result.
I looked in the syslog:
sudo tail /var/log/syslog
and discovered SNORT was throwing errors related to the database connection. There is a file named database.conf in /etc/snort/ that should have been modified to include the database connection information. The original instructions in the link above instructed me to modify /etc/snort/snort.conf to include the database connection information. This is wrong, the database information should go in /etc/snort/database.conf.
I edited /etc/snort/database.conf to look like this:
output database: log, mysql, user=<user> password=<password> dbname=<dbname> host=<host>
(replace <user>, <password>, <dbname>, and <host> to your settings)
Once I saved the file, I tried starting SNORT again:
sudo /etc/init.d/snort start
And I got a status of OK!
Now I can let SNORT sniff my network traffic and I can use ACID to view the results.
Install Metasploit on Ubuntu 12.04
So I have a new Ubuntu 12.04 box I am playing with and I decided I wanted to install the Metasploit framework to do some testing with. I found a few guides on the internet on how to install MSF 4 on Ubuntu, but the guides were slightly out of date. Here is what I did to install Metasploit framework 4 on my Ubuntu 12.04 box.
Launch a terminal and type the following command:
wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-installer.run
After the download completes, make the file executable:
chmod +x metasploit-latest-linux-installer.run
Now execute the installer:
sudo ./metasploit-latest-linux-installer.run
Setup will walk you through the install process.
Now you can update the Metasploit framework by typing this command:
sudo msfupdate
After the update, I launched Metasploit using sudo so the database tables could be created:
sudo msfconsole
And that is it! You should have Metasploit up and running on Ubuntu 12.04.
Launch a terminal and type the following command:
wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-installer.run
After the download completes, make the file executable:
chmod +x metasploit-latest-linux-installer.run
Now execute the installer:
sudo ./metasploit-latest-linux-installer.run
Setup will walk you through the install process.
Now you can update the Metasploit framework by typing this command:
sudo msfupdate
After the update, I launched Metasploit using sudo so the database tables could be created:
sudo msfconsole
And that is it! You should have Metasploit up and running on Ubuntu 12.04.
Subscribe to:
Posts (Atom)