"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "wormscan-1.6.1-src/net/websoup/wormscan/Worm.java" of archive wormscan-1.6.1-src.tar.gz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 package net.websoup.wormscan;
2
3 /*
4 * This file is part of WormScan.
5 *
6 * WormScan is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 import org.apache.oro.text.regex.Perl5Compiler;
22 import org.apache.oro.text.regex.Pattern;
23 import org.apache.oro.text.regex.MalformedPatternException;
24
25 /**
26 * Everything we know about a worm
27 * Copyright: Copyright (c) 2001-2004 Andriy Rozeluk <arozeluk@websoup.net>
28 * @author Andriy Rozeluk
29 * @version 1.6.1
30 */
31 public class Worm {
32 private static Perl5Compiler p5;
33
34 /**
35 * The worm's full name
36 */
37 private String name;
38
39 /**
40 * The worm's abbreviated name
41 */
42 private String shortName;
43
44 /**
45 * Regular expression pattern string to find this worm
46 */
47 private String patternString;
48
49 /**
50 * Compiled regular expression to find this worm
51 */
52 private Pattern pattern;
53
54 /**
55 * Colour to use when displaying worm in output reports
56 */
57 private String colour;
58
59 /**
60 * A tally of attacks this worm caused
61 */
62 private int numAttacks = 0;
63
64 static {
65 p5 = new Perl5Compiler();
66 }
67
68 public int getNumAttacks(){
69 return numAttacks;
70 }
71
72 public void resetNumAttacks(){
73 numAttacks = 0;
74 }
75
76 public void addAttack(){
77 numAttacks++;
78 }
79
80 public String getName(){
81 return name;
82 }
83
84 public void setName( String in ){
85 name = in;
86 }
87
88 public String getShortName(){
89 if ( shortName == null ) return name;
90 return shortName;
91 }
92
93 public void setShortName( String in ){
94 shortName = in;
95 }
96
97 public String getPatternString(){
98 return patternString;
99 }
100
101 public void setPatternString( String in, boolean caseSensitive ) throws MalformedPatternException {
102 patternString = in;
103 if ( caseSensitive ){
104 pattern = p5.compile( patternString );
105 }
106 else {
107 pattern = p5.compile( patternString, p5.CASE_INSENSITIVE_MASK );
108 }
109 }
110
111 public Pattern getPattern(){
112 return pattern;
113 }
114
115 public String getColour(){
116 return colour;
117 }
118
119 public void setColour( String in ){
120 colour = in;
121 }
122 }