Change a lot of the program based on suggestions from people on this list,
Thanks to all.  Now I've found an unusual problem that doesn't exactly make
sense.

Have not done a lot of stress testing on this version yet, but found a way
to make it fail that should not fail. What happens is that if it receives
an email with no subject line it gives me the can't use an undefined value
on a hash error at line 16.  I've seen this error a lot, but generally when
I give the program something else to do when it tries to get a value that
does not exist with an 'or' statement it gets through it.  The really weird
part is that line 16 is a GetFirstItem('Body').  When i send an email with
no body the program works fine.  When I send one with no subject it blows
up on line 16.

For testing only I've pulled the 1 second pause out, and moved it, and the
database it's accessing to non-produciton server mainly to speed up the
rate at which it will fail, if it's going to fail.  In case anyone cares,
it's now doing approximately 100-250 iterations a second depending on
system load.  It's using between 19-51% CPU time, and is rock solid at
about 15MB of RAM total over all relevant processes.

Any other suggestions on how to generally improve this version of the code
are still gladly accepted.


##############################################################

use strict;
use diagnostics;
use Win32::OLE;

my $userid = "xxx";
my $server = "xxx/xxx/xxx";
my $Notes = Win32::OLE->new('Notes.NotesSession');
my $Database = $Notes->GetDatabase("$server", "mail\\$userid.nsf");

while (1) {
    print ".";
    my $AllDocuments = $Database->AllDocuments or next;
    my $Document = $AllDocuments->GetFirstDocument or next;
    my $From = $Document->GetFirstItem('From')->{Text} or clean();
    my $Password = $Document->GetFirstItem('Subject')->{Text} or clean();
    my $Command = $Document->GetFirstItem('Body')->{Text} or clean ();
    my $Subject = "CMD: $Command";
    if ($Password eq "xyz") {
        $a = `$Command`;
    } else {
        $a ="You do not have access to this system.  This attack has been
logged";
        $Subject = "ACCESS DENIED";
        open(BAD, ">>BADPASS.TXT");
        print BAD "::ACCESS VIOLATION:: \nFrom: $From\nSubject:
$Password\nBody:\n\n$Command \n\n ";
        close(BAD);
    }
    my $Report = "$a";
    my $ReportMail = $Database->CreateDocument('NEW');
    $ReportMail->{Form} = 'Memo';
    $ReportMail->{Body} = "$Report";
    $ReportMail->{SendTo} = "$From";
    $ReportMail->{Subject} = "$Subject";
    $ReportMail->Save(1, 1);
    $ReportMail->Send(0);
    clean()
}
sub clean {
    foreach (1..3) {
        my $AllDoc = $Database->AllDocuments or return;
        my $delete = $AllDoc->GetFirstDocument or return;
        $delete->Remove(1) or return;
    }
}

####################################################


Chris Benco
[EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to