[Plugins-writers] nasl hash question

From: dave@private
Date: Sat Mar 13 2004 - 12:16:17 PST

  • Next message: Michel Arboi: "Re: [Plugins-writers] nasl hash question"

    After creating a hash using make_array, I'm performing a match on the index with the values contained in "myarray." The following code matches "index1" and "index4" correctly, but I would like to display the value of the hash and not the index. How would I go about this?
    
    myhash = make_array('index1', "value1",
                        'index2', "value2",
                        'index3', "value3",
                        'index4', "value4",
                        'index5', "value5"
                    );
    
    mydata = "foooooblah,foooindex1,foooooblahagain,fooindex4,foooooo, morefoooooooo";
    myarray = split(mydata,sep:",");
    
    for(i=0;myarray[i];i=i+1) {
    foreach index (keys(myhash))  {
    if ( ereg(string:myarray[i],pattern:index))  {
    display(index,"\n"); #prints the hash index
    }
    }
    }
    
    -dave
    _______________________________________________
    Plugins-writers mailing list
    Plugins-writers@private
    http://mail.nessus.org/mailman/listinfo/plugins-writers
    



    This archive was generated by hypermail 2b30 : Sat Mar 13 2004 - 11:37:50 PST