Changeset 1108

Show
Ignore:
Timestamp:
01/11/08 16:55:41 (8 months ago)
Author:
kindlund
Message:

Updated fingerprint data model to reflect new Ruby database structure.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/lib/HoneyClient/Agent/Integrity.pm

    r1008 r1108  
    437437  $changes = { 
    438438    #A reference to an anonymous array of process objects 
    439     processes => [ { 
     439    os_processes => [ { 
    440440        'name' => "C:\WINDOWS\system32\Notepad.exe", # The process name as a full path 
    441441        'pid' => 1000,              # The Windows system process ID 
     
    450450         
    451451        #OPTIONAL, its existence signifies that we saw this process be created 
    452         'created_time' => ISO 8601 Timestamp (yyyy-mm-dd hh24:mi:ss.uuuuuu) 
     452        'created' => ISO 8601 Timestamp (yyyy-mm-dd hh24:mi:ss.uuuuuu) 
    453453         
    454454        #OPTIONAL, its existence signifies that we saw this process be terminated 
    455         'terminated_time' => ISO 8601 Timestamp 
     455        'stopped' => ISO 8601 Timestamp 
    456456 
    457457        #A reference to an anonymous array of registry objects 
    458         registry => [ { 
     458        regkeys => [ { 
    459459            # The registry directory name in regedit 
    460460            'key_name' => 'HKEY_LOCAL_MACHINE\Software...', 
    461461 
    462             'time' => ISO 8601 Timestamp,  
     462            'time_at' => ISO 8601 Timestamp,  
    463463 
    464464            #The specific registry event type which took place, as given by it's Windows name 
    465             'event_type' => { CreateKey | OpenKey | CloseKey | Query Key | 
     465            'event' => { CreateKey | OpenKey | CloseKey | Query Key | 
    466466                                QueryValueKey, EnumerateKey | EnumerateValueKey |  
    467467                                SetValueKey | DeleteValueKey | DeleteKey }, 
     
    472472            #The "type" which shows up in regedit. It is only possible to create the first  
    473473            # 6 types by manually using regedit (and REG_NONE is only indirect, for instance 
    474             # on a DeleteValueKey event_type). 
     474            # on a DeleteValueKey event). 
    475475            'value_type' => { REG_NONE | REG_SZ | REG_BINARY | REG_DWORD |  
    476476                                REG_EXPAND_SZ | REG_MULTI_SZ | REG_LINK |  
     
    485485         
    486486        #A reference to an anonymous array of file system objects 
    487         file_system => [ { 
     487        process_files => [ { 
    488488            #The full path and name of the file which was effected 
    489489            'name'  => 'C:\WINDOWS\SYSTEM32...', 
    490490 
    491             'event_type' => { Deleted | Read | Write }, #TODO: add created & renamed/moved 
    492  
    493             'time' => ISO 8601 Timestamp,  
     491            'event' => { Deleted | Read | Write }, #TODO: add created & renamed/moved 
     492 
     493            'time_at' => ISO 8601 Timestamp,  
    494494             
    495495            #OPTIONAL, this will not exist for deleted files 
     
    546546    else{ 
    547547        %changes = ( 
    548             'processes' => [], 
     548            'os_processes' => [], 
    549549        ); 
    550550 
     
    596596    my @tmp_toks = split("\",\"",$capdump[0]); 
    597597    $tmp_toks[0] =~ s/^"(.*)/$1/; 
    598     %changes = ('compromise_time' => $tmp_toks[0]); 
     598    %changes = ('time_at' => $tmp_toks[0]); 
    599599    my $line_num = 0; 
    600600 
     
    618618                #If the object already exists as something which didn't have anything filled in, then fill it in 
    619619                if($ret == 1){ 
    620                     $proc_objs[$index]->{"$toks[$P_EVENT_TYPE]_time"} = $toks[$P_TIME]; 
     620                    #$proc_objs[$index]->{"$toks[$P_EVENT_TYPE]_time"} = $toks[$P_TIME]; 
     621                    $proc_objs[$index]->{"stopped"} = $toks[$P_TIME]; 
    621622                    $proc_push = 0;  
    622623                } 
     
    628629                'parent_pid' => $toks[$P_PARENT_PID], 
    629630                'parent_name' => $toks[$P_PARENT_NAME], 
    630                 "$toks[$P_EVENT_TYPE]_time" => $toks[$P_TIME], 
    631                 'file_system' => [], 
    632                 'registry' => [], 
     631                #"$toks[$P_EVENT_TYPE]_time" => $toks[$P_TIME], 
     632                'created' => $toks[$P_TIME], 
     633                'process_files' => [], 
     634                'regkeys' => [], 
    633635            }; 
    634636        } 
     
    645647                    'pid' => $toks[$R_PROC_PID], 
    646648                    'name' => $toks[$R_PROC_NAME], 
    647                     'registry' => [], 
    648                     'file_system' => [],  
     649                    'regkeys' => [], 
     650                    'process_files' => [],  
    649651                };  
    650652                $proc_push = 1; 
     
    665667                } 
    666668                my $reg_obj = { 
    667                     'time' => $toks[$R_TIME], 
    668                     'event_type' => $toks[$R_EVENT_TYPE], 
     669                    'time_at' => $toks[$R_TIME], 
     670                    'event' => $toks[$R_EVENT_TYPE], 
    669671                    'key_name' => $sanit_key_name, 
    670672                    'value_name' => $toks[$R_VALUE_NAME], 
     
    672674                    'value' => $toks[$R_VALUE], 
    673675                }; 
    674                 push @{$proc_obj->{'registry'}}, $reg_obj; 
     676                push @{$proc_obj->{'regkeys'}}, $reg_obj; 
    675677            } 
    676678            elsif($toks[$ENTRY_TYPE] eq "file"){ 
    677679 
    678680                #Build the filesystem object and put it in to the proc object 
    679                 my $fs_ref = $proc_obj->{'file_system'}; 
     681                my $fs_ref = $proc_obj->{'process_files'}; 
    680682                if(scalar(@{$fs_ref}) == 0 || $fs_ref->[-1]->{'name'} ne $toks[$F_NAME] || 
    681                         $fs_ref->[-1]->{'event_type'} ne $toks[$F_EVENT_TYPE]){ 
     683                        $fs_ref->[-1]->{'event'} ne $toks[$F_EVENT_TYPE]){ 
    682684                       
    683685                    my $file_obj = { 
    684686                        'name' => $toks[$F_NAME], 
    685                         'event_type' => $toks[$F_EVENT_TYPE], 
    686                         'time' => $toks[$F_TIME], 
     687                        'event' => $toks[$F_EVENT_TYPE], 
     688                        'time_at' => $toks[$F_TIME], 
    687689                    }; 
    688690                    if($toks[$F_EVENT_TYPE] ne "Delete"){ 
     
    741743                            }; 
    742744                        } 
    743                         push @{$proc_obj->{'file_system'}},$file_obj; 
     745                        push @{$proc_obj->{'process_files'}},$file_obj; 
    744746                    } 
    745747 
     
    752754    }#end foreach 
    753755 
    754     $changes{'processes'} = \@proc_objs; 
     756    $changes{'os_processes'} = \@proc_objs; 
    755757#    $Data::Dumper::Terse = 1; 
    756758#    $Data::Dumper::Indent = 1; 
     
    762764    # If any changes were found, write them out to the 
    763765    # filesystem. 
    764     if (scalar($changes{'processes'})){ 
     766    if (scalar($changes{'os_processes'})){ 
    765767        if (!open(CHANGE_FILE, ">>" . $self->{changes_found_file})) { 
    766768            $LOG->error("Unable to write changes to file '" . $self->{changes_found_file} . "'.");