Tuesday, September 8, 2020

Greenbone GSM/OpenVAS CIDR file

A consideration when creating a scan task is to configure it for a single host, multiple hosts via range, or CIDR format. A limitation that exists is the number of hosts that a single scan can be performed on. This limitation is, "The maximum netmask is /20. This equals 4096 addresses." If you're attempting to import a file that contains the hosts, and networks to scan, you may come across a error message that is not overly helpful. The error message is, "Error in host specification". The error message may be correct if you fat fingered one or more entries per line in the file that GSM doesn't like. The error message may instead not be correct in the sense that there is no problem with formatting, but in the number of hosts specified in the file. This particularly comes into play if you're specifying large class numbers, which of course means a large number of hosts. For example, despite the limitation being 4096, specifying 16 entries with a C class /24 CIDR notation, the file will still throw the error. Reducing the file by one to 15 entries and moving the 16th entry to another file to be used for a scan task will give the desired results.

Tuesday, July 21, 2020

SAP Crystal Reports trial key for older releases

While SAP doesn't come out and say it, it is possible to obtain a trial key for older releases where needed by registering an account with them in order to obtain a Crystal Reports 2016 keycode which will work with an older release such as what I deployed which was 2011 SP12 which was end of life, and end of support. This particular version was required to maintain compatibility with a software package that a client is using. In summary, as of the time of this writing, a new trial key will work with older versions, at least as far back as 2011 SP12.

SSRS native does not bind TCP ports configured

Should you be finding that an installation of Microsoft SQL Server Reporting Services (SSRS) is not binding to the configured TCP ports, the best place to look is in the log files. A default installation will be located at the following location: C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\LogFiles. The log files in particular are named RSHostingService_* and you'll then likely be able to isolate the cause of the problem. In my case, it was a matter of installing SSRS after SQL Server that was purchased through volume license where product keys are not provided through the web site. The product key for SQL server purchased and downloaded via this manner is actually available on the ISO image in the root folder in a file named Default.ini. Use this product key to register SSRS. Note that if you've previously installed SSRS in trial mode, all of the enterprise features are enabled. If applying a server standard license, SSRS will complain loudly about various things, such as the Scale-Out not being supported which is what I was presented with. I hope that this helps someone else that forgot to license their SSRS installation and cannot figure out why it doesn't work after the evaluation period expires.

Saturday, January 14, 2012

Castleville assets not fully loading

I've been playing Zynga's Castleville on facebook lately and have recently lost certain game assets. The game loads fine when I'm taking a break at work. At home, however, it doesn't appear to load all of the game assets (e.g. Beastie and farm). After verifying all of the typical things, latest version of the Adobe Flash Player, clearing my cache, etc. I was still experiencing the same problem. This has been going on for almost a week now and I suspected that it had something to do my internet connection being shaped as the problem began near enough to that happening. Wanting to have a play today, I began thinking about differences between my work Firefox (v9) and my home version. It occurred to me that apart from the number of tabs and their content, the TorButton extension was the only difference. Into the Add-ons dialog I go, remove the extension (as I rarely use it) and restart Firefox. I log back into facebook and hit Castleville; wait for the game to finish loading and presto, everything is now as it should be.

Monday, June 27, 2011

VMware Server reconfiguration required on boot

Under a Debian 5.0 installation, VMware Server 2.0.2-203138 is currently installed.

The issue being experienced is that every time the server is restarted, vmware-config.pl needs to be ran so that the service may successfully start.

This appears to be a fairly common problem, however, there did not appear to be a magic bullet solution that actually corrected the issue.

Further investigation suggested that during installation, VMware creates the device nodes in /dev and expects them to be present on subsequent system starts.  The issue with this is that with udev, the device nodes are dynamically created and thus the VMware nodes are lost.  While the /etc/init.d/vmware script suggests that the nodes are created, they aren't from my experience.

One solution to the problem is to force the creation of the nodes required within /etc/init.d/vmware within the service_vmware start function as such:

service_vmware() {
   # See how we were called.
   case "$1" in
      start)
         if vmware_inVM; then
            # Refuse to start services in a VM: they are useless
            exit 1
         fi

        # UDEV fix follows
        if [ ! -e "/dev/vmmon" ]; then
                mknod /dev/vmmon c 10 165 2>/dev/null;
                chmod 600 /dev/vmmon
        fi
        if [ ! -s "/dev/vmci" ]; then
                mknod /dev/vmci c 10 60 2>/dev/null;
                chmod 666 /dev/vmci
        fi
        for a in `seq 0 9`; do
                if [ ! -e "/dev/vmnet$a" ]; then
                        mknod /dev/vmnet$a c 119 $a 2>/dev/null;
                        chmod 600 /dev/vmnet$a
                fi
        done

That solved the device nodes problem for me.

However, another issue was still present that required vmware-config.pl to be ran on server restarts and this was that /etc/vmware/not_configured was now present.

During the start up process for VMware, an exitcode variable is built up from the running and/or starting of various programs required by VMware to operate.

If this variable is anything other than zero and the VMware product is not VMware Workstation, the not_configured file is generated.  The impact of this file being present on the next attempted starting of the service results in an exiting of the script from the check_configured function complete with and advising note that VMware has not been configured and that vmware-config.pl needs to be ran to resolve the problem.

Running vmware-config.pl does in fact solve the problem as expected, however, as previously mentioned, the requirements do not stick.

The additional requirement for me to overcome this problem was to comment out the exitcode check performed by the script.

Just below the section added above within the service_vmware start function, you'll need to comment out this check as shown below:

#         if [ "$exitcode" -gt 0 -a `vmware_product` != "ws" ]; then
#            # Set the 'not configured' flag
#            touch "$vmware_etc_dir"'/not_configured'
#            chmod 644 "$vmware_etc_dir"'/not_configured'
#            db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \
#               "$vmware_etc_dir"'/not_configured'
#            exit 1
#         fi

While this is not the most ideal solution for some, it solved the problem for me and I hope that some of this information may help others.

Saturday, April 16, 2011

Gaining access to underlying log levels that are not exposed in log4net

Within log4net, the ILog interface exposes five general log levels that are typically used within an application and they are:
  1. Debug
  2. Error
  3. Fatal
  4. Info
  5. Warn
Now, what if you want access to alternative underlying log levels that the system supports yet the ILog interface does not expose?  What needs to be done in order to achieve this goal?

There are a few ways of achieving this goal and what follows will be what I believe to be the most simplistic method possible using the technology available to us at this point in time.  The alternative methods, I will leave up to you, the reader, to research for yourself as they are not the target of this article, nor is it the intention to compare the alternatives with what has been chosen to implement.

We are going to use extension methods to achieve this goal.

    /// <summary>
    /// Extension methods for <see cref="ILog"/> implementations that provide the callers access to the <see cref="Level.Finest"/> logging level.
    /// </summary>
    public static class LogExtensions
    {
        private static readonly Type DeclaringType = typeof(LogExtensions);

        /// <summary>
        /// Log a message object with the <see cref="Level.Finest"/> level
        /// </summary>
        /// <param name="log">The ILog interface is use by application to log messages into the log4net framework.</param>
        /// <param name="message">The message object to log.</param>
        public static void Finest( this ILog log, object message )
        {
            // NullLog returns null for 'Logger' property.
            if ( log.Logger == null )
                return;

            log.Logger.Log( DeclaringType, Level.Finest, message, null );
        }

        /// <summary>
        /// Log a message object with the <see cref="Level.Finest"/> level
        /// </summary>
        /// <param name="log">The ILog interface is use by application to log messages into the log4net framework.</param>
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        public static void Finest( this ILog log, object message, Exception exception )
        {
            // NullLog returns null for 'Logger' property.
            if ( log.Logger == null )
                return;

            log.Logger.Log( DeclaringType, Level.Finest, message, exception );
        }

        /// <summary>
        /// Logs a formatted message string with the <see cref="Level.Finest"/> level.
        /// </summary>
        /// <param name="log">The ILog interface is use by application to log messages into the log4net framework.</param>
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        public static void FinestFormat( this ILog log, string format, params object [] args )
        {
            // NullLog returns null for 'Logger' property.
            if ( log.Logger == null )
                return;

            if ( log.IsFinestEnabled() )
                log.Logger.Log( DeclaringType, Level.Finest,
                    new SystemStringFormat( CultureInfo.InvariantCulture, format, args ), null );
        }

        /// <summary>
        /// Checks if this logger is enabled for the <c>Finest</c> level.
        /// </summary>
        /// <param name="log">The logger instance to check.</param>
        /// <returns>
        ///     <c>true</c> if this logger is enabled for <c>Finest</c> events, <c>false</c> otherwise.
        /// </returns>
        public static bool IsFinestEnabled( this ILog log )
        {
            // NullLog returns null for 'Logger' property.
            if ( log.Logger == null )
                return false;
            return log.Logger.IsEnabledFor( Level.Finest );
        }
    }

As can be seen, the extension method class is fairly straight forward and easy to understand.

What may not apply for you, the reader, is the null check within each of the extension methods (see comments about NullLog).

The null checks are there because an NullLog ILog instance that is used within unit tests where the FINEST level of logging is not utilized within any assertions. If you have no use for such checks, feel free to remove them.

I hope that this snipped of code makes someones life easier.  Happy hacking!

Monday, February 7, 2011

Samsung Kies fails to connect to device

I recently updated Samsung Kies to version 2.0.0.11014_49 and the software was no longer able to connection to my Samsung Galaxy S running Android 2.2.

The error message displayed was that CEUTIL.DLL could not be found.

The solution was to locate the CEUTIL.DLL and RAPI.DLL files:
C:\Program Files (x86)\Common Files\Samsung\DeviceService

They are called _ceutil.dll and _rapi.dll.

Copy them to your Samsung Kies directory:
C:\Program Files (x86)\Samsung\Kies

Now rename them to remove the underscore from the beginning of the file name.

Restart Samsung Kies and you should now be able to connect your device.