Changeset 43 for sample/hadoop-0.16/tw/org/nchc/code/SnortParser.java
- Timestamp:
- Jul 23, 2008, 5:08:53 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/hadoop-0.16/tw/org/nchc/code/SnortParser.java
r33 r43 3 3 * Editor: Waue Chen 4 4 * From : NCHC. Taiwn 5 * Last Update Date: 07/ 17/20085 * Last Update Date: 07/23/2008 6 6 */ 7 7 … … 43 43 case 1: 44 44 patten_line = Pattern 45 .compile("^\\[\\**\\] \\[([ 1-9]*):([1-9]*):([1-9]*)\\] ([^\\[]*)\\[\\**\\]$");45 .compile("^\\[\\**\\] \\[([0-9]*):([0-9]*):([0-9]*)\\] ([^\\[]*)\\[\\**\\]$"); 46 46 break; 47 47 case 2: … … 80 80 int count = 0; 81 81 do { 82 String tmp= fi.readLine();83 if ( tmp== null) {82 line = fi.readLine(); 83 if (line == null) { 84 84 break; 85 } else if (count < 4) { 86 line = tmp; 85 }else if(line.isEmpty()){ 86 fw.write(this.logData.toString() + "\n"); 87 this.logData = ""; 88 count = 0; 89 }else if (count < 4) { 87 90 // System.out.println(line); 88 91 snortParser(line, count + 1); 89 92 count++; 90 } else if (count == 4){93 } else { 91 94 count++; 92 } else if (count == 5) {93 fw.write(this.logData.toString() + "\n");94 this.logData = "";95 count = 0;96 } else {97 System.err.print(" Error ! ");98 return;99 95 } 100 96 } while (true); … … 105 101 106 102 public static void main(String[] args) throws ParseException, Exception { 107 String in = new String("/home/waue/Desktop/alert ");108 String ou = new String("/ home/waue/Desktop/bb");103 String in = new String("/home/waue/Desktop/alert_m"); 104 String ou = new String("/tmp/alert_my"); 109 105 SnortParser a = new SnortParser(in, ou); 110 106 a.parseToLine();
Note: See TracChangeset
for help on using the changeset viewer.