( Index )

Brief Information about the Oct '06 CSIG Meeting

Security Log

C++ Version 7 and Visual Studio 2005

Written by B. Arnold

Security Log Results

Welcome to the CSIG, a Special Interest Group of the ACGNJ. The subject for this month is a simple text processing program. It uses the latest C++ compiler in Microsoft's Visual Studio 2005 so there are many new things to learn. The program may also be compiled using the free C++ Express compiler.

Here's the background: The Netgear router that I have in my house provides the option of sending a Security Log to my email address. When the email is received by my Eudora software it drops into a mail file determined by a simple filter. The mail file happens to be a simple text file. The data file is about 250,000 lines long and consists of a list of URL's that have been sent messages from my computer over the past year. Here's an example line,

[ALLOW:srx.main.ebayrtm.com] Source: Friday, 22 Sep 2006 23:13:40

It's ridiculous to try to decipher this file because of the huge number of entries. The program reads the text file and creates a list of unique URL's that have been contacted. It also counts the number of times that each URL has been hit. It then presents a display sorted by either URL or count.

The program demonstrates reading text files, parsing lines of data, and creating a listing. It also allows copying the listing to the clipboard for saving or printing.

This is an exciting time for the C Language programming since Microsoft now has 4 different language compilers: C++, C++ Express, C-Sharp, and C-Sharp Express. These are all capable of creating Windows (tm) programs and the "Express" versions are free ! Additionally, Borland has just announced that it also has four new programs that are also available in free versions. These are Turbo C++, Turbo C-Sharp, Turbo Delphi and Turbo Delpi for .NET. You may also want to check with Intel and others for their generally free evaluation versions. Here a link with many compilers: http://www.willus.com/ccomp.shtml

Some Windows (tm) Compiler Companies

GCC, the GNU Compiler Collection - GNU Project
Digital Mars C, C++ and D Compilers

The beginning of the evening (starting at 7:30pm) will be a RANDOM ACCESS discussion. The main presentation will discuss the program.

Our download site has code and programs from most of our meetings. ( Source Code Files )

Sample Code - VC7

Sample Code
    void Process(void)
                Cursor->Current = Cursors::WaitCursor;
                Hashtable ^mUrl = gcnew Hashtable(10007);       // Prime number benifit???
                int lines = 0, hits = 0;

                    StreamReader^ sr = gcnew StreamReader( LOGFILE );   // Read file
                    String ^ hDelims = ":[]";
                    array^delimiter = hDelims->ToCharArray();
                    array^ hTokens = nullptr;

                        String^ slineBuff;  int n, count;
                        while ( slineBuff = sr->ReadLine() )    // Read 179829 lines.
                                hTokens = slineBuff->Split(delimiter,5);
                                n = hTokens->Length;
                                if (n>2 && hTokens[1] == "ALLOW")
                                    if (mUrl->Contains(hTokens[2]))     // www.google.com
                                        count = (int)mUrl[hTokens[2]];
                                        mUrl[hTokens[2]] = 1 + count;
                                        mUrl->Add(hTokens[2], 1);
                            if ( sr )
                                delete (IDisposable^)sr;
                catch ( Exception^ e ) 
                    Console::WriteLine( "The file could not be read:" );
                    Console::WriteLine( e->Message );

"Random Access" questions start at 7:30 Tuesday night.


Source Code Files

For help, email me at b a r n o l d @ i e e e . o r g
Back to C++ Main Page