Ignore:
Timestamp:
Aug 8, 2008, 4:37:54 PM (16 years ago)
Author:
waue
Message:

SnortBase?.java -> tuning some field
SnortParser?.java -> debug and fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sample/hadoop-0.16/tw/org/nchc/code/SnortParser.java

    r45 r47  
    5555    case 4:
    5656      patten_line = Pattern
    57           .compile("^([^ ]*) TTL:([^ ]*) TOS:([^ ]*) ID:([^ ]*) IpLen:([^ ]*) DgmLen:([^ ]*)$");
     57          .compile("^([^ ]*) [^$]*$");
     58      // .compile("^([^ ]*) TTL:([^ ]*) TOS:([^ ]*) ID:([^ ]*) IpLen:([^ ]*) DgmLen:([^ ]*)$");
     59
    5860      break;
    5961    default:
     
    6971        this.logData += (data[j] + ";");
    7072      }
    71 
     73    }else if(i ==1 ){
     74      this.logData += "0;0;0;parse error;";
     75    }else if(i == 2){
     76      this.logData += "Port Scan;3;";
     77    }else if(i == 3){
     78      this.logData += "01;01;00;00;00;error;error;";
     79    }else if(i == 4){
     80      this.logData += "0;";
     81    }else{
     82      this.logData = "*FatalError*";
    7283    }
    7384
     
    8394      if (line == null) {
    8495        break;
    85       }else if(line.isEmpty()){
     96      } else if (line.isEmpty()) {
    8697        fw.write(this.logData.toString() + "\n");
    8798        this.logData = "";
    88         count = 0;       
    89       }else if (count < 4) {
     99        count = 0;
     100      } else if (count < 4) {
    90101        // System.out.println(line);
    91102        snortParser(line, count + 1);
     
    100111  }
    101112
     113  // 需搞定icmp ping 的格式問題
    102114  public static void main(String[] args) throws ParseException, Exception {
    103     String in = new String("/home/waue/Desktop/alert_m");
    104     String ou = new String("/tmp/alert_SnortBase");
     115    String in = new String("/home/waue/Desktop/alert_flex.txt");
     116    String ou = new String("/home/waue/Desktop/alert_flex_parsed.txt");
    105117    SnortParser a = new SnortParser(in, ou);
    106118    a.parseToLine();
Note: See TracChangeset for help on using the changeset viewer.